Documentation
¶
Index ¶
- func LevelToBudgetTokens(level string) int
- type CacheControl
- type Content
- type ContentPart
- type Delta
- type ImageSource
- type Message
- type MultimodalMessage
- type MultimodalRequest
- type Provider
- func (p *Provider) ChatWithImage(ctx context.Context, systemPrompt string, history []api.Message, ...) (string, error)
- func (p *Provider) ChatWithTools(ctx context.Context, systemPrompt string, history []api.Message, model string) (string, error)
- func (p *Provider) Name() string
- func (p *Provider) SupportsImages() bool
- type Request
- type Response
- type StreamEvent
- type SystemBlock
- type ThinkingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LevelToBudgetTokens ¶
LevelToBudgetTokens は api.LevelToBudgetTokens のエイリアス(後方互換)
Types ¶
type CacheControl ¶
type CacheControl struct {
Type string `json:"type"` // e.g. "ephemeral"
}
CacheControl enables prompt caching for a content block.
This is gated by config.PromptCache.Enabled and disabled by default. If the upstream schema changes, requests may fail; keep the feature optional.
type ContentPart ¶
type ContentPart struct {
Type string `json:"type"` // "text" or "image"
Text string `json:"text,omitempty"` // type="text"の場合
Source *ImageSource `json:"source,omitempty"` // type="image"の場合
}
ContentPart はマルチモーダルコンテンツのパート
type ImageSource ¶
type ImageSource struct {
Type string `json:"type"` // "base64"
MediaType string `json:"media_type"` // "image/png", "image/jpeg" etc
Data string `json:"data"` // Base64エンコードされたデータ
}
ImageSource は画像ソース
type MultimodalMessage ¶
type MultimodalMessage struct {
Role string `json:"role"`
Content []ContentPart `json:"content"`
}
MultimodalMessage はマルチモーダルメッセージ(画像含む)
type MultimodalRequest ¶
type MultimodalRequest struct {
Model string `json:"model"`
Messages []interface{} `json:"messages"` // Message or MultimodalMessage
// System can be either string (legacy) or []SystemBlock (prompt caching).
System interface{} `json:"system,omitempty"`
MaxTokens int `json:"max_tokens"`
Stream bool `json:"stream"`
Thinking *ThinkingConfig `json:"thinking,omitempty"`
}
MultimodalRequest はマルチモーダルAPIリクエスト
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider はClaude (Anthropic) APIのプロバイダー実装
func (*Provider) ChatWithImage ¶
func (p *Provider) ChatWithImage(ctx context.Context, systemPrompt string, history []api.Message, userMessage string, image *api.ImageData, model string) (string, error)
ChatWithImage は画像付きメッセージで会話を行う
func (*Provider) ChatWithTools ¶
func (p *Provider) ChatWithTools(ctx context.Context, systemPrompt string, history []api.Message, model string) (string, error)
ChatWithTools は Provider interface の実装(context対応)
func (*Provider) SupportsImages ¶
SupportsImages は画像入力対応を返す
type Request ¶
type Request struct {
Model string `json:"model"`
Messages []Message `json:"messages"`
// System can be either string (legacy) or []SystemBlock (prompt caching).
System interface{} `json:"system,omitempty"`
MaxTokens int `json:"max_tokens"`
Stream bool `json:"stream"`
Thinking *ThinkingConfig `json:"thinking,omitempty"`
}
type StreamEvent ¶
StreamEvent はストリームイベント
type SystemBlock ¶
type SystemBlock struct {
Type string `json:"type"` // "text"
Text string `json:"text"`
CacheControl *CacheControl `json:"cache_control,omitempty"`
}
SystemBlock represents a system prompt content block.
When prompt caching is enabled, we send system as an array of blocks instead of a string.
type ThinkingConfig ¶
type ThinkingConfig struct {
Type string `json:"type"` // "enabled"
BudgetTokens int `json:"budget_tokens"` // min 1024
}
ThinkingConfig は Extended Thinking の設定