Documentation
¶
Overview ¶
Package openairesponses implements the OpenAI Responses API backend connector using github.com/openai/openai-go/v3. It maps lipapi.Call to responses.create and streams canonical events from the official SSE stream.
Index ¶
- Constants
- func CompletionEvents(resp responses.Response) ([]lipapi.Event, error)
- func New(cfg Config) execbackend.Backend
- func NewSDKStream(s *ssestream.Stream[responses.ResponseStreamEventUnion], maxPending int) lipapi.ManagedEventStream
- func ParamsForCall(call *lipapi.Call, cand routing.AttemptCandidate) (responses.ResponseNewParams, error)
- type Config
Constants ¶
const (
DefaultBaseURL = "https://api.openai.com/v1"
)
const ID = "openai-responses"
ID is the reserved plugin identifier for the OpenAI Responses backend.
Variables ¶
This section is empty.
Functions ¶
func CompletionEvents ¶
CompletionEvents converts a non-streaming Responses API payload into canonical events.
func New ¶
func New(cfg Config) execbackend.Backend
New returns a runtime backend that invokes the OpenAI Responses API using openai-go.
func NewSDKStream ¶
func NewSDKStream(s *ssestream.Stream[responses.ResponseStreamEventUnion], maxPending int) lipapi.ManagedEventStream
func ParamsForCall ¶
func ParamsForCall(call *lipapi.Call, cand routing.AttemptCandidate) (responses.ResponseNewParams, error)
ParamsForCall builds an OpenAI Responses create payload from a canonical call.
Types ¶
type Config ¶
type Config struct {
BaseURL string
APIKey string
// APIKeys is the ordered credential list for this backend instance.
// When non-empty, APIKey should match APIKeys[0] for SDK compatibility.
APIKeys []string
// Credentials is the structured credential list. When set, it takes precedence
// over APIKey/APIKeys and preserves non-secret credential IDs for diagnostics.
Credentials []credpool.Credential
// HTTPClient is optional; when nil the SDK default is used.
HTTPClient *http.Client
// SDKMaxRetries optionally sets the official SDK MaxRetries (nil = SDK default).
// Integration tests that assert a single upstream attempt on 429/401 should use a pointer to 0.
SDKMaxRetries *int
DefaultVerbosity lipapi.VerbosityLevel
}
Config configures the OpenAI Responses backend connector (official SDK). BaseURL must include the API prefix (e.g. https://api.openai.com/v1).