Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatResponse ¶
type ContentPart ¶
type ContentPart struct {
Type string `json:"type"` // "text", "image_url", "video_url", "audio_url", "file"
Text string `json:"text,omitempty"`
ImageURL *MediaURL `json:"image_url,omitempty"`
VideoURL *MediaURL `json:"video_url,omitempty"`
AudioURL *MediaURL `json:"audio_url,omitempty"`
File *FileInfo `json:"file,omitempty"`
}
ContentPart represents a part of a multimodal message content
type FileInfo ¶
type FileInfo struct {
Name string `json:"name,omitempty"`
MimeType string `json:"mime_type,omitempty"`
URL string `json:"url,omitempty"`
Size int64 `json:"size,omitempty"`
}
FileInfo represents file metadata
type MediaURL ¶
type MediaURL struct {
URL string `json:"url"`
Detail string `json:"detail,omitempty"` // "auto", "low", "high" (for images)
}
MediaURL represents a URL with optional detail level (for images)
type Message ¶
type Message struct {
ID string `json:"id,omitempty"`
Role string `json:"role"`
Content string `json:"content"`
// 多模态内容,非空时优先于 Content
ContentParts []ContentPart `json:"content_parts,omitempty"`
ChannelID string `json:"channel_id,omitempty"`
From string `json:"from,omitempty"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"` // Required for tool role messages
}
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Arguments map[string]interface{} `json:"arguments"`
// 兼容旧代码
Type string `json:"type,omitempty"`
Function Function `json:"function,omitempty"`
}
func (*ToolCall) GetToolName ¶ added in v0.4.7
GetToolName returns the tool name, trying Function.Name first, then falling back to Name. This handles inconsistencies across different providers where some set Function.Name and others set only the top-level Name field.
Click to show internal directories.
Click to hide internal directories.