chatopenai

package
v2.37.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureResponseIncludes

func EnsureResponseIncludes(
	values []fantasyopenai.IncludeType,
) []fantasyopenai.IncludeType

EnsureResponseIncludes adds the OpenAI encrypted reasoning include required for Responses API reasoning continuity when it is not already present.

func IncludeFromChat

func IncludeFromChat(values []string) []fantasyopenai.IncludeType

IncludeFromChat converts chat-config include values to OpenAI Responses include values and ignores unsupported entries.

func IsReasoningModel

func IsReasoningModel(modelID string) bool

IsReasoningModel reports whether a model ID follows OpenAI reasoning model naming conventions.

func ProviderOptionsFromChatConfig

func ProviderOptionsFromChatConfig(
	transport Transport,
	options *codersdk.ChatModelOpenAIProviderOptions,
) fantasy.ProviderOptionsData

ProviderOptionsFromChatConfig converts chat model OpenAI options to fantasy provider options used for inference calls.

func ResponsesLogProbsFromChatConfig

func ResponsesLogProbsFromChatConfig(
	options *codersdk.ChatModelOpenAIProviderOptions,
) any

ResponsesLogProbsFromChatConfig maps chat-config log probability options to the value expected by OpenAI Responses provider options.

func ServiceTierFromChat

func ServiceTierFromChat(value *string) *fantasyopenai.ServiceTier

ServiceTierFromChat normalizes chat-config service tier values for the OpenAI Responses API. It maps every tier the codersdk enum advertises, not only the ones fantasy declares constants for, because fantasy forwards the value to the API unchanged.

func TextVerbosityFromChat

func TextVerbosityFromChat(value *string) *fantasyopenai.TextVerbosity

TextVerbosityFromChat normalizes chat-config text verbosity values for OpenAI and returns the canonical provider verbosity value.

func WebSearchTool

func WebSearchTool(options *codersdk.ChatModelOpenAIProviderOptions) (fantasy.Tool, bool)

WebSearchTool returns the OpenAI provider-native web search tool when enabled by the model provider options.

Types

type Transport added in v2.37.0

type Transport int

Transport identifies the OpenAI wire format a model's client speaks. It is resolved once when the client is built so that request preparation cannot disagree with the client it prepares for.

const (
	// TransportInvalid is the zero value, meaning no transport was ever
	// resolved.
	TransportInvalid Transport = iota
	// TransportNotApplicable marks providers outside the OpenAI wire formats.
	TransportNotApplicable
	TransportChatCompletions
	TransportResponses
)

func TransportFor added in v2.37.0

func TransportFor(provider, modelID string, override *bool) Transport

TransportFor resolves the wire format for a provider and model. override, when non-nil, forces the choice instead of consulting the provider SDK's known-model list. Azure follows the known-model list because its provider exposes no equivalent hook.

func (Transport) UsesResponses added in v2.37.0

func (t Transport) UsesResponses() bool

UsesResponses reports whether t selects the Responses API. It panics on TransportInvalid instead of defaulting, because an unresolved transport is a construction bug rather than user input.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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