Documentation
¶
Index ¶
- func EnsureResponseIncludes(values []fantasyopenai.IncludeType) []fantasyopenai.IncludeType
- func IncludeFromChat(values []string) []fantasyopenai.IncludeType
- func IsGPT6Astra(modelID string) bool
- func IsGPT61Sol(modelID string) bool
- func IsReasoningModel(modelID string) bool
- func ProviderOptionsFromChatConfig(transport Transport, options *codersdk.ChatModelOpenAIProviderOptions) fantasy.ProviderOptionsData
- func ReasoningMode(config *codersdk.ChatModelCallConfig) *string
- func ResponsesLogProbsFromChatConfig(options *codersdk.ChatModelOpenAIProviderOptions) any
- func ServiceTierFromChat(value *string) *fantasyopenai.ServiceTier
- func TextVerbosityFromChat(value *string) *fantasyopenai.TextVerbosity
- func UsesResponsesAPI(modelID string, override *bool) bool
- func ValidateReasoningMode(provider string, config *codersdk.ChatModelCallConfig) error
- func WebSearchTool(options *codersdk.ChatModelOpenAIProviderOptions) (fantasy.Tool, bool)
- type Transport
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 ¶
IsGPT6Astra matches gpt-6-astra and its dated snapshots.
func IsGPT61Sol ¶
IsGPT61Sol matches gpt-6.1-sol and its dated snapshots.
func IsReasoningModel ¶
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 ¶
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.
func TransportFor ¶ added in v2.37.0
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
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.