Documentation
¶
Index ¶
- Constants
- Variables
- type Payload
- type Prompt
- func AsAssistant(text string) Prompt
- func AsAssistantWithReplay(text string, replay []byte) Prompt
- func AsRedactedThinking(data []byte) Prompt
- func AsThinking(text string, replay []byte, id string) Prompt
- func AsToolCall(toolCallID, functionName string, functionArg []byte) Prompt
- func AsToolCallWithReplay(toolCallID, functionName string, functionArg, replay []byte) Prompt
- func AsToolResponse(toolCallID, functionName string, response string) Prompt
- func AsUser(text string) Prompt
- func AsUserWithData(mime string, data []byte) Prompt
- func AsUserWithURI(mime string, uri string) Prompt
- type Role
- type ThinkingContent
- type ToolCall
- type ToolResponse
Constants ¶
View Source
const AssistantRole = Role("assistant")
View Source
const MimeApplicationPDF = "application/pdf"
View Source
const MimeAudioMP3 = "audio/mp3"
View Source
const MimeAudioMPEG = "audio/mpeg"
View Source
const MimeAudioWAV = "audio/wav"
View Source
const MimeImageJPEG = "image/jpeg"
View Source
const MimeImagePNG = "image/png"
View Source
const MimeImageWebp = "image/webp"
View Source
const MimeTextPlain = "text/plain"
View Source
const MimeVideoAVI = "video/avi"
View Source
const MimeVideoFLV = "video/flv"
View Source
const MimeVideoMOV = "video/mov"
View Source
const MimeVideoMP4 = "video/mp4"
View Source
const MimeVideoMPEG = "video/mpeg"
View Source
const MimeVideoMPEGS = "video/mpegps"
View Source
const MimeVideoMPG = "video/mpg"
View Source
const MimeVideoWMV = "video/wmv"
View Source
const ThinkingRole = Role("thinking")
View Source
const ToolCallRole = Role("tool-call")
View Source
const ToolResponseRole = Role("tool-resp")
View Source
const UserRole = Role("user")
Variables ¶
View Source
var MIMEAudio map[string]bool = map[string]bool{ MimeAudioMPEG: true, MimeAudioMP3: true, MimeAudioWAV: true, }
View Source
var MIMEImages map[string]bool = map[string]bool{ MimeImagePNG: true, MimeImageJPEG: true, MimeImageWebp: true, }
View Source
var MIMEVideo map[string]bool = map[string]bool{ MimeVideoMOV: true, MimeVideoMPEG: true, MimeVideoMP4: true, MimeVideoMPG: true, MimeVideoAVI: true, MimeVideoWMV: true, MimeVideoMPEGS: true, MimeVideoFLV: true, }
Functions ¶
This section is empty.
Types ¶
type Prompt ¶
type Prompt struct {
Role Role `json:"role"`
Text string `json:"text,omitempty"`
Payload *Payload `json:"payload,omitempty"`
ToolCall *ToolCall `json:"tool_call,omitempty"`
ToolResponse *ToolResponse `json:"tool_response,omitempty"`
Thinking *ThinkingContent `json:"thinking,omitempty"`
// Replay is opaque per-provider bytes that must be echoed back verbatim
// on the next request for the provider to accept the turn. Depending on
// provider and role this is a signature (Anthropic thinking MAC, Gemini
// thoughtSignature) or a ciphertext blob (Anthropic redacted_thinking
// data, OpenAI reasoning.encrypted_content). Callers shouldn't inspect
// or construct it — just round-trip the value from Response.Turn.
Replay []byte `json:"replay,omitempty"`
}
func AsAssistant ¶
func AsAssistantWithReplay ¶ added in v1.0.17
func AsRedactedThinking ¶ added in v1.0.17
AsRedactedThinking builds a thinking prompt whose content the provider has chosen not to disclose. data is the opaque ciphertext blob the provider returned (Anthropic's redacted_thinking.data); it must be echoed back verbatim via Prompt.Replay for the turn to be accepted.
func AsToolCall ¶ added in v0.10.0
func AsToolCallWithReplay ¶ added in v1.0.17
func AsToolResponse ¶ added in v0.10.0
func AsUserWithData ¶ added in v0.0.2
func AsUserWithURI ¶ added in v0.7.0
type ThinkingContent ¶ added in v1.0.17
type ThinkingContent struct {
Text string `json:"text,omitempty"`
ID string `json:"id,omitempty"`
Redacted bool `json:"redacted,omitempty"`
}
ThinkingContent is the payload attached to a Prompt with Role==ThinkingRole. The opaque replay bytes live on the wrapping Prompt.Replay field.
type ToolResponse ¶ added in v0.10.0
Click to show internal directories.
Click to hide internal directories.