Documentation
¶
Overview ¶
Package responses implements the provider-neutral Responses API wire codec.
Index ¶
- func BuildRequestBody(req core.Request, dialect Dialect) ([]byte, error)
- func ConsumeStream(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, ...)
- func ConsumeStreamSanitized(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, ...)
- func ConsumeStreamSanitizedWithPriority(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, ...)
- func ConsumeStreamWithPriority(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, ...)
- func MapReasoningEffort(level string, allowed []string) string
- func ParseTextSignature(sig string) (id, phase string)
- func RequestsPriority(req core.Request, dialect Dialect) bool
- type Dialect
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildRequestBody ¶
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 ConsumeStreamSanitizedWithPriority ¶ added in v0.36.0
func ConsumeStreamSanitizedWithPriority(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, provider, model string, requestedPriority bool)
ConsumeStreamSanitizedWithPriority is ConsumeStreamWithPriority without exposing upstream error messages.
func ConsumeStreamWithPriority ¶ added in v0.36.0
func ConsumeStreamWithPriority(ctx context.Context, body io.Reader, ch chan<- core.AssistantEvent, provider, model string, requestedPriority bool)
ConsumeStreamWithPriority parses a Responses stream and records whether the request asked for the priority tier when the response omits its tier echo.
func MapReasoningEffort ¶
MapReasoningEffort maps Moa's effective thinking level to an OpenAI reasoning effort. Some models, including GPT-6 Astra, also support max.
func ParseTextSignature ¶
parseTextSignature decodes a TextSignature blob back into id/phase. Tolerates empty/legacy values.
func RequestsPriority ¶ added in v0.36.0
RequestsPriority reports whether BuildRequestBody will request the premium Responses service tier. Providers pass this to stream consumption as the fallback when an upstream response omits its service_tier echo.
Types ¶
type Dialect ¶
type Dialect struct {
Provider string
Model string
SupportsDocuments bool
SupportsMaxOutputTokens bool
SupportsParallelToolCalls bool
SupportsPromptCacheKey bool
SupportsExplicitCacheBreakpoints bool
SupportsServiceTier 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.