types

package
v0.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicErrorDetail added in v0.1.4

type AnthropicErrorDetail struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

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 ChatErrorDetail struct {
	Message string `json:"message"`
	Type    string `json:"type,omitempty"`
	Code    string `json:"code,omitempty"`
}

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 ChatMessage struct {
	Role             string     `json:"role,omitempty"`
	Content          *string    `json:"content,omitempty"`
	ReasoningContent *string    `json:"reasoning_content,omitempty"`
	ToolCalls        []ToolCall `json:"tool_calls,omitempty"`
	ToolCallID       string     `json:"tool_call_id,omitempty"`
}

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 ChatResponse struct {
	ID      string       `json:"id"`
	Object  string       `json:"object"`
	Created int64        `json:"created"`
	Model   string       `json:"model"`
	Choices []ChatChoice `json:"choices"`
	Usage   ChatUsage    `json:"usage"`
}

type ChatStreamResponse

type ChatStreamResponse struct {
	ID      string         `json:"id"`
	Object  string         `json:"object"`
	Created int64          `json:"created"`
	Model   string         `json:"model"`
	Choices []StreamChoice `json:"choices"`
	Usage   *ChatUsage     `json:"usage,omitempty"`
}

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 ContentBlock struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
}

type FunctionCall added in v0.1.5

type FunctionCall struct {
	Name      string `json:"name,omitempty"`
	Arguments string `json:"arguments,omitempty"`
}

type FunctionDef added in v0.1.5

type FunctionDef struct {
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Parameters  map[string]any `json:"parameters,omitempty"`
}

type PromptTokensDetails added in v0.1.9

type PromptTokensDetails struct {
	CachedTokens int `json:"cached_tokens"`
}

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       string          `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"`
}

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"`
}

type ResponsesTool added in v0.1.5

type ResponsesTool struct {
	Type        string          `json:"type,omitempty"`
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Parameters  map[string]any  `json:"parameters,omitempty"`
	Tools       []ResponsesTool `json:"tools,omitempty"` // namespace sub-tools (Codex MCP)
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL