openairesponses

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0, MIT Imports: 9 Imported by: 0

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

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 New

func New(cfg Config) *Client

New creates a client. The endpoint must already carry auth and headers.

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

func (c *Client) GetModelID() string

GetModelID returns WeKnora's model identifier.

func (*Client) GetModelName

func (c *Client) GetModelName() string

GetModelName returns the wire model name.

func (*Client) Settings

func (c *Client) Settings() Config

Settings exposes the resolved settings (diagnostics, tests).

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.

Jump to

Keyboard shortcuts

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