Documentation
¶
Index ¶
- type AnthropicRequest
- type AnthropicResponse
- func (a *AnthropicResponse) GetCacheReadPromptTokens() int
- func (a *AnthropicResponse) GetCacheWritePromptTokens() int
- func (a *AnthropicResponse) GetChoiceCount() int
- func (a *AnthropicResponse) GetModel() string
- func (a *AnthropicResponse) GetPromptTokens() int
- func (a *AnthropicResponse) GetResponseTokens() int
- func (a *AnthropicResponse) GetToolCount() int
- func (m *AnthropicResponse) UnmarshalJSON(data []byte) error
- type AnthropicStreamingChunkCBStart
- type AnthropicStreamingChunkDelta
- type AnthropicStreamingChunkStart
- type AnthropicStreamingChunkType
- type BedrockConverseResponse
- func (r *BedrockConverseResponse) GetCacheReadPromptTokens() int
- func (r *BedrockConverseResponse) GetCacheWritePromptTokens() int
- func (r *BedrockConverseResponse) GetChoiceCount() int
- func (r *BedrockConverseResponse) GetModel() string
- func (r *BedrockConverseResponse) GetPromptTokens() int
- func (r *BedrockConverseResponse) GetResponseTokens() int
- func (r *BedrockConverseResponse) GetToolCount() int
- type BedrockConverseStreamContentBlockDelta
- type BedrockConverseStreamMetadataEvent
- type ChatCompletionChoice
- type ChatMessage
- type ChatUsage
- type Content
- type DummyResponse
- func (o *DummyResponse) GetCacheReadPromptTokens() int
- func (o *DummyResponse) GetCacheWritePromptTokens() int
- func (o *DummyResponse) GetChoiceCount() int
- func (o *DummyResponse) GetModel() string
- func (o *DummyResponse) GetPromptTokens() int
- func (o *DummyResponse) GetResponseTokens() int
- func (o *DummyResponse) GetToolCount() int
- type EnumString
- type FinishReason
- type FunctionDefinition
- type GenericResponse
- func (o *GenericResponse) GetCacheReadPromptTokens() int
- func (o *GenericResponse) GetCacheWritePromptTokens() int
- func (o *GenericResponse) GetChoiceCount() int
- func (o *GenericResponse) GetModel() string
- func (o *GenericResponse) GetPromptTokens() int
- func (o *GenericResponse) GetResponseTokens() int
- func (o *GenericResponse) GetToolCount() int
- type GoogleAIChatResponse
- func (o *GoogleAIChatResponse) GetCacheReadPromptTokens() int
- func (o *GoogleAIChatResponse) GetCacheWritePromptTokens() int
- func (o *GoogleAIChatResponse) GetChoiceCount() int
- func (o *GoogleAIChatResponse) GetModel() string
- func (o *GoogleAIChatResponse) GetPromptTokens() int
- func (o *GoogleAIChatResponse) GetResponseTokens() int
- func (o *GoogleAIChatResponse) GetToolCount() int
- func (o *GoogleAIChatResponse) SetModel(name string)
- type GoogleAIStreamChunk
- type OAIUsage
- type OllamaGenerateResponse
- func (o *OllamaGenerateResponse) GetCacheReadPromptTokens() int
- func (o *OllamaGenerateResponse) GetCacheWritePromptTokens() int
- func (o *OllamaGenerateResponse) GetChoiceCount() int
- func (o *OllamaGenerateResponse) GetModel() string
- func (o *OllamaGenerateResponse) GetPromptTokens() int
- func (o *OllamaGenerateResponse) GetResponseTokens() int
- func (o *OllamaGenerateResponse) GetToolCount() int
- type OpenAIRequest
- type OpenAIResponse
- func (o *OpenAIResponse) GetCacheReadPromptTokens() int
- func (o *OpenAIResponse) GetCacheWritePromptTokens() int
- func (o *OpenAIResponse) GetChoiceCount() int
- func (o *OpenAIResponse) GetModel() string
- func (o *OpenAIResponse) GetPromptTokens() int
- func (o *OpenAIResponse) GetResponseTokens() int
- func (o *OpenAIResponse) GetToolCount() int
- type OpenAIStreamingResponse
- func (o *OpenAIStreamingResponse) GetCacheReadPromptTokens() int
- func (o *OpenAIStreamingResponse) GetCacheWritePromptTokens() int
- func (o *OpenAIStreamingResponse) GetChoiceCount() int
- func (o *OpenAIStreamingResponse) GetModel() string
- func (o *OpenAIStreamingResponse) GetPromptTokens() int
- func (o *OpenAIStreamingResponse) GetResponseTokens() int
- func (o *OpenAIStreamingResponse) GetToolCount() int
- type PromptTokensDetails
- type ProxyDummyResponse
- func (o *ProxyDummyResponse) GetCacheReadPromptTokens() int
- func (o *ProxyDummyResponse) GetCacheWritePromptTokens() int
- func (o *ProxyDummyResponse) GetChoiceCount() int
- func (o *ProxyDummyResponse) GetModel() string
- func (o *ProxyDummyResponse) GetPromptTokens() int
- func (o *ProxyDummyResponse) GetResponseTokens() int
- func (o *ProxyDummyResponse) GetToolCount() int
- type ResponseFormat
- type ResponseFormatJSONSchema
- type ResponseFormatJSONSchemaProperty
- type TextContent
- type Tool
- type ToolCall
- type ToolChoice
- type ToolFunction
- type ToolResultContent
- type ToolType
- type ToolUseContent
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnthropicRequest ¶
type AnthropicRequest struct {
Model string `json:"model"`
Messages []any `json:"messages"`
MaxTokens int `json:"max_tokens"`
System string `json:"-"`
MultiSystem []any `json:"-"`
Metadata map[string]any `json:"metadata,omitempty"`
StopSequences []string `json:"stop_sequences,omitempty"`
Stream bool `json:"stream,omitempty"`
Temperature *float32 `json:"temperature,omitempty"`
TopP *float32 `json:"top_p,omitempty"`
TopK *int `json:"top_k,omitempty"`
Tools []any `json:"tools,omitempty"`
ToolChoice *ToolChoice `json:"tool_choice,omitempty"`
}
type AnthropicResponse ¶
type AnthropicResponse struct {
Content []Content `json:"content"`
ID string `json:"id"`
Model string `json:"model"`
Role string `json:"role"`
StopReason string `json:"stop_reason"`
StopSequence string `json:"stop_sequence"`
Type string `json:"type"`
Usage struct {
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheCreationInputTokens int `json:"cache_creation_input_tokens"`
CacheReadInputTokens int `json:"cache_read_input_tokens"`
} `json:"usage"`
}
This is from langchaingo's implementation
func (*AnthropicResponse) GetCacheReadPromptTokens ¶
func (a *AnthropicResponse) GetCacheReadPromptTokens() int
func (*AnthropicResponse) GetCacheWritePromptTokens ¶
func (a *AnthropicResponse) GetCacheWritePromptTokens() int
func (*AnthropicResponse) GetChoiceCount ¶
func (a *AnthropicResponse) GetChoiceCount() int
func (*AnthropicResponse) GetModel ¶
func (a *AnthropicResponse) GetModel() string
func (*AnthropicResponse) GetPromptTokens ¶
func (a *AnthropicResponse) GetPromptTokens() int
func (*AnthropicResponse) GetResponseTokens ¶
func (a *AnthropicResponse) GetResponseTokens() int
func (*AnthropicResponse) GetToolCount ¶
func (a *AnthropicResponse) GetToolCount() int
func (*AnthropicResponse) UnmarshalJSON ¶
func (m *AnthropicResponse) UnmarshalJSON(data []byte) error
type AnthropicStreamingChunkStart ¶
type AnthropicStreamingChunkStart struct {
Type string `json:"type"`
Message struct {
ID string `json:"id"`
Type string `json:"type"`
Role string `json:"role"`
Content []any `json:"content"`
Model string `json:"model"`
StopReason any `json:"stop_reason"`
StopSequence any `json:"stop_sequence"`
Usage struct {
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheCreationInputTokens int `json:"cache_creation_input_tokens"`
CacheReadInputTokens int `json:"cache_read_input_tokens"`
} `json:"usage"`
} `json:"message"`
}
type AnthropicStreamingChunkType ¶
type AnthropicStreamingChunkType struct {
Type string `json:"type"`
}
type BedrockConverseResponse ¶
type BedrockConverseResponse struct {
Output struct {
Message struct {
Role string `json:"role"`
Content []struct {
Text string `json:"text,omitempty"`
} `json:"content"`
} `json:"message"`
} `json:"output"`
StopReason string `json:"stopReason"`
Usage struct {
InputTokens int `json:"inputTokens"`
OutputTokens int `json:"outputTokens"`
TotalTokens int `json:"totalTokens"`
} `json:"usage"`
Metrics struct {
LatencyMs int `json:"latencyMs"`
} `json:"metrics"`
}
BedrockConverseResponse represents the JSON response from the Bedrock Converse API. Used by AnalyzeResponse to extract token usage for analytics.
func (*BedrockConverseResponse) GetCacheReadPromptTokens ¶
func (r *BedrockConverseResponse) GetCacheReadPromptTokens() int
func (*BedrockConverseResponse) GetCacheWritePromptTokens ¶
func (r *BedrockConverseResponse) GetCacheWritePromptTokens() int
func (*BedrockConverseResponse) GetChoiceCount ¶
func (r *BedrockConverseResponse) GetChoiceCount() int
func (*BedrockConverseResponse) GetModel ¶
func (r *BedrockConverseResponse) GetModel() string
func (*BedrockConverseResponse) GetPromptTokens ¶
func (r *BedrockConverseResponse) GetPromptTokens() int
func (*BedrockConverseResponse) GetResponseTokens ¶
func (r *BedrockConverseResponse) GetResponseTokens() int
func (*BedrockConverseResponse) GetToolCount ¶
func (r *BedrockConverseResponse) GetToolCount() int
type BedrockConverseStreamContentBlockDelta ¶
type BedrockConverseStreamContentBlockDelta struct {
ContentBlockIndex int `json:"contentBlockIndex"`
Delta struct {
Text string `json:"text,omitempty"`
} `json:"delta"`
}
BedrockConverseStreamContentBlockDelta represents a content block delta in a ConverseStream response.
type BedrockConverseStreamMetadataEvent ¶
type BedrockConverseStreamMetadataEvent struct {
Usage struct {
InputTokens int `json:"inputTokens"`
OutputTokens int `json:"outputTokens"`
TotalTokens int `json:"totalTokens"`
} `json:"usage"`
Metrics struct {
LatencyMs int `json:"latencyMs"`
} `json:"metrics"`
}
BedrockConverseStreamMetadataEvent represents the metadata event in a ConverseStream response. This is the final event containing token usage, sent as SSE by the SDK-mediated streaming proxy.
type ChatCompletionChoice ¶
type ChatCompletionChoice struct {
Index int `json:"index"`
Message ChatMessage `json:"message"`
FinishReason FinishReason `json:"finish_reason"`
}
ChatCompletionChoice is a choice in a chat response.
type ChatMessage ¶
type ChatMessage struct {
// The role of the author of this message. One of system, user, assistant, function, or tool.
Role string
// The content of the message.
// This field is mutually exclusive with MultiContent.
Content string
// MultiContent is a list of content parts to use in the message.
MultiContent []llms.ContentPart
// The name of the author of this message. May contain a-z, A-Z, 0-9, and underscores,
// with a maximum length of 64 characters.
Name string
// ToolCalls is a list of tools that were called in the message.
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
// ToolCallID is the ID of the tool call this message is for.
// Only present in tool messages.
ToolCallID string `json:"tool_call_id,omitempty"`
}
type ChatUsage ¶
type ChatUsage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
CompletionTokensDetails struct {
ReasoningTokens int `json:"reasoning_tokens"`
} `json:"completion_tokens_details"`
PromptTokensDetails PromptTokensDetails `json:"prompt_tokens_details"`
}
ChatUsage is the usage of a chat completion request.
type Content ¶
type Content interface {
GetType() string
}
Content can be TextContent or ToolUseContent depending on the type.
type DummyResponse ¶
type DummyResponse struct {
Usage struct {
PromptTokens int `json:"prompt_tokens"`
ResponseTokens int `json:"response_tokens"`
}
Model string `json:"model"`
}
func (*DummyResponse) GetCacheReadPromptTokens ¶
func (o *DummyResponse) GetCacheReadPromptTokens() int
func (*DummyResponse) GetCacheWritePromptTokens ¶
func (o *DummyResponse) GetCacheWritePromptTokens() int
func (*DummyResponse) GetChoiceCount ¶
func (o *DummyResponse) GetChoiceCount() int
func (*DummyResponse) GetModel ¶
func (o *DummyResponse) GetModel() string
func (*DummyResponse) GetPromptTokens ¶
func (o *DummyResponse) GetPromptTokens() int
func (*DummyResponse) GetResponseTokens ¶
func (o *DummyResponse) GetResponseTokens() int
func (*DummyResponse) GetToolCount ¶
func (o *DummyResponse) GetToolCount() int
type EnumString ¶
type EnumString string
EnumString is a protobuf enum field that a vendor may serialize either as its name ("STOP") or as its ordinal (1).
Gemini does both, depending on which transport served the request. Typing these fields as a plain string made every affected response fail to decode with "cannot unmarshal number into Go struct field ... of type string", and because analytics decoding is best-effort, the whole record was silently dropped - so calls that worked perfectly for the caller produced no usage or cost data at all.
func (EnumString) MarshalJSON ¶
func (e EnumString) MarshalJSON() ([]byte, error)
func (EnumString) String ¶
func (e EnumString) String() string
String returns the value as received: the enum name where the vendor sent one, the decimal ordinal where it sent a number.
func (*EnumString) UnmarshalJSON ¶
func (e *EnumString) UnmarshalJSON(data []byte) error
type FinishReason ¶
type FinishReason string
const ( FinishReasonStop FinishReason = "stop" FinishReasonLength FinishReason = "length" FinishReasonFunctionCall FinishReason = "function_call" FinishReasonToolCalls FinishReason = "tool_calls" FinishReasonContentFilter FinishReason = "content_filter" FinishReasonNull FinishReason = "null" )
func (FinishReason) MarshalJSON ¶
func (r FinishReason) MarshalJSON() ([]byte, error)
type FunctionDefinition ¶
type FunctionDefinition struct {
// Name is the name of the function.
Name string `json:"name"`
// Description is a description of the function.
Description string `json:"description,omitempty"`
// Parameters is a list of parameters for the function.
Parameters any `json:"parameters"`
// Strict is a flag to enable structured output mode.
Strict bool `json:"strict,omitempty"`
}
FunctionDefinition is a definition of a function that can be called by the model.
type GenericResponse ¶
type GenericResponse struct {
Model string
Choices int
ToolCalls int
PromptTokens int
CompletionTokens int
CacheWritePromptTokens int
CacheReadPromptTokens int
}
func (*GenericResponse) GetCacheReadPromptTokens ¶
func (o *GenericResponse) GetCacheReadPromptTokens() int
func (*GenericResponse) GetCacheWritePromptTokens ¶
func (o *GenericResponse) GetCacheWritePromptTokens() int
func (*GenericResponse) GetChoiceCount ¶
func (o *GenericResponse) GetChoiceCount() int
func (*GenericResponse) GetModel ¶
func (o *GenericResponse) GetModel() string
func (*GenericResponse) GetPromptTokens ¶
func (o *GenericResponse) GetPromptTokens() int
func (*GenericResponse) GetResponseTokens ¶
func (o *GenericResponse) GetResponseTokens() int
func (*GenericResponse) GetToolCount ¶
func (o *GenericResponse) GetToolCount() int
type GoogleAIChatResponse ¶
type GoogleAIChatResponse struct {
Candidates []struct {
Content struct {
Role string `json:"role"`
Parts []struct {
Text string `json:"text"`
Name string `json:"name"`
Args map[string]interface{} `json:"args"`
} `json:"parts"`
} `json:"content"`
// Enum fields: Gemini sends these as names over one transport and as
// ordinals over another, so they must accept both. See EnumString.
FinishReason EnumString `json:"finishReason"`
SafetyRatings []struct {
Category EnumString `json:"category"`
Probability EnumString `json:"probability"`
ProbabilityScore float64 `json:"probabilityScore"`
Severity EnumString `json:"severity"`
SeverityScore float64 `json:"severityScore"`
} `json:"safetyRatings"`
} `json:"candidates"`
UsageMetadata struct {
PromptTokenCount int `json:"promptTokenCount"`
CandidatesTokenCount int `json:"candidatesTokenCount"`
TotalTokenCount int `json:"totalTokenCount"`
CachedContentTokenCount int `json:"cachedContentTokenCount"`
ThoughtsTokenCount int `json:"thoughtsTokenCount"`
} `json:"usageMetadata"`
Model string `json:"model"`
ModelVersion string `json:"modelVersion"`
}
func (*GoogleAIChatResponse) GetCacheReadPromptTokens ¶
func (o *GoogleAIChatResponse) GetCacheReadPromptTokens() int
func (*GoogleAIChatResponse) GetCacheWritePromptTokens ¶
func (o *GoogleAIChatResponse) GetCacheWritePromptTokens() int
func (*GoogleAIChatResponse) GetChoiceCount ¶
func (o *GoogleAIChatResponse) GetChoiceCount() int
func (*GoogleAIChatResponse) GetModel ¶
func (o *GoogleAIChatResponse) GetModel() string
func (*GoogleAIChatResponse) GetPromptTokens ¶
func (o *GoogleAIChatResponse) GetPromptTokens() int
func (*GoogleAIChatResponse) GetResponseTokens ¶
func (o *GoogleAIChatResponse) GetResponseTokens() int
func (*GoogleAIChatResponse) GetToolCount ¶
func (o *GoogleAIChatResponse) GetToolCount() int
func (*GoogleAIChatResponse) SetModel ¶
func (o *GoogleAIChatResponse) SetModel(name string)
type GoogleAIStreamChunk ¶
type GoogleAIStreamChunk struct {
Candidates []struct {
Content struct {
Parts []struct {
Text string `json:"text"`
} `json:"parts"`
Role string `json:"role"`
} `json:"content"`
FinishReason EnumString `json:"finishReason"`
Index int `json:"index"`
SafetyRatings []struct {
Category EnumString `json:"category"`
Probability EnumString `json:"probability"`
} `json:"safetyRatings"`
} `json:"candidates"`
UsageMetadata struct {
PromptTokenCount int `json:"promptTokenCount"`
CandidatesTokenCount int `json:"candidatesTokenCount"`
TotalTokenCount int `json:"totalTokenCount"`
CachedContentTokenCount int `json:"cachedContentTokenCount"`
ThoughtsTokenCount int `json:"thoughtsTokenCount"`
} `json:"usageMetadata"`
ModelVersion string `json:"modelVersion"`
}
type OAIUsage ¶
type OAIUsage struct {
CompletionTokens int `json:"completion_tokens"`
PromptTokens int `json:"prompt_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokensDetails PromptTokensDetails `json:"prompt_tokens_details"`
}
type OllamaGenerateResponse ¶
type OllamaGenerateResponse struct {
CreatedAt time.Time `json:"created_at"`
Model string `json:"model"`
Response string `json:"response"`
Context []int `json:"context,omitempty"`
TotalDuration time.Duration `json:"total_duration,omitempty"`
LoadDuration time.Duration `json:"load_duration,omitempty"`
PromptEvalCount int `json:"prompt_eval_count,omitempty"`
PromptEvalDuration time.Duration `json:"prompt_eval_duration,omitempty"`
EvalCount int `json:"eval_count,omitempty"`
EvalDuration time.Duration `json:"eval_duration,omitempty"`
Done bool `json:"done"`
}
func (*OllamaGenerateResponse) GetCacheReadPromptTokens ¶
func (o *OllamaGenerateResponse) GetCacheReadPromptTokens() int
func (*OllamaGenerateResponse) GetCacheWritePromptTokens ¶
func (o *OllamaGenerateResponse) GetCacheWritePromptTokens() int
func (*OllamaGenerateResponse) GetChoiceCount ¶
func (o *OllamaGenerateResponse) GetChoiceCount() int
func (*OllamaGenerateResponse) GetModel ¶
func (o *OllamaGenerateResponse) GetModel() string
func (*OllamaGenerateResponse) GetPromptTokens ¶
func (o *OllamaGenerateResponse) GetPromptTokens() int
func (*OllamaGenerateResponse) GetResponseTokens ¶
func (o *OllamaGenerateResponse) GetResponseTokens() int
func (*OllamaGenerateResponse) GetToolCount ¶
func (o *OllamaGenerateResponse) GetToolCount() int
type OpenAIRequest ¶
type OpenAIResponse ¶
type OpenAIResponse struct {
ID string `json:"id,omitempty"`
Created int64 `json:"created,omitempty"`
Choices []*ChatCompletionChoice `json:"choices,omitempty"`
Model string `json:"model,omitempty"`
Object string `json:"object,omitempty"`
Usage ChatUsage `json:"usage,omitempty"`
SystemFingerprint string `json:"system_fingerprint"`
}
func (*OpenAIResponse) GetCacheReadPromptTokens ¶
func (o *OpenAIResponse) GetCacheReadPromptTokens() int
func (*OpenAIResponse) GetCacheWritePromptTokens ¶
func (o *OpenAIResponse) GetCacheWritePromptTokens() int
func (*OpenAIResponse) GetChoiceCount ¶
func (o *OpenAIResponse) GetChoiceCount() int
func (*OpenAIResponse) GetModel ¶
func (o *OpenAIResponse) GetModel() string
func (*OpenAIResponse) GetPromptTokens ¶
func (o *OpenAIResponse) GetPromptTokens() int
func (*OpenAIResponse) GetResponseTokens ¶
func (o *OpenAIResponse) GetResponseTokens() int
func (*OpenAIResponse) GetToolCount ¶
func (o *OpenAIResponse) GetToolCount() int
type OpenAIStreamingResponse ¶
type OpenAIStreamingResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
Model string `json:"model"`
SystemFingerprint string `json:"system_fingerprint"`
Choices []struct {
Index int `json:"index"`
Delta map[string]interface{} `json:"delta"`
Logprobs any `json:"logprobs"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
Usage *OAIUsage `json:"usage"`
}
func (*OpenAIStreamingResponse) GetCacheReadPromptTokens ¶
func (o *OpenAIStreamingResponse) GetCacheReadPromptTokens() int
func (*OpenAIStreamingResponse) GetCacheWritePromptTokens ¶
func (o *OpenAIStreamingResponse) GetCacheWritePromptTokens() int
func (*OpenAIStreamingResponse) GetChoiceCount ¶
func (o *OpenAIStreamingResponse) GetChoiceCount() int
func (*OpenAIStreamingResponse) GetModel ¶
func (o *OpenAIStreamingResponse) GetModel() string
func (*OpenAIStreamingResponse) GetPromptTokens ¶
func (o *OpenAIStreamingResponse) GetPromptTokens() int
func (*OpenAIStreamingResponse) GetResponseTokens ¶
func (o *OpenAIStreamingResponse) GetResponseTokens() int
func (*OpenAIStreamingResponse) GetToolCount ¶
func (o *OpenAIStreamingResponse) GetToolCount() int
type PromptTokensDetails ¶
type PromptTokensDetails struct {
CachedTokens int `json:"cached_tokens"`
CacheWriteTokens int `json:"cache_write_tokens"`
}
PromptTokensDetails is the prompt-cache breakdown of a chat completion's usage. OpenAI reports cache hits as `cached_tokens`, a subset of `prompt_tokens`; OpenAI-compatible backends (for example Bedrock-hosted models) additionally report `cache_write_tokens` for the tokens written into the cache by this request.
type ProxyDummyResponse ¶
type ProxyDummyResponse struct {
Model string `json:"model"`
Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
} `json:"usage"`
}
func (*ProxyDummyResponse) GetCacheReadPromptTokens ¶
func (o *ProxyDummyResponse) GetCacheReadPromptTokens() int
func (*ProxyDummyResponse) GetCacheWritePromptTokens ¶
func (o *ProxyDummyResponse) GetCacheWritePromptTokens() int
func (*ProxyDummyResponse) GetChoiceCount ¶
func (o *ProxyDummyResponse) GetChoiceCount() int
func (*ProxyDummyResponse) GetModel ¶
func (o *ProxyDummyResponse) GetModel() string
func (*ProxyDummyResponse) GetPromptTokens ¶
func (o *ProxyDummyResponse) GetPromptTokens() int
func (*ProxyDummyResponse) GetResponseTokens ¶
func (o *ProxyDummyResponse) GetResponseTokens() int
func (*ProxyDummyResponse) GetToolCount ¶
func (o *ProxyDummyResponse) GetToolCount() int
type ResponseFormat ¶
type ResponseFormat struct {
Type string `json:"type"`
JSONSchema *ResponseFormatJSONSchema `json:"json_schema,omitempty"`
}
ResponseFormat is the format of the response.
type ResponseFormatJSONSchema ¶
type ResponseFormatJSONSchema struct {
Name string `json:"name"`
Strict bool `json:"strict"`
Schema *ResponseFormatJSONSchemaProperty `json:"schema"`
}
type ResponseFormatJSONSchemaProperty ¶
type ResponseFormatJSONSchemaProperty struct {
Type string `json:"type"`
Description string `json:"description,omitempty"`
Enum []interface{} `json:"enum,omitempty"`
Items *ResponseFormatJSONSchemaProperty `json:"items,omitempty"`
Properties map[string]*ResponseFormatJSONSchemaProperty `json:"properties,omitempty"`
AdditionalProperties bool `json:"additionalProperties"`
Required []string `json:"required,omitempty"`
Ref string `json:"$ref,omitempty"`
}
type TextContent ¶
func (TextContent) GetType ¶
func (tc TextContent) GetType() string
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema any `json:"input_schema,omitempty"`
}
Tool used for the request message payload.
type ToolCall ¶
type ToolCall struct {
ID string `json:"id,omitempty"`
Type ToolType `json:"type"`
Function ToolFunction `json:"function,omitempty"`
}
ToolCall is a call to a tool.
type ToolChoice ¶
type ToolChoice struct {
Type ToolType `json:"type"`
Function ToolFunction `json:"function,omitempty"`
}
ToolChoice is a choice of a tool to use.
type ToolFunction ¶
ToolFunction is a function to be called in a tool choice.
type ToolResultContent ¶
type ToolResultContent struct {
Type string `json:"type"`
ToolUseID string `json:"tool_use_id"`
Content string `json:"content"`
}
func (ToolResultContent) GetType ¶
func (trc ToolResultContent) GetType() string
type ToolType ¶
type ToolType string
ToolType is the type of a tool.
const (
ToolTypeFunction ToolType = "function"
)
type ToolUseContent ¶
type ToolUseContent struct {
Type string `json:"type"`
ID string `json:"id"`
Name string `json:"name"`
Input map[string]interface{} `json:"input"`
}
func (ToolUseContent) GetType ¶
func (tuc ToolUseContent) GetType() string
type Usage ¶
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
CompletionTokensDetails struct {
ReasoningTokens int `json:"reasoning_tokens"`
} `json:"completion_tokens_details"`
PromptTokensDetails PromptTokensDetails `json:"prompt_tokens_details"`
}