Documentation
¶
Index ¶
- func CloseOpenAICodexWebSocketSessions(sessionID ...string)
- func GenerateImages(ctx context.Context, model *ai.ImagesModel, imagesContext ai.ImagesContext, ...) (*ai.AssistantImages, error)
- func GenerateOpenRouterImages(ctx context.Context, model *ai.ImagesModel, imagesContext ai.ImagesContext, ...) (*ai.AssistantImages, error)
- func ResetOpenAICodexWebSocketDebugStats(sessionID ...string)
- func StreamAnthropicMessages(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamAnthropicMessagesWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamAzureOpenAIResponses(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamAzureOpenAIResponsesWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamBedrockConverse(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamBedrockConverseWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamGoogleGenerativeAI(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamGoogleGenerativeAIWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamGoogleVertex(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamGoogleVertexWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamMistralConversations(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamMistralConversationsWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamOpenAICodexResponses(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamOpenAICodexResponsesWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamOpenAICompletions(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamOpenAICompletionsWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamOpenAIResponses(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamOpenAIResponsesWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamPiMessages(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
- func StreamPiMessagesWithOptions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimple(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleAnthropicMessages(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleAzureOpenAIResponses(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleBedrockConverse(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleGoogleGenerativeAI(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleGoogleVertex(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleMistralConversations(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleOpenAICodexResponses(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleOpenAICompletions(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimpleOpenAIResponses(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- func StreamSimplePiMessages(ctx context.Context, model *ai.Model, requestContext ai.Context, ...) (ai.AssistantMessageEventStream, error)
- type AnthropicEffort
- type AnthropicMessageParam
- type AnthropicMessagesOptions
- type AnthropicMessagesPayload
- type AnthropicThinkingDisplay
- type AnthropicToolChoice
- type AzureOpenAIResponsesOptions
- type BedrockCachePoint
- type BedrockContentBlock
- type BedrockConverseStreamOptions
- type BedrockConverseStreamPayload
- type BedrockImageBlock
- type BedrockImageSource
- type BedrockInferenceConfig
- type BedrockMessage
- type BedrockReasoningContent
- type BedrockReasoningText
- type BedrockSystemContentBlock
- type BedrockThinkingDisplay
- type BedrockTool
- type BedrockToolChoice
- type BedrockToolConfiguration
- type BedrockToolInputSchema
- type BedrockToolResultBlock
- type BedrockToolResultContentBlock
- type BedrockToolSpecification
- type BedrockToolUseBlock
- type GoogleContent
- type GoogleFunctionCall
- type GoogleFunctionCallingConfig
- type GoogleFunctionDeclaration
- type GoogleFunctionResponse
- type GoogleFunctionResponseInlineData
- type GoogleFunctionResponsePart
- type GoogleFunctionResponseValue
- type GoogleGenerateContentConfig
- type GoogleGenerateContentParameters
- type GoogleInlineData
- type GoogleOptions
- type GooglePart
- type GoogleSafetySetting
- type GoogleThinkingConfig
- type GoogleThinkingLevel
- type GoogleThinkingOptions
- type GoogleTool
- type GoogleToolChoice
- type GoogleToolConfig
- type GoogleVertexOptions
- type MistralChatPayload
- type MistralConversationFunction
- type MistralConversationTool
- type MistralConversationsOptions
- type MistralConversationsPayload
- type OpenAICodexResponsesOptions
- type OpenAICodexResponsesPayload
- type OpenAICodexWebSocketDebugStats
- type OpenAICompletionsOptions
- type OpenAIReasoningParams
- type OpenAIResponsesOptions
- type OpenAIResponsesPayload
- type OpenAIResponsesTool
- type PiMessagesOptions
- type PiMessagesPayload
- type PiMessagesPayloadOptions
- type PiMessagesResponseError
- type PiMessagesRewriteImpact
- type PiMessagesToolChoice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseOpenAICodexWebSocketSessions ¶
func CloseOpenAICodexWebSocketSessions(sessionID ...string)
func GenerateImages ¶
func GenerateImages( ctx context.Context, model *ai.ImagesModel, imagesContext ai.ImagesContext, options *ai.ImagesOptions, ) (*ai.AssistantImages, error)
GenerateImages dispatches an image-generation model to its API-shape adapter, the images counterpart of StreamSimple. Only the OpenRouter shape exists upstream today.
func GenerateOpenRouterImages ¶
func GenerateOpenRouterImages( ctx context.Context, model *ai.ImagesModel, imagesContext ai.ImagesContext, options *ai.ImagesOptions, ) (*ai.AssistantImages, error)
GenerateOpenRouterImages performs one non-streaming Chat Completions POST with image/text modalities. Provider failures are encoded in the returned result ("error"/"aborted" plus errorMessage), never as a Go error.
func ResetOpenAICodexWebSocketDebugStats ¶
func ResetOpenAICodexWebSocketDebugStats(sessionID ...string)
func StreamAnthropicMessages ¶
func StreamAnthropicMessagesWithOptions ¶
func StreamAnthropicMessagesWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *AnthropicMessagesOptions, ) (ai.AssistantMessageEventStream, error)
func StreamAzureOpenAIResponsesWithOptions ¶
func StreamAzureOpenAIResponsesWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *AzureOpenAIResponsesOptions, ) (ai.AssistantMessageEventStream, error)
func StreamBedrockConverse ¶
func StreamBedrockConverseWithOptions ¶
func StreamBedrockConverseWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *BedrockConverseStreamOptions, ) (ai.AssistantMessageEventStream, error)
func StreamGoogleGenerativeAIWithOptions ¶
func StreamGoogleGenerativeAIWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *GoogleOptions, ) (ai.AssistantMessageEventStream, error)
func StreamGoogleVertex ¶
func StreamGoogleVertexWithOptions ¶
func StreamGoogleVertexWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *GoogleVertexOptions, ) (ai.AssistantMessageEventStream, error)
func StreamMistralConversationsWithOptions ¶
func StreamMistralConversationsWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *MistralConversationsOptions, ) (ai.AssistantMessageEventStream, error)
func StreamOpenAICodexResponsesWithOptions ¶
func StreamOpenAICodexResponsesWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *OpenAICodexResponsesOptions, ) (ai.AssistantMessageEventStream, error)
func StreamOpenAICompletions ¶
func StreamOpenAICompletions(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
StreamOpenAICompletions adapts the provider-neutral request to OpenAI Chat Completions. Provider failures are represented by the terminal error event.
func StreamOpenAICompletionsWithOptions ¶
func StreamOpenAICompletionsWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *OpenAICompletionsOptions, ) (ai.AssistantMessageEventStream, error)
StreamOpenAICompletionsWithOptions exposes Chat Completions-specific tool choice and reasoning-effort controls.
func StreamOpenAIResponses ¶
func StreamOpenAIResponsesWithOptions ¶
func StreamOpenAIResponsesWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *OpenAIResponsesOptions, ) (ai.AssistantMessageEventStream, error)
func StreamPiMessages ¶
func StreamPiMessages(ctx context.Context, request ai.Request) (ai.AssistantMessageEventStream, error)
StreamPiMessages adapts the provider-neutral request to the pi-messages gateway shape.
func StreamPiMessagesWithOptions ¶
func StreamPiMessagesWithOptions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *PiMessagesOptions, ) (ai.AssistantMessageEventStream, error)
StreamPiMessagesWithOptions streams serialized assistant-message events from a conforming gateway.
func StreamSimple ¶
func StreamSimple( ctx context.Context, model *ai.Model, requestContext ai.Context, options *ai.SimpleStreamOptions, ) (ai.AssistantMessageEventStream, error)
StreamSimple dispatches a model to its provider wire-shape adapter. Provider work packages extend this switch as each upstream API shape lands.
func StreamSimpleOpenAICompletions ¶
func StreamSimpleOpenAICompletions( ctx context.Context, model *ai.Model, requestContext ai.Context, options *ai.SimpleStreamOptions, ) (ai.AssistantMessageEventStream, error)
StreamSimpleOpenAICompletions applies the provider-neutral context and reasoning clamps before entering the specialized Chat Completions path. ToolChoice remains on OpenAICompletionsOptions because SimpleStreamOptions has no structurally hidden fields in Go.
func StreamSimplePiMessages ¶
func StreamSimplePiMessages( ctx context.Context, model *ai.Model, requestContext ai.Context, options *ai.SimpleStreamOptions, ) (ai.AssistantMessageEventStream, error)
StreamSimplePiMessages forwards the unified reasoning option without inventing provider defaults that upstream does not send.
Types ¶
type AnthropicEffort ¶
type AnthropicEffort string
const ( AnthropicEffortLow AnthropicEffort = "low" AnthropicEffortMedium AnthropicEffort = "medium" AnthropicEffortHigh AnthropicEffort = "high" AnthropicEffortXHigh AnthropicEffort = "xhigh" AnthropicEffortMax AnthropicEffort = "max" )
type AnthropicMessageParam ¶
type AnthropicMessagesOptions ¶
type AnthropicMessagesOptions struct {
ai.StreamOptions
ThinkingEnabled *bool `json:"thinkingEnabled,omitempty"`
ThinkingBudgetTokens *float64 `json:"thinkingBudgetTokens,omitempty"`
Effort *AnthropicEffort `json:"effort,omitempty"`
ThinkingDisplay *AnthropicThinkingDisplay `json:"thinkingDisplay,omitempty"`
InterleavedThinking *bool `json:"interleavedThinking,omitempty"`
ToolChoice *AnthropicToolChoice `json:"toolChoice,omitempty"`
Client *anthropic.Client `json:"-"`
}
type AnthropicMessagesPayload ¶
type AnthropicMessagesPayload struct {
Model string `json:"model"`
Messages []AnthropicMessageParam `json:"messages"`
MaxTokens float64 `json:"max_tokens"`
Stream bool `json:"stream"`
System []anthropicTextBlock `json:"system,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
Tools []anthropicToolParam `json:"tools,omitempty"`
Thinking any `json:"thinking,omitempty"`
OutputConfig *anthropicOutputConfig `json:"output_config,omitempty"`
Metadata *anthropicMetadata `json:"metadata,omitempty"`
ToolChoice *AnthropicToolChoice `json:"tool_choice,omitempty"`
}
type AnthropicThinkingDisplay ¶
type AnthropicThinkingDisplay string
const ( AnthropicThinkingSummarized AnthropicThinkingDisplay = "summarized" AnthropicThinkingOmitted AnthropicThinkingDisplay = "omitted" )
type AnthropicToolChoice ¶
func (*AnthropicToolChoice) UnmarshalJSON ¶
func (choice *AnthropicToolChoice) UnmarshalJSON(data []byte) error
type AzureOpenAIResponsesOptions ¶
type AzureOpenAIResponsesOptions struct {
ai.StreamOptions
ReasoningEffort *string `json:"reasoningEffort,omitempty"`
ReasoningSummary *string `json:"reasoningSummary,omitempty"`
AzureAPIVersion *string `json:"azureApiVersion,omitempty"`
AzureResourceName *string `json:"azureResourceName,omitempty"`
AzureBaseURL *string `json:"azureBaseUrl,omitempty"`
AzureDeploymentName *string `json:"azureDeploymentName,omitempty"`
}
type BedrockCachePoint ¶
type BedrockContentBlock ¶
type BedrockContentBlock struct {
Text *string `json:"text,omitempty"`
Image *BedrockImageBlock `json:"image,omitempty"`
ToolUse *BedrockToolUseBlock `json:"toolUse,omitempty"`
ToolResult *BedrockToolResultBlock `json:"toolResult,omitempty"`
ReasoningContent *BedrockReasoningContent `json:"reasoningContent,omitempty"`
CachePoint *BedrockCachePoint `json:"cachePoint,omitempty"`
}
type BedrockConverseStreamOptions ¶
type BedrockConverseStreamOptions struct {
ai.StreamOptions
Region string `json:"region,omitempty"`
Profile string `json:"profile,omitempty"`
ToolChoice *BedrockToolChoice `json:"toolChoice,omitempty"`
Reasoning *ai.ThinkingLevel `json:"reasoning,omitempty"`
ThinkingBudgets *ai.ThinkingBudgets `json:"thinkingBudgets,omitempty"`
InterleavedThinking *bool `json:"interleavedThinking,omitempty"`
ThinkingDisplay *BedrockThinkingDisplay `json:"thinkingDisplay,omitempty"`
RequestMetadata map[string]string `json:"requestMetadata,omitempty"`
BearerToken string `json:"bearerToken,omitempty"`
}
type BedrockConverseStreamPayload ¶
type BedrockConverseStreamPayload struct {
ModelID string `json:"modelId"`
Messages []BedrockMessage `json:"messages"`
System []BedrockSystemContentBlock `json:"system,omitempty"`
InferenceConfig BedrockInferenceConfig `json:"inferenceConfig"`
ToolConfig *BedrockToolConfiguration `json:"toolConfig,omitempty"`
AdditionalModelRequestFields map[string]any `json:"additionalModelRequestFields,omitempty"`
RequestMetadata map[string]string `json:"requestMetadata,omitempty"`
// Extra retains hook-injected top-level members without a typed field
// (guardrailConfig, performanceConfig, ...) so they reach the SDK input,
// mirroring upstream's verbatim ConverseStreamCommand pass-through. (OT-M7)
Extra map[string]json.RawMessage `json:"-"`
// contains filtered or unexported fields
}
BedrockConverseStreamPayload mirrors the public ConverseStream command input. The AWS SDK remains confined to this adapter while payload hooks retain a provider-shaped value that callers can inspect and replace.
type BedrockImageBlock ¶
type BedrockImageBlock struct {
Format string `json:"format"`
Source BedrockImageSource `json:"source"`
}
type BedrockImageSource ¶
type BedrockImageSource struct {
Bytes string `json:"bytes"`
}
type BedrockInferenceConfig ¶
type BedrockMessage ¶
type BedrockMessage struct {
Role string `json:"role"`
Content []BedrockContentBlock `json:"content"`
}
type BedrockReasoningContent ¶
type BedrockReasoningContent struct {
ReasoningText BedrockReasoningText `json:"reasoningText"`
}
type BedrockReasoningText ¶
type BedrockSystemContentBlock ¶
type BedrockSystemContentBlock struct {
Text *string `json:"text,omitempty"`
CachePoint *BedrockCachePoint `json:"cachePoint,omitempty"`
}
type BedrockThinkingDisplay ¶
type BedrockThinkingDisplay string
const ( BedrockThinkingSummarized BedrockThinkingDisplay = "summarized" BedrockThinkingOmitted BedrockThinkingDisplay = "omitted" )
type BedrockTool ¶
type BedrockTool struct {
ToolSpec BedrockToolSpecification `json:"toolSpec"`
}
type BedrockToolChoice ¶
func (*BedrockToolChoice) UnmarshalJSON ¶
func (choice *BedrockToolChoice) UnmarshalJSON(data []byte) error
type BedrockToolConfiguration ¶
type BedrockToolConfiguration struct {
Tools []BedrockTool `json:"tools"`
ToolChoice any `json:"toolChoice,omitempty"`
}
type BedrockToolInputSchema ¶
type BedrockToolInputSchema struct {
JSON jsonschema.Schema `json:"json"`
}
type BedrockToolResultBlock ¶
type BedrockToolResultBlock struct {
ToolUseID string `json:"toolUseId"`
Content []BedrockToolResultContentBlock `json:"content"`
Status string `json:"status"`
}
type BedrockToolResultContentBlock ¶
type BedrockToolResultContentBlock struct {
Text *string `json:"text,omitempty"`
Image *BedrockImageBlock `json:"image,omitempty"`
}
type BedrockToolSpecification ¶
type BedrockToolSpecification struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema BedrockToolInputSchema `json:"inputSchema"`
}
type BedrockToolUseBlock ¶
type GoogleContent ¶
type GoogleContent struct {
Parts []GooglePart `json:"parts"`
Role string `json:"role"`
}
type GoogleFunctionCall ¶
type GoogleFunctionCall struct {
Name string `json:"name"`
Args json.RawMessage `json:"args"`
ID string `json:"id,omitempty"`
}
type GoogleFunctionCallingConfig ¶
type GoogleFunctionCallingConfig struct {
AllowedFunctionNames []string `json:"allowedFunctionNames,omitempty"`
Mode string `json:"mode,omitempty"`
StreamArguments json.RawMessage `json:"streamFunctionCallArguments,omitempty"`
}
type GoogleFunctionDeclaration ¶
type GoogleFunctionDeclaration struct {
Name string `json:"name"`
Description string `json:"description"`
ParametersJSONSchema jsonschema.Schema `json:"parametersJsonSchema"`
}
type GoogleFunctionResponse ¶
type GoogleFunctionResponse struct {
Name string `json:"name"`
Response GoogleFunctionResponseValue `json:"response"`
Parts []GoogleFunctionResponsePart `json:"parts,omitempty"`
ID string `json:"id,omitempty"`
}
type GoogleFunctionResponsePart ¶
type GoogleFunctionResponsePart struct {
InlineData *GoogleFunctionResponseInlineData `json:"inlineData,omitempty"`
}
type GoogleGenerateContentConfig ¶
type GoogleGenerateContentConfig struct {
Temperature *float64 `json:"temperature,omitempty"`
TopP *float64 `json:"topP,omitempty"`
TopK *float64 `json:"topK,omitempty"`
CandidateCount *int64 `json:"candidateCount,omitempty"`
MaxOutputTokens *float64 `json:"maxOutputTokens,omitempty"`
StopSequences []string `json:"stopSequences,omitempty"`
ResponseLogprobs *bool `json:"responseLogprobs,omitempty"`
Logprobs *int64 `json:"logprobs,omitempty"`
PresencePenalty *float64 `json:"presencePenalty,omitempty"`
FrequencyPenalty *float64 `json:"frequencyPenalty,omitempty"`
Seed *int64 `json:"seed,omitempty"`
ResponseMimeType *string `json:"responseMimeType,omitempty"`
ResponseSchema json.RawMessage `json:"responseSchema,omitempty"`
ResponseJSONSchema json.RawMessage `json:"responseJsonSchema,omitempty"`
SafetySettings []GoogleSafetySetting `json:"safetySettings,omitempty"`
SystemInstruction json.RawMessage `json:"systemInstruction,omitempty"`
Tools []GoogleTool `json:"tools,omitempty"`
ToolConfig *GoogleToolConfig `json:"toolConfig,omitempty"`
CachedContent *string `json:"cachedContent,omitempty"`
ResponseModalities []string `json:"responseModalities,omitempty"`
MediaResolution *string `json:"mediaResolution,omitempty"`
SpeechConfig json.RawMessage `json:"speechConfig,omitempty"`
ThinkingConfig *GoogleThinkingConfig `json:"thinkingConfig,omitempty"`
ImageConfig json.RawMessage `json:"imageConfig,omitempty"`
EnableEnhancedCivicAnswers *bool `json:"enableEnhancedCivicAnswers,omitempty"`
ServiceTier *string `json:"serviceTier,omitempty"`
}
type GoogleGenerateContentParameters ¶
type GoogleGenerateContentParameters struct {
Model string `json:"model"`
Contents []GoogleContent `json:"contents"`
Config GoogleGenerateContentConfig `json:"config"`
}
type GoogleInlineData ¶
type GoogleOptions ¶
type GoogleOptions struct {
ai.StreamOptions
ToolChoice GoogleToolChoice `json:"toolChoice,omitempty"`
Thinking *GoogleThinkingOptions `json:"thinking,omitempty"`
}
type GooglePart ¶
type GooglePart struct {
Text *string `json:"text,omitempty"`
InlineData *GoogleInlineData `json:"inlineData,omitempty"`
FunctionCall *GoogleFunctionCall `json:"functionCall,omitempty"`
FunctionResponse *GoogleFunctionResponse `json:"functionResponse,omitempty"`
Thought bool `json:"thought,omitempty"`
ThoughtSignature *string `json:"thoughtSignature,omitempty"`
}
type GoogleSafetySetting ¶
type GoogleThinkingConfig ¶
type GoogleThinkingConfig struct {
IncludeThoughts *bool `json:"includeThoughts,omitempty"`
ThinkingBudget *int64 `json:"thinkingBudget,omitempty"`
ThinkingLevel *GoogleThinkingLevel `json:"thinkingLevel,omitempty"`
}
type GoogleThinkingLevel ¶
type GoogleThinkingLevel string
const ( GoogleThinkingUnspecified GoogleThinkingLevel = "THINKING_LEVEL_UNSPECIFIED" GoogleThinkingMinimal GoogleThinkingLevel = "MINIMAL" GoogleThinkingLow GoogleThinkingLevel = "LOW" GoogleThinkingMedium GoogleThinkingLevel = "MEDIUM" GoogleThinkingHigh GoogleThinkingLevel = "HIGH" )
type GoogleThinkingOptions ¶
type GoogleThinkingOptions struct {
Enabled bool `json:"enabled"`
BudgetTokens *int64 `json:"budgetTokens,omitempty"`
Level *GoogleThinkingLevel `json:"level,omitempty"`
}
type GoogleTool ¶
type GoogleTool struct {
ComputerUse json.RawMessage `json:"computerUse,omitempty"`
FileSearch json.RawMessage `json:"fileSearch,omitempty"`
GoogleSearch json.RawMessage `json:"googleSearch,omitempty"`
GoogleMaps json.RawMessage `json:"googleMaps,omitempty"`
CodeExecution json.RawMessage `json:"codeExecution,omitempty"`
FunctionDeclarations []GoogleFunctionDeclaration `json:"functionDeclarations,omitempty"`
GoogleSearchRetrieval json.RawMessage `json:"googleSearchRetrieval,omitempty"`
URLContext json.RawMessage `json:"urlContext,omitempty"`
MCPServers json.RawMessage `json:"mcpServers,omitempty"`
}
type GoogleToolChoice ¶
type GoogleToolChoice string
const ( GoogleToolChoiceAuto GoogleToolChoice = "auto" GoogleToolChoiceNone GoogleToolChoice = "none" GoogleToolChoiceAny GoogleToolChoice = "any" )
type GoogleToolConfig ¶
type GoogleToolConfig struct {
RetrievalConfig json.RawMessage `json:"retrievalConfig,omitempty"`
FunctionCallingConfig *GoogleFunctionCallingConfig `json:"functionCallingConfig,omitempty"`
IncludeServerSideToolInvocations *bool `json:"includeServerSideToolInvocations,omitempty"`
}
type GoogleVertexOptions ¶
type GoogleVertexOptions struct {
ai.StreamOptions
ToolChoice GoogleToolChoice `json:"toolChoice,omitempty"`
Thinking *GoogleThinkingOptions `json:"thinking,omitempty"`
Project string `json:"project,omitempty"`
Location string `json:"location,omitempty"`
}
type MistralChatPayload ¶
type MistralChatPayload = MistralConversationsPayload
type MistralConversationFunction ¶
type MistralConversationFunction struct {
Name string `json:"name"`
Description string `json:"description"`
Strict bool `json:"strict"`
Parameters jsonschema.Schema `json:"parameters"`
}
type MistralConversationTool ¶
type MistralConversationTool struct {
Type string `json:"type"`
Function MistralConversationFunction `json:"function"`
}
type MistralConversationsOptions ¶
type MistralConversationsOptions struct {
ai.StreamOptions
ToolChoice any `json:"toolChoice,omitempty"`
PromptMode *string `json:"promptMode,omitempty"`
ReasoningEffort *string `json:"reasoningEffort,omitempty"`
}
type MistralConversationsPayload ¶
type MistralConversationsPayload struct {
Model string `json:"model"`
Temperature *float64 `json:"temperature,omitempty"`
MaxTokens *float64 `json:"max_tokens,omitempty"`
Stream bool `json:"stream"`
Messages []any `json:"messages"`
Tools []MistralConversationTool `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
ReasoningEffort *string `json:"reasoning_effort,omitempty"`
PromptMode *string `json:"prompt_mode,omitempty"`
PromptCacheKey *string `json:"prompt_cache_key,omitempty"`
}
MistralConversationsPayload is the mutable request value passed to PayloadHook.
type OpenAICodexResponsesOptions ¶
type OpenAICodexResponsesOptions struct {
ai.StreamOptions
ReasoningEffort *string `json:"reasoningEffort,omitempty"`
ReasoningSummary *string `json:"reasoningSummary,omitempty"`
ServiceTier *string `json:"serviceTier,omitempty"`
TextVerbosity *string `json:"textVerbosity,omitempty"`
ToolChoice *string `json:"toolChoice,omitempty"`
}
type OpenAICodexResponsesPayload ¶
type OpenAICodexResponsesPayload struct {
Model string `json:"model"`
Store bool `json:"store"`
Stream bool `json:"stream"`
Instructions string `json:"instructions"`
Input []any `json:"input"`
Text openAICodexText `json:"text"`
Include []string `json:"include"`
PromptCacheKey *string `json:"prompt_cache_key,omitempty"`
ToolChoice string `json:"tool_choice"`
ParallelToolCalls bool `json:"parallel_tool_calls"`
Temperature *float64 `json:"temperature,omitempty"`
ServiceTier *string `json:"service_tier,omitempty"`
Tools []openAICodexResponsesTool `json:"tools,omitempty"`
Reasoning *OpenAIReasoningParams `json:"reasoning,omitempty"`
}
type OpenAICodexWebSocketDebugStats ¶
type OpenAICodexWebSocketDebugStats struct {
Requests int
ConnectionsCreated int
ConnectionsReused int
CachedContextRequests int
StoreTrueRequests int
FullContextRequests int
DeltaRequests int
LastInputItems int
LastDeltaInputItems *int
LastPreviousResponseID *string
WebSocketFailures int
SSEFallbacks int
WebSocketFallbackActive bool
LastWebSocketError *string
}
func GetOpenAICodexWebSocketDebugStats ¶
func GetOpenAICodexWebSocketDebugStats(sessionID string) *OpenAICodexWebSocketDebugStats
type OpenAICompletionsOptions ¶
type OpenAICompletionsOptions struct {
ai.StreamOptions
ToolChoice any
ReasoningEffort *ai.ThinkingLevel
}
OpenAICompletionsOptions contains the Chat Completions-only request options.
type OpenAIReasoningParams ¶
type OpenAIResponsesOptions ¶
type OpenAIResponsesPayload ¶
type OpenAIResponsesPayload struct {
Model string `json:"model"`
Input []any `json:"input"`
Stream bool `json:"stream"`
PromptCacheKey *string `json:"prompt_cache_key,omitempty"`
PromptCacheRetention *string `json:"prompt_cache_retention,omitempty"`
Store bool `json:"store"`
MaxOutputTokens *float64 `json:"max_output_tokens,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
ServiceTier *string `json:"service_tier,omitempty"`
Tools []OpenAIResponsesTool `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
Reasoning *OpenAIReasoningParams `json:"reasoning,omitempty"`
Include []string `json:"include,omitempty"`
}
OpenAIResponsesPayload is the mutable request value passed to PayloadHook.
type OpenAIResponsesTool ¶
type PiMessagesOptions ¶
type PiMessagesOptions struct {
ai.StreamOptions
Reasoning *ai.ThinkingLevel `json:"reasoning,omitempty"`
ToolChoice PiMessagesToolChoice `json:"toolChoice,omitempty"`
Debug bool `json:"debug,omitempty"`
}
PiMessagesOptions contains the gateway-specific options sent through the pi-messages wire shape.
func (*PiMessagesOptions) UnmarshalJSON ¶
func (options *PiMessagesOptions) UnmarshalJSON(data []byte) error
type PiMessagesPayload ¶
type PiMessagesPayload struct {
Model string `json:"model"`
Context ai.Context `json:"context"`
Options PiMessagesPayloadOptions `json:"options"`
}
PiMessagesPayload is the request body accepted by a pi-messages backend.
type PiMessagesPayloadOptions ¶
type PiMessagesPayloadOptions struct {
Temperature *float64 `json:"temperature,omitempty"`
MaxTokens *float64 `json:"maxTokens,omitempty"`
Reasoning *ai.ThinkingLevel `json:"reasoning,omitempty"`
CacheRetention *ai.CacheRetention `json:"cacheRetention,omitempty"`
SessionID *string `json:"sessionId,omitempty"`
ToolChoice PiMessagesToolChoice `json:"toolChoice,omitempty"`
}
PiMessagesPayloadOptions is ordered to match upstream JSON serialization.
type PiMessagesResponseError ¶
type PiMessagesResponseError struct {
Message string
Code *string
DiagnosticDetails json.RawMessage
}
PiMessagesResponseError retains the structured diagnostics returned for a non-successful gateway response.
func (*PiMessagesResponseError) Error ¶
func (err *PiMessagesResponseError) Error() string
type PiMessagesRewriteImpact ¶
type PiMessagesRewriteImpact struct {
PolicyID string `json:"policyId"`
PolicyVersion int64 `json:"policyVersion"`
Changed bool `json:"changed"`
TokenCountChange int64 `json:"tokenCountChange"`
MessageCountChange int64 `json:"messageCountChange"`
SystemPromptChanged bool `json:"systemPromptChanged"`
}
PiMessagesRewriteImpact records a server-side context rewrite reported by the gateway.
type PiMessagesToolChoice ¶
type PiMessagesToolChoice any
PiMessagesToolChoice is either auto/none/required or the upstream function selector object.
Source Files
¶
- anthropicmessages.go
- azureopenairesponses.go
- bedrockconversestream.go
- cloudflare.go
- codex_useragent.go
- codex_useragent_linux.go
- codex_websocket_codec.go
- doc.go
- google_mldev.go
- google_schema.go
- google_shared.go
- google_vertex_adc.go
- google_vertex_adc_external_account.go
- google_vertex_adc_external_account_aws.go
- google_vertex_adc_external_account_executable.go
- google_vertex_adc_external_account_identity.go
- google_vertex_adc_external_user.go
- google_vertex_adc_impersonated.go
- google_vertex_wire.go
- googlegenerativeai.go
- googlevertex.go
- mistralconversations.go
- openai_common.go
- openai_messages.go
- openaicodexresponses.go
- openaicodexresponses_websocket.go
- openaicompletions.go
- openairesponses.go
- openrouterimages.go
- pimessages.go
- simple_options.go
- stream_simple.go