Documentation
¶
Index ¶
- type AnthropicErrorDetail
- type AnthropicErrorResponse
- type ChatChoice
- type ChatErrorDetail
- type ChatErrorResponse
- type ChatMessage
- type ChatRequest
- type ChatResponse
- type ChatStreamResponse
- type ChatUsage
- type CompactionPayload
- type ContentBlock
- type FunctionCall
- type FunctionDef
- type IncompleteDetails
- type OutputTokensDetails
- type PromptTokensDetails
- type ResponseError
- type ResponseItem
- type ResponsesRequest
- type ResponsesResponse
- type ResponsesTool
- type StreamChoice
- type StreamOptions
- type Tool
- type ToolCall
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnthropicErrorDetail ¶ added in v0.1.4
type AnthropicErrorResponse ¶ added in v0.1.4
type AnthropicErrorResponse struct {
Type string `json:"type"`
Error *AnthropicErrorDetail `json:"error"`
}
AnthropicErrorResponse models the Anthropic Messages API error format.
type ChatChoice ¶
type ChatChoice struct {
Index int `json:"index"`
Message ChatMessage `json:"message"`
FinishReason string `json:"finish_reason"`
}
type ChatErrorDetail ¶ added in v0.1.4
type ChatErrorResponse ¶ added in v0.1.4
type ChatErrorResponse struct {
Error *ChatErrorDetail `json:"error"`
}
ChatErrorResponse models the OpenAI/Chat API error format. Used by Chat and Responses APIs.
type ChatMessage ¶
type ChatRequest ¶
type ChatRequest struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
MaxTokens int `json:"max_tokens,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
TopP float64 `json:"top_p,omitempty"`
Stream bool `json:"stream,omitempty"`
StreamOptions *StreamOptions `json:"stream_options,omitempty"`
N int `json:"n,omitempty"`
Tools []Tool `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
}
type ChatResponse ¶
type ChatStreamResponse ¶
type ChatUsage ¶
type ChatUsage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokensDetails *PromptTokensDetails `json:"prompt_tokens_details,omitempty"`
PromptCacheHitTokens int `json:"prompt_cache_hit_tokens,omitempty"`
}
type CompactionPayload ¶ added in v0.1.12
type CompactionPayload struct {
Summary string `json:"summary"`
Model string `json:"model"`
TS int64 `json:"ts"`
}
CompactionPayload is the self-contained data encoded in fake encrypted_content.
type ContentBlock ¶
type FunctionCall ¶ added in v0.1.5
type FunctionDef ¶ added in v0.1.5
type IncompleteDetails ¶ added in v0.1.18
type IncompleteDetails struct {
Reason string `json:"reason"`
}
type OutputTokensDetails ¶ added in v0.1.18
type OutputTokensDetails struct {
ReasoningTokens int `json:"reasoning_tokens,omitempty"`
}
type PromptTokensDetails ¶ added in v0.1.9
type PromptTokensDetails struct {
CachedTokens int `json:"cached_tokens"`
}
type ResponseError ¶ added in v0.1.18
type ResponseItem ¶
type ResponseItem struct {
ID string `json:"id"`
Type string `json:"type,omitempty"`
Object string `json:"object"`
Created int64 `json:"created"`
Role string `json:"role"`
Content []ContentBlock `json:"content,omitempty"`
Status string `json:"status"`
CallID string `json:"call_id,omitempty"`
Name string `json:"name,omitempty"`
Arguments string `json:"arguments,omitempty"`
}
type ResponsesRequest ¶
type ResponsesRequest struct {
Model string `json:"model"`
Input any `json:"input,omitempty"`
Instructions any `json:"instructions,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Store bool `json:"store,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
TopP float64 `json:"top_p,omitempty"`
Temperature float64 `json:"temperature,omitempty"`
PreviousResponseID string `json:"previous_response_id,omitempty"`
Stream bool `json:"stream,omitempty"`
Tools []ResponsesTool `json:"tools,omitempty"`
ToolChoice any `json:"tool_choice,omitempty"`
Truncation string `json:"truncation,omitempty"`
Reasoning any `json:"reasoning,omitempty"`
ParallelToolCalls *bool `json:"parallel_tool_calls,omitempty"`
}
type ResponsesResponse ¶
type ResponsesResponse struct {
ID string `json:"id"`
Object string `json:"object"`
CreatedAt int64 `json:"created_at"`
Model string `json:"model"`
Output []ResponseItem `json:"output,omitempty"`
Usage *Usage `json:"usage,omitempty"`
Status string `json:"status,omitempty"`
Error *ResponseError `json:"error,omitempty"`
IncompleteDetails *IncompleteDetails `json:"incomplete_details,omitempty"`
}
type ResponsesTool ¶ added in v0.1.5
type StreamChoice ¶
type StreamChoice struct {
Index int `json:"index"`
Delta ChatMessage `json:"delta"`
FinishReason string `json:"finish_reason"`
}
type StreamOptions ¶ added in v0.1.4
type StreamOptions struct {
IncludeUsage bool `json:"include_usage"`
}
type Tool ¶ added in v0.1.5
type Tool struct {
Type string `json:"type"`
Function FunctionDef `json:"function"`
}
type ToolCall ¶ added in v0.1.5
type ToolCall struct {
Index int `json:"index,omitempty"`
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Function FunctionCall `json:"function,omitempty"`
}
type Usage ¶
type Usage struct {
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
TotalTokens int `json:"total_tokens"`
CacheCreationTokens int `json:"cache_creation_tokens,omitempty"`
CacheReadTokens int `json:"cache_read_tokens,omitempty"`
OutputTokensDetails *OutputTokensDetails `json:"output_tokens_details,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.