Documentation
¶
Overview ¶
Package openairesponses is a reference client emulator for the OpenAI Responses API, built on github.com/openai/openai-go/v3. Use it against lipstd or httptest fakes in integration tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the official SDK for scriptable Responses calls.
func (*Client) CreateResponse ¶
func (c *Client) CreateResponse(ctx context.Context, body responses.ResponseNewParams) (*responses.Response, error)
CreateResponse performs a non-streaming responses.create call.
func (*Client) CreateResponseStream ¶
func (c *Client) CreateResponseStream(ctx context.Context, body responses.ResponseNewParams) *ssestream.Stream[responses.ResponseStreamEventUnion]
CreateResponseStream performs responses.create with stream enabled (official SDK path).
type Config ¶
type Config struct {
BaseURL string
APIKey string
// If nil, the SDK default HTTP client is used.
HTTPClient *http.Client
// DisableSDKRetries, when true, sets the official client MaxRetries to 0 so the first
// 401/429 from httptest/refbackend is visible to credential-rotation tests.
DisableSDKRetries bool
}
Config configures the official OpenAI Go client (base URL should include the /v1 prefix).
type EncryptedPresence ¶
type EncryptedPresence string
const ( EncryptedAbsent EncryptedPresence = "absent" EncryptedNull EncryptedPresence = "null" EncryptedEmpty EncryptedPresence = "empty" EncryptedValue EncryptedPresence = "value" )
type History ¶
type History struct {
// contains filtered or unexported fields
}
func NewHistory ¶
func NewHistory(policy RetentionPolicy) *History
func (*History) NewParams ¶
func (h *History) NewParams(model, userText string) responses.ResponseNewParams
func (*History) ObservedReasoning ¶
func (h *History) ObservedReasoning() []ObservedReasoning
func (*History) ObservedReasoningIDs ¶
type ObservedReasoning ¶
type ObservedReasoning struct {
ID string
Encrypted EncryptedPresence
Status string
HasContent bool
RawItem json.RawMessage
}
type RetentionPolicy ¶
type RetentionPolicy int
const ( PreserveReasoning RetentionPolicy = iota DropReasoning )
type StreamStats ¶
func ReadCompletedResponse ¶
func ReadCompletedResponse(stream *ssestream.Stream[responses.ResponseStreamEventUnion]) (*responses.Response, StreamStats, error)
Click to show internal directories.
Click to hide internal directories.