Documentation
¶
Overview ¶
Package openairesponses implements the OpenAI Responses wire protocol (POST /responses). Every vendor-specific deviation is driven by api.OpenAIResponsesSettings; this package contains no vendor names.
Index ¶
- type Client
- func (c *Client) BuildRequestBody(messages []api.Message, opts *api.Options, stream bool) (map[string]any, error)
- func (c *Client) Chat(ctx context.Context, messages []api.Message, opts *api.Options) (*types.ChatResponse, error)
- func (c *Client) ChatStream(ctx context.Context, messages []api.Message, opts *api.Options) (<-chan types.StreamResponse, error)
- func (c *Client) GetModelID() string
- func (c *Client) GetModelName() string
- func (c *Client) Settings() Config
- type Config
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 talks the Responses protocol to one endpoint.
func (*Client) BuildRequestBody ¶
func (c *Client) BuildRequestBody(messages []api.Message, opts *api.Options, stream bool) (map[string]any, error)
BuildRequestBody is the golden-test entry point: it returns the exact JSON object that would be sent for the given inputs.
func (*Client) Chat ¶
func (c *Client) Chat(ctx context.Context, messages []api.Message, opts *api.Options) (*types.ChatResponse, error)
Chat performs a non-streaming response creation.
func (*Client) ChatStream ¶
func (c *Client) ChatStream( ctx context.Context, messages []api.Message, opts *api.Options, ) (<-chan types.StreamResponse, error)
ChatStream performs a streaming response creation.
func (*Client) GetModelID ¶
GetModelID returns WeKnora's model identifier.
func (*Client) GetModelName ¶
GetModelName returns the wire model name.
type Config ¶
type Config struct {
Endpoint api.Endpoint
Settings api.OpenAIResponsesSettings
// ThinkingLevels maps neutral levels to the vendor vocabulary.
ThinkingLevels api.ThinkingLevelMap
// Reasoning marks a reasoning model: sampling parameters are dropped and
// encrypted reasoning items are requested where the vendor supports them.
Reasoning bool
// SessionID feeds prompt_cache_key when the caller sets none.
SessionID string
}
Config is everything the client needs, already resolved by the api.