openairesponses

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

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 New

func New(cfg Config) *Client

New constructs a Responses API client emulator.

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

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) ObserveResponse

func (h *History) ObserveResponse(res *responses.Response) error

func (*History) ObservedReasoning

func (h *History) ObservedReasoning() []ObservedReasoning

func (*History) ObservedReasoningIDs

func (h *History) ObservedReasoningIDs() []string

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

type StreamStats struct {
	ReasoningTextDone int
	Completed         bool
}

Jump to

Keyboard shortcuts

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