claude

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Claude API limits
	MaxTokensNonStreaming = 4096 // Max tokens for regular Chat()
	MaxTokensStreaming    = 8192 // Max tokens for ChatStream()
	ThinkingBudget        = 5000 // Extended thinking budget (tokens)

)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaudeProvider

type ClaudeProvider struct {
	// contains filtered or unexported fields
}

ClaudeProvider implements common.Provider for Claude

func NewClaudeProvider

func NewClaudeProvider(config common.ProviderConfig) (*ClaudeProvider, error)

NewClaudeProvider creates a new Claude provider

func (*ClaudeProvider) Chat

func (p *ClaudeProvider) Chat(messages []common.Message, tools []common.Tool, thinkingEnabled bool) (*common.ChatResponse, error)

Chat sends a non-streaming chat request

func (*ClaudeProvider) ChatStream

func (p *ClaudeProvider) ChatStream(messages []common.Message, tools []common.Tool, thinkingEnabled bool, callback common.StreamCallback) (*common.ChatResponse, error)

ChatStream sends a streaming chat request

func (*ClaudeProvider) Close

func (p *ClaudeProvider) Close() error

Close closes any resources

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (*Client, error)

NewClient creates a new Claude client (uses env vars)

func NewClientWithConfig

func NewClientWithConfig(apiKey, model string) (*Client, error)

NewClientWithConfig creates a new Claude client with explicit API key and model

func (*Client) Chat

func (c *Client) Chat(messages []Message, thinkingEnabled bool, tools []Tool) (string, string, []FunctionCallResult, *TokenUsage, error)

Chat sends a non-streaming chat request

func (*Client) ChatStream

func (c *Client) ChatStream(messages []Message, thinkingEnabled bool, tools []Tool, callback StreamCallback) (string, []FunctionCallResult, *TokenUsage, error)

ChatStream sends a streaming chat request

func (*Client) Close

func (c *Client) Close()

Close is a no-op for the Claude client

type FunctionCallData

type FunctionCallData struct {
	ID               string
	Name             string
	Args             map[string]interface{}
	ThoughtSignature []byte
}

type FunctionCallResult

type FunctionCallResult struct {
	ID               string
	Name             string
	Args             map[string]interface{}
	ThoughtSignature []byte
}

type FunctionResponseData

type FunctionResponseData struct {
	ID       string // tool_use_id from the original tool use block
	Name     string
	Response map[string]interface{}
}

type Message

type Message struct {
	Role             string
	Content          string
	ReasoningContent string
	FunctionResponse *FunctionResponseData
	FunctionCalls    []FunctionCallData
}

type StreamCallback

type StreamCallback func(reasoning string, isThought bool)

type TokenUsage

type TokenUsage struct {
	InputTokens  int64
	OutputTokens int64
}

TokenUsage represents token usage information

type Tool

type Tool struct {
	Name        string
	Description string
	InputSchema map[string]interface{}
}

Jump to

Keyboard shortcuts

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