openai

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIncompleteStream is a stream that closed before its terminal event.
	ErrIncompleteStream = provider.ErrIncompleteStream
	// ErrMalformedStream is a stream event that is not valid JSON.
	ErrMalformedStream = provider.ErrMalformedStream
)

Functions

This section is empty.

Types

type APIStatusError

type APIStatusError = provider.APIStatusError

APIStatusError is an HTTP error answer from the provider. Find it in a wrapped chain with errors.As.

type Model added in v0.5.0

type Model struct {
	// contains filtered or unexported fields
}

Model holds only model and endpoint settings; each request carries its own prompt and cache key, so one is safe to share.

func New added in v0.5.0

func New(client *http.Client) *Model

New is a model client over client, whose requests carry their trace context (W3C traceparent), so a gateway before the provider continues the turn's trace. A nil client is http.DefaultClient's settings.

func NewOpenRouter added in v0.5.0

func NewOpenRouter(client *http.Client) *Model

NewOpenRouter returns an OpenAI Responses strategy preconfigured for OpenRouter.

OpenRouter validates prompt_cache_options.mode and rejects "implicit", so the strategy pins a key-only cache profile: prompt_cache_key is sent, while the GPT-5.6 cache options and content-block breakpoints stay off the wire.

func (*Model) CountTokens added in v0.5.0

func (s *Model) CountTokens(ctx context.Context, req tacklr.ModelRequest) (int, error)

func (*Model) Invoke added in v0.5.0

func (s *Model) Invoke(ctx context.Context, req tacklr.ModelRequest) (chan tacklr.LLMResponseChunk, error)

func (*Model) MaxContextWindow added in v0.5.0

func (s *Model) MaxContextWindow() (int, error)

func (*Model) ModelTelemetryIdentity added in v0.5.0

func (s *Model) ModelTelemetryIdentity() telemetry.ModelIdentity

ModelTelemetryIdentity names the provider and model for model spans.

func (*Model) SupportsMIME added in v0.5.0

func (s *Model) SupportsMIME(mimeType string) bool

SupportsMIME implements tacklr.Model for the selected model id.

func (*Model) WithApiKey added in v0.5.0

func (s *Model) WithApiKey(key string) *Model

func (*Model) WithModel added in v0.5.0

func (s *Model) WithModel(model string) *Model

func (*Model) WithReasoningLevel added in v0.5.0

func (s *Model) WithReasoningLevel(level string) *Model

func (*Model) WithReasoningSummary added in v0.5.0

func (s *Model) WithReasoningSummary(summary string) *Model

WithReasoningSummary sets reasoning.summary on Responses API requests ("auto", "concise", "detailed"). Empty clears it.

func (*Model) WithURL added in v0.5.0

func (s *Model) WithURL(url string) *Model

Jump to

Keyboard shortcuts

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