chatopenai

package
v2.39.5 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 IsGPT6Astra

func IsGPT6Astra(modelID string) bool

IsGPT6Astra matches gpt-6-astra and its dated snapshots.

func IsGPT61Sol

func IsGPT61Sol(modelID string) bool

IsGPT61Sol matches gpt-6.1-sol and its dated snapshots.

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 ReasoningMode

func ReasoningMode(config *codersdk.ChatModelCallConfig) *string

ReasoningMode returns the explicit OpenAI reasoning mode in config, or nil.

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 UsesResponsesAPI

func UsesResponsesAPI(modelID string, override *bool) bool

UsesResponsesAPI decides the wire format for an OpenAI model. override, when non-nil, wins. Otherwise the provider SDK's known-model list decides.

func ValidateReasoningMode

func ValidateReasoningMode(provider string, config *codersdk.ChatModelCallConfig) error

ValidateReasoningMode checks an explicit mode against the provider and the OpenAI overrides it cannot coexist with. Model support is not checked here: OpenAI rejects the request when the model lacks the mode, and a model released after this code still works.

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. For OpenAI, a non-nil override takes precedence over the provider SDK's known-model list.

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