types

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 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"`
}

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

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

type ContentBlock

type ContentBlock struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
}

type ResponseItem

type ResponseItem struct {
	ID      string         `json:"id"`
	Object  string         `json:"object"`
	Created int64          `json:"created"`
	Role    string         `json:"role"`
	Content []ContentBlock `json:"content"`
	Status  string         `json:"status"`
}

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

type ResponsesResponse

type ResponsesResponse struct {
	ID        string         `json:"id"`
	Object    string         `json:"object"`
	Created   int64          `json:"created"`
	Model     string         `json:"model"`
	Responses []ResponseItem `json:"responses,omitempty"`
	Usage     *Usage         `json:"usage,omitempty"`
}

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 Usage

type Usage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

Jump to

Keyboard shortcuts

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