types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanModelName

func CleanModelName(model string) string

Types

type ContentBlock

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

	Source *ContentBlockSource `json:"source,omitempty"`

	ID    string `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Input any    `json:"input,omitempty"`

	ToolUseID string `json:"tool_use_id,omitempty"`
	Content   any    `json:"content,omitempty"`

	Thinking  string `json:"thinking,omitempty"`
	Signature string `json:"signature,omitempty"`
}

type ContentBlockSource

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

type ErrorResponse

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

type Message

type Message struct {
	Role    string `json:"role" validate:"required"`
	Content any    `json:"content" validate:"required"`
}

func (*Message) GetContentAsString

func (m *Message) GetContentAsString() string

type MessagesRequest

type MessagesRequest struct {
	Type          string          `json:"type,omitempty"`
	Model         string          `json:"model" validate:"required"`
	MaxTokens     int             `json:"max_tokens" validate:"required"`
	Messages      []Message       `json:"messages" validate:"required"`
	System        any             `json:"system,omitempty"`
	StopSequences []string        `json:"stop_sequences,omitempty"`
	Stream        *bool           `json:"stream,omitempty"`
	Temperature   *float64        `json:"temperature,omitempty"`
	TopP          *float64        `json:"top_p,omitempty"`
	TopK          *int            `json:"top_k,omitempty"`
	Metadata      map[string]any  `json:"metadata,omitempty"`
	Tools         []Tool          `json:"tools,omitempty"`
	ToolChoice    *ToolChoice     `json:"tool_choice,omitempty"`
	Thinking      *ThinkingConfig `json:"thinking,omitempty"`
	OutputConfig  *OutputConfig   `json:"output_config,omitempty"`

	OriginalModel string `json:"-"`
}

type MessagesResponse

type MessagesResponse 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,omitempty"`
	StopSequence *string        `json:"stop_sequence,omitempty"`
	Usage        Usage          `json:"usage"`
}

type OutputConfig added in v0.2.0

type OutputConfig struct {
	Effort string `json:"effort,omitempty"`
}

type ThinkingConfig

type ThinkingConfig struct {
	Type         string `json:"type,omitempty"`
	Enabled      bool   `json:"enabled"`
	BudgetTokens int    `json:"budget_tokens"`
	Display      string `json:"display,omitempty"`
}

type Tool

type Tool struct {
	Type        string          `json:"type,omitempty"`
	Name        string          `json:"name" validate:"required"`
	Description string          `json:"description,omitempty"`
	InputSchema json.RawMessage `json:"input_schema" validate:"required"`
}

type ToolChoice

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

type Usage

type Usage struct {
	InputTokens              int `json:"input_tokens"`
	OutputTokens             int `json:"output_tokens"`
	CacheCreationInputTokens int `json:"cache_creation_input_tokens,omitempty"`
	CacheReadInputTokens     int `json:"cache_read_input_tokens,omitempty"`
	ThinkingTokens           int `json:"thinking_tokens,omitempty"`
}

Jump to

Keyboard shortcuts

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