Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Content ¶ added in v0.7.0
type Content struct {
Raw string
Structured []ContentBlock
}
Content holds a message's content — either plain text or a list of multimodal blocks.
func (Content) MarshalJSON ¶ added in v0.7.0
MarshalJSON serialises back to the original format.
func (Content) PlainText ¶ added in v0.7.0
PlainText returns the plain text content, concatenating text blocks for multimodal messages.
func (*Content) UnmarshalJSON ¶ added in v0.7.0
UnmarshalJSON handles both the plain-string and block-list formats.
type ContentBlock ¶ added in v0.7.0
type ContentBlock struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
ImageURL ImageBlock `json:"image_url,omitempty"`
}
ContentBlock represents a single part of a multimodal message.
type Conversation ¶
type Conversation struct {
Role string `json:"role"`
Content Content `json:"content"`
ToolCalls []interface{} `json:"tool_calls,omitempty"`
}
Conversation represents a single message in a conversation.
type ImageBlock ¶ added in v0.7.0
type ImageBlock struct {
URL string `json:"url,omitempty"`
}
ImageBlock represents the image_url field in a multimodal content block.
type Offset ¶
type Offset [2]uint
Offset represents a character offset range with [start, end] indices.
type RenderChatRequest ¶
type RenderChatRequest struct {
// The Python wrapper will handle converting this to a batched list if needed.
Key string `json:"key"`
Conversation []Conversation `json:"conversation"`
Tools []interface{} `json:"tools,omitempty"`
Documents []interface{} `json:"documents,omitempty"`
ChatTemplate string `json:"chat_template,omitempty"`
ReturnAssistantTokensMask bool `json:"return_assistant_tokens_mask,omitempty"`
ContinueFinalMessage bool `json:"continue_final_message,omitempty"`
AddGenerationPrompt bool `json:"add_generation_prompt,omitempty"`
TruncatePromptTokens *int `json:"truncate_prompt_tokens,omitempty"`
ChatTemplateKWArgs map[string]interface{} `json:"chat_template_kwargs,omitempty"`
}
RenderChatRequest represents the request to render a chat template.
func (*RenderChatRequest) DeepCopy ¶
func (req *RenderChatRequest) DeepCopy() (*RenderChatRequest, error)
DeepCopy creates a deep copy of the RenderChatRequest.
type RenderRequest ¶
type RenderRequest struct {
Key string `json:"key"`
Text string `json:"text"`
AddSpecialTokens bool `json:"add_special_tokens,omitempty"`
}
func (*RenderRequest) DeepCopy ¶
func (req *RenderRequest) DeepCopy() (*RenderRequest, error)
DeepCopy creates a deep copy of the RenderRequest.