types

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EndTurn      = "end_turn"
	MaxTokens    = "max_tokens"
	StopSequence = "stop_sequence"
	ToolUse      = "tool_use"
)

Variables

This section is empty.

Functions

func IsConnectorTextBlock

func IsConnectorTextBlock(m map[string]interface{}) bool

Types

type APIConnectionError

type APIConnectionError struct{ APIError }

func NewAPIConnectionError

func NewAPIConnectionError(message string) *APIConnectionError

type APIConnectionTimeoutError

type APIConnectionTimeoutError struct{ APIError }

func NewAPIConnectionTimeoutError

func NewAPIConnectionTimeoutError(message string) *APIConnectionTimeoutError

type APIError

type APIError struct {
	Status  int                    `json:"status"`
	Headers map[string]string      `json:"headers"`
	Err     map[string]interface{} `json:"error"`
	Message string                 `json:"message"`
}

func NewAPIError

func NewAPIError(status int, headers map[string]string, err map[string]interface{}, message string) *APIError

func (*APIError) Error

func (e *APIError) Error() string

type APIUserAbortError

type APIUserAbortError struct{ APIError }

func NewAPIUserAbortError

func NewAPIUserAbortError(message string) *APIUserAbortError

type AgentId

type AgentId string

func AsAgentId

func AsAgentId(s string) AgentId

func ToAgentId

func ToAgentId(s string) (*AgentId, error)

type AssistantMessage

type AssistantMessage struct {
	Message
	IsApiErrorMessage bool          `json:"is_api_error_message"`
	ErrorDetails      *ErrorDetails `json:"error_details,omitempty"`
}

func CreateAssistantMessage

func CreateAssistantMessage(text string) AssistantMessage

type AuthenticationError

type AuthenticationError struct{ APIError }

func NewAuthenticationError

func NewAuthenticationError(message string) *AuthenticationError

type Base64ImageSource

type Base64ImageSource struct {
	Type      string `json:"type"`
	MediaType string `json:"media_type"`
	Data      string `json:"data"`
}

type BetaMessage

type BetaMessage struct {
	ID           string         `json:"id"`
	Type_        string         `json:"type"`
	Role         string         `json:"role"`
	Content      []ContentBlock `json:"content"`
	Model        string         `json:"model"`
	StopReason   string         `json:"stop_reason"`
	StopSequence string         `json:"stop_sequence"`
	Usage        BetaUsage      `json:"usage"`
}

type BetaMessageParam

type BetaMessageParam struct {
	Role    string      `json:"role"`
	Content interface{} `json:"content"`
}

type BetaUsage

type BetaUsage struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

type CacheCreation

type CacheCreation struct {
	Ephemeral1hInputTokens int `json:"ephemeral_1h_input_tokens"`
	Ephemeral5mInputTokens int `json:"ephemeral_5m_input_tokens"`
}

type ClientOptions

type ClientOptions struct {
	APIKey     string `json:"api_key"`
	BaseURL    string `json:"base_url"`
	Timeout    int    `json:"timeout"`
	MaxRetries int    `json:"max_retries"`
}

type ConnectorTextBlock

type ConnectorTextBlock struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type ConnectorTextDelta

type ConnectorTextDelta struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type ContentBlock

type ContentBlock = interface{}

type ContentBlockParam

type ContentBlockParam = interface{}

type ErrorDetails

type ErrorDetails struct {
	ActualTokens *int `json:"actual_tokens,omitempty"`
	LimitTokens  *int `json:"limit_tokens,omitempty"`
}

type ImageBlockParam

type ImageBlockParam struct {
	Type   string            `json:"type"`
	Source Base64ImageSource `json:"source"`
}

func IsImageBlock

func IsImageBlock(v interface{}) (ImageBlockParam, bool)

type Message

type Message struct {
	ID           string      `json:"id"`
	Type_        string      `json:"type"`
	Role         string      `json:"role"`
	Content      interface{} `json:"content"`
	Model        string      `json:"model"`
	StopReason   string      `json:"stop_reason"`
	StopSequence string      `json:"stop_sequence"`
	Usage        *Usage      `json:"usage"`
}

type MessageCreateParams

type MessageCreateParams struct {
	Model         string         `json:"model"`
	MaxTokens     int            `json:"max_tokens"`
	Messages      []MessageParam `json:"messages"`
	Tools         []Tool         `json:"tools,omitempty"`
	ToolChoice    *ToolChoice    `json:"tool_choice,omitempty"`
	System        *string        `json:"system,omitempty"`
	Temperature   *float64       `json:"temperature,omitempty"`
	TopP          *float64       `json:"top_p,omitempty"`
	TopK          *int           `json:"top_k,omitempty"`
	StopSequences []string       `json:"stop_sequences,omitempty"`
	Stream        bool           `json:"stream"`
}

type MessageOrigin

type MessageOrigin = string
const (
	User       MessageOrigin = "user"
	API        MessageOrigin = "api"
	ToolOrigin MessageOrigin = "tool"
	System     MessageOrigin = "system"
	Compact    MessageOrigin = "compact"
	Recovery   MessageOrigin = "recovery"
)

type MessageParam

type MessageParam struct {
	Role    string      `json:"role"`
	Content interface{} `json:"content"`
}

type MessageSource

type MessageSource = string
const (
	UserSource   MessageSource = "user"
	Teammate     MessageSource = "teammate"
	SystemSource MessageSource = "system"
	Tick         MessageSource = "tick"
	Task         MessageSource = "task"
)

type MessageStreamEvent

type MessageStreamEvent struct {
	Type string `json:"type"`
}

type NonNullableUsage

type NonNullableUsage struct {
	InputTokens              int           `json:"input_tokens"`
	CacheCreationInputTokens int           `json:"cache_creation_input_tokens"`
	CacheReadInputTokens     int           `json:"cache_read_input_tokens"`
	OutputTokens             int           `json:"output_tokens"`
	ServerToolUse            ServerToolUse `json:"server_tool_use"`
	ServiceTier              string        `json:"service_tier"`
	CacheCreation            CacheCreation `json:"cache_creation"`
	InferenceGeo             string        `json:"inference_geo"`
	Iterations               []interface{} `json:"iterations"`
	Speed                    string        `json:"speed"`
}

func EmptyUsage

func EmptyUsage() NonNullableUsage

type NotFoundError

type NotFoundError struct{ APIError }

func NewNotFoundError

func NewNotFoundError(message string) *NotFoundError

type RedactedThinkingBlock

type RedactedThinkingBlock struct {
	Type string `json:"type"`
	Data string `json:"data"`
}

type RedactedThinkingBlockParam

type RedactedThinkingBlockParam struct {
	Type string `json:"type"`
	Data string `json:"data"`
}

type ServerToolUse

type ServerToolUse struct {
	WebSearchRequests int `json:"web_search_requests"`
	WebFetchRequests  int `json:"web_fetch_requests"`
}

type SessionId

type SessionId string

func AsSessionId

func AsSessionId(s string) SessionId

type SystemMessage

type SystemMessage struct {
	Message
}

func CreateSystemMessage

func CreateSystemMessage(text string) SystemMessage

type TextBlock

type TextBlock struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

func IsTextBlock

func IsTextBlock(v interface{}) (TextBlock, bool)

type TextBlockParam

type TextBlockParam struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type ThinkingBlock

type ThinkingBlock struct {
	Type      string `json:"type"`
	Thinking  string `json:"thinking"`
	Signature string `json:"signature"`
}

type ThinkingBlockParam

type ThinkingBlockParam struct {
	Type      string `json:"type"`
	Thinking  string `json:"thinking"`
	Signature string `json:"signature"`
}

type Tool

type Tool struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	InputSchema ToolInputSchema `json:"input_schema"`
}

type ToolChoice

type ToolChoice struct {
	Type string `json:"type"`
	Name string `json:"name,omitempty"`
}

type ToolInputSchema

type ToolInputSchema struct {
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	Required   []string               `json:"required"`
}

type ToolResultBlockParam

type ToolResultBlockParam struct {
	Type      string      `json:"type"`
	ToolUseID string      `json:"tool_use_id"`
	Content   interface{} `json:"content"`
	IsError   bool        `json:"is_error"`
}

func IsToolResultBlock

func IsToolResultBlock(v interface{}) (ToolResultBlockParam, bool)

type ToolUseBlock

type ToolUseBlock struct {
	Type  string                 `json:"type"`
	ID    string                 `json:"id"`
	Name  string                 `json:"name"`
	Input map[string]interface{} `json:"input"`
}

func IsToolUseBlock

func IsToolUseBlock(v interface{}) (ToolUseBlock, bool)

type ToolUseBlockParam

type ToolUseBlockParam struct {
	Type  string                 `json:"type"`
	ID    string                 `json:"id"`
	Name  string                 `json:"name"`
	Input map[string]interface{} `json:"input"`
}

type Usage

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

type UserMessage

type UserMessage struct {
	Message
}

func CreateUserMessage

func CreateUserMessage(text string) UserMessage

Jump to

Keyboard shortcuts

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