Documentation ¶
Index ¶
- type ChatCompletionRequest
- type ChatCompletionResponse
- type Choice
- type CompletionTokensDetails
- type Content
- type Function
- type FunctionCall
- type FunctionTool
- type ImageContent
- type JsonSchema
- type LegacyFunction
- type LegacyFunctionChoice
- type Logprob
- type Logprobs
- type Message
- type MessageContent
- type Part
- type ResponseFormat
- type StopSequences
- type StreamOptions
- type TextContent
- type Tool
- type ToolCall
- type ToolChoice
- type ToolChoiceStruct
- type ToolChoiceValue
- type TopLogprob
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatCompletionRequest ¶
type ChatCompletionRequest struct { Messages []Message `json:"messages"` Model string `json:"model"` FrequencyPenalty *float32 `json:"frequency_penalty,omitempty"` LogitBias map[string]float32 `json:"logit_bias,omitempty"` Logprobs *bool `json:"logprobs,omitempty"` TopLogprobs *int32 `json:"top_logprobs,omitempty"` MaxTokens *int32 `json:"max_tokens,omitempty"` MaxCompletionTokens *int32 `json:"max_completion_tokens,omitempty"` CandidateCount *int32 `json:"n,omitempty"` PresencePenalty *float32 `json:"presence_penalty,omitempty"` ResponseFormat *ResponseFormat `json:"response_format,omitempty"` Seed *int32 `json:"seed,omitempty"` ServiceTier *string `json:"service_tier,omitempty"` StopSequences *StopSequences `json:"stop,omitempty"` Stream *bool `json:"stream,omitempty"` StreamOptions *StreamOptions `json:"stream_options,omitempty"` Temperature *float32 `json:"temperature,omitempty"` TopP *float32 `json:"top_p,omitempty"` Tools []Tool `json:"tools,omitempty"` ToolChoice *ToolChoice `json:"tool_choice,omitempty"` ParallelToolCalls *bool `json:"parallel_tool_calls,omitempty"` User *string `json:"user,omitempty"` FunctionCall *LegacyFunctionChoice `json:"function_call,omitempty"` Functions []LegacyFunction `json:"functions,omitempty"` }
type ChatCompletionResponse ¶
type ChatCompletionResponse struct { Id string `json:"id"` Choices []Choice `json:"choices"` Created int64 `json:"created"` Model string `json:"model"` ServiceTier *string `json:"service_tier,omitempty"` SystemFingerprint string `json:"system_fingerprint"` Object string `json:"object"` Usage Usage `json:"usage"` }
func FinalizeResponse ¶
func FinalizeResponse(provider string, region string, model string, response *ChatCompletionResponse) *ChatCompletionResponse
type CompletionTokensDetails ¶
type CompletionTokensDetails struct {
ReasoningTokens int32 `json:"reasoning_tokens"`
}
type Content ¶
type Content struct { TextContent *TextContent ImageContent *ImageContent }
func (*Content) MarshalJSON ¶
func (*Content) UnmarshalJSON ¶
type FunctionCall ¶
type FunctionTool ¶
type FunctionTool struct { Name string `json:"name"` Description *string `json:"description,omitempty"` Parameters *orderedmap.Map `json:"parameters,omitempty"` Strict *bool `json:"strict,omitempty"` }
type ImageContent ¶
type JsonSchema ¶
type JsonSchema struct { Description *string `json:"description,omitempty"` Name string `json:"name"` Schema *orderedmap.Map `json:"schema,omitempty"` Strict *bool `json:"strict,omitempty"` }
type LegacyFunction ¶
type LegacyFunction struct { Name string `json:"name"` Description *string `json:"description,omitempty"` Parameters *orderedmap.Map `json:"parameters,omitempty"` }
type LegacyFunctionChoice ¶
func (*LegacyFunctionChoice) MarshalJSON ¶
func (fc *LegacyFunctionChoice) MarshalJSON() ([]byte, error)
func (*LegacyFunctionChoice) UnmarshalJSON ¶
func (fc *LegacyFunctionChoice) UnmarshalJSON(data []byte) error
type Logprob ¶
type Logprob struct { Token string `json:"token"` Logprob float32 `json:"logprob"` Bytes []byte `json:"bytes,omitempty"` TopLogprobs []TopLogprob `json:"top_logprobs,omitempty"` }
type Message ¶
type Message struct { Role string `json:"role"` // When the role is "tool" or "function", the content must be a JSON string. Content *MessageContent `json:"content"` Name *string `json:"name,omitempty"` Refusal *string `json:"refusal,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallId *string `json:"tool_call_id,omitempty"` FunctionCall *FunctionCall `json:"function_call,omitempty"` }
type MessageContent ¶
func (*MessageContent) MarshalJSON ¶
func (sop *MessageContent) MarshalJSON() ([]byte, error)
func (*MessageContent) UnmarshalJSON ¶
func (sop *MessageContent) UnmarshalJSON(data []byte) error
type ResponseFormat ¶
type ResponseFormat struct { Type string `json:"type"` JsonSchema *JsonSchema `json:"json_schema,omitempty"` }
type StopSequences ¶
type StopSequences struct {
Sequences []string `json:"tokens"`
}
func (*StopSequences) MarshalJSON ¶
func (ss *StopSequences) MarshalJSON() ([]byte, error)
func (*StopSequences) UnmarshalJSON ¶
func (ss *StopSequences) UnmarshalJSON(data []byte) error
type StreamOptions ¶
type StreamOptions struct {
IncludeUsage *bool `json:"include_usage,omitempty"`
}
type TextContent ¶
type TextContent struct {
Text string `json:"text"`
}
type Tool ¶
type Tool struct { Type string `json:"type"` Function FunctionTool `json:"function"` }
type ToolCall ¶
type ToolCall struct { Id string `json:"id"` Type string `json:"type"` Function *FunctionCall `json:"function,omitempty"` }
type ToolChoice ¶
type ToolChoice struct { Value *ToolChoiceValue Struct *ToolChoiceStruct }
func (*ToolChoice) MarshalJSON ¶
func (tc *ToolChoice) MarshalJSON() ([]byte, error)
func (*ToolChoice) UnmarshalJSON ¶
func (tc *ToolChoice) UnmarshalJSON(data []byte) error
type ToolChoiceStruct ¶
type ToolChoiceValue ¶
type ToolChoiceValue string
const ( ToolChoiceUnspecified ToolChoiceValue = "" ToolChoiceNone ToolChoiceValue = "none" ToolChoiceAuto ToolChoiceValue = "auto" ToolChoiceRequired ToolChoiceValue = "required" )
type TopLogprob ¶
Click to show internal directories.
Click to hide internal directories.