Documentation
¶
Index ¶
- func ContextError(ctx context.Context) error
- func MergeChunk(response *llm.Response, chunk llm.Chunk)
- type APIError
- type Codec
- func (c Codec) FailedResponse(op string, response sdkresponses.Response) error
- func (c Codec) FullResponse(op, configuredModel string, tools []llm.Tool, format llm.ResponseFormat, ...) (*llm.Response, error)
- func (c Codec) Produce(ctx context.Context, op, model string, ...) error
- func (c Codec) ProduceEvents(ctx context.Context, op, model string, ...) error
- func (c Codec) Request(op, model string, request llm.Request, options RequestOptions) (openairesponses.ResponseNewParams, error)
- type EventStream
- type InputAudioOptions
- type OpenStream
- type RequestOptions
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextError ¶
ContextError preserves both cancellation identity and a distinct cause.
Types ¶
type APIError ¶
type APIError struct {
Type string `json:"type,omitempty"`
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}
APIError is an error reported by an OpenAI Responses endpoint.
type Codec ¶
Codec translates llm-go's neutral conversation representation to and from the OpenAI Responses protocol.
func (Codec) FailedResponse ¶ added in v0.2.0
func (c Codec) FailedResponse(op string, response sdkresponses.Response) error
FailedResponse converts a failed non-streaming Responses object into a provider error.
func (Codec) FullResponse ¶ added in v0.2.0
func (c Codec) FullResponse(op, configuredModel string, tools []llm.Tool, format llm.ResponseFormat, response sdkresponses.Response) (*llm.Response, error)
FullResponse converts one completed or incomplete non-streaming Responses object with the same output validation and replay envelope used by streaming.
func (Codec) Produce ¶
func (c Codec) Produce(ctx context.Context, op, model string, params openairesponses.ResponseNewParams, open OpenStream, emit internalstream.Emit) error
Produce decodes one Responses API event stream into neutral chunks.
func (Codec) ProduceEvents ¶
func (c Codec) ProduceEvents(ctx context.Context, op, model string, params openairesponses.ResponseNewParams, stream EventStream, emit internalstream.Emit) error
ProduceEvents decodes an already-open decoded Responses event source through the same validation and chunk state machine used by SSE.
func (Codec) Request ¶
func (c Codec) Request(op, model string, request llm.Request, options RequestOptions) (openairesponses.ResponseNewParams, error)
Request converts a validated neutral request into Responses API parameters.
type EventStream ¶
type EventStream interface {
Next() bool
Current() openairesponses.ResponseStreamEventUnion
Err() error
Close() error
}
EventStream is a decoded Responses event source. The OpenAI SSE stream and provider-specific transports such as Codex WebSocket implement this contract.
type InputAudioOptions ¶
type InputAudioOptions struct {
MaxDecodedBytes int
}
InputAudioOptions enables the private Responses input_audio content variant used by endpoints that explicitly support it. Public Responses callers leave this nil.
type OpenStream ¶
type OpenStream func(context.Context, string, openairesponses.ResponseNewParams) (*Stream, error)
OpenStream starts one Responses API event stream.
type RequestOptions ¶
type RequestOptions struct {
Subscription bool
ReasoningSummary bool
EncryptedReasoning bool
JSONObjectOutput bool
NamedToolChoice bool
StrictTools bool
ExplicitPromptCache bool
AdditionalTools bool
ToolSearch bool
InputAudio *InputAudioOptions
}
RequestOptions captures endpoint differences within the Responses protocol.
type Stream ¶
type Stream = ssestream.Stream[openairesponses.ResponseStreamEventUnion]
Stream is the OpenAI SDK stream consumed by Codec.