responses

package
v0.30.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package responses implements the provider-neutral Responses API wire codec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRequestBody

func BuildRequestBody(req core.Request, dialect Dialect) ([]byte, error)

BuildRequestBody encodes a stateless streaming Responses API request.

func ConsumeStream

func ConsumeStream(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, provider, model string)

consumeStream parses Responses API SSE and emits normalized AssistantEvents.

func ConsumeStreamSanitized

func ConsumeStreamSanitized(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, provider, model string)

ConsumeStreamSanitized parses a Responses stream without exposing upstream error messages. Private compatibility backends can echo request metadata in SSE errors, so their adapters use this stricter boundary.

func MapReasoningEffort

func MapReasoningEffort(level string, allowed []string) string

mapReasoningEffort maps our thinking levels to OpenAI reasoning effort. OpenAI supports: none, minimal, low, medium, high, xhigh.

func ParseTextSignature

func ParseTextSignature(sig string) (id, phase string)

parseTextSignature decodes a TextSignature blob back into id/phase. Tolerates empty/legacy values.

Types

type Dialect

type Dialect struct {
	Provider                  string
	Model                     string
	SupportsDocuments         bool
	SupportsMaxOutputTokens   bool
	SupportsParallelToolCalls bool
	AllowedReasoningEfforts   []string
}

Dialect describes the validated Responses API capabilities of a transport. It intentionally contains protocol features only; URLs, credentials and retry policies stay in the owning provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL