Documentation
¶
Overview ¶
Package internal provides adk internal utils.
Index ¶
- Constants
- func EnsureMessageID(extra map[string]any) map[string]any
- func GetMessageID(extra map[string]any) string
- func HasToolCall(blocks []*schema.ContentBlock) bool
- func HasToolResult(blocks []*schema.ContentBlock) bool
- func SelectPrompt(prompts I18nPrompts) string
- func SetLanguage(lang Language) error
- func SetMessageID(extra map[string]any, id string) map[string]any
- func SetReminderMessageRole(r ReminderMessageRole) error
- type I18nPrompts
- type Language
- type ReminderMessageRole
Constants ¶
const EinoMsgIDKey = "_eino_msg_id"
EinoMsgIDKey is the Extra key used to store the eino-internal message ID.
Variables ¶
This section is empty.
Functions ¶
func EnsureMessageID ¶ added in v0.9.0
EnsureMessageID assigns a UUID v4 if no message ID is present. Idempotent: if ID already set, no-op. Returns the (possibly newly created) Extra map.
func GetMessageID ¶ added in v0.9.0
GetMessageID returns the message ID from Extra, or "" if not set. Works with any map[string]any (Message.Extra or AgenticMessage.Extra).
func HasToolCall ¶
func HasToolCall(blocks []*schema.ContentBlock) bool
HasToolCall reports whether blocks contain a tool-call protocol block.
func HasToolResult ¶
func HasToolResult(blocks []*schema.ContentBlock) bool
HasToolResult reports whether blocks contain a tool-result protocol block.
func SelectPrompt ¶
func SelectPrompt(prompts I18nPrompts) string
SelectPrompt returns the appropriate prompt string based on the current language setting. Returns an error if the current language is not supported.
func SetLanguage ¶
SetLanguage sets the language for the ADK built-in prompts. The default language is English if not explicitly set.
func SetMessageID ¶ added in v0.9.0
SetMessageID sets the message ID in Extra and returns the resulting map.
Copy-on-write: the input map is never mutated, because a message's Extra can be shared across fan-out stream readers and an in-place write would race with concurrent reads (fatal "concurrent map read and map write"). Reassigning the returned map to a shared Extra field is still a field-level race that cannot be eliminated while Extra is exported; COW only removes the map-level panic.
func SetReminderMessageRole ¶
func SetReminderMessageRole(r ReminderMessageRole) error
SetReminderMessageRole sets the role for mid-conversation reminder messages injected by ADK middlewares. The default is ReminderMessageRoleSystem if not explicitly set.
Types ¶
type I18nPrompts ¶
I18nPrompts holds prompt strings for different languages.
type Language ¶
type Language uint8
Language represents the language setting for the ADK built-in prompts.
type ReminderMessageRole ¶
type ReminderMessageRole uint8
ReminderMessageRole represents the message role used for mid-conversation reminder (system-reminder) messages injected by ADK middlewares.
const ( // ReminderMessageRoleSystem injects reminders as system-role messages (default). ReminderMessageRoleSystem ReminderMessageRole = iota // ReminderMessageRoleUser injects reminders as user-role messages, for models that // reject non-leading system messages. ReminderMessageRoleUser )
func GetReminderMessageRole ¶
func GetReminderMessageRole() ReminderMessageRole
GetReminderMessageRole returns the current role for mid-conversation reminder messages. Returns ReminderMessageRoleSystem if not explicitly set.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agenttool carries ADK-internal AgentTool event-forwarding options shared between AgentTool and middleware plumbing.
|
Package agenttool carries ADK-internal AgentTool event-forwarding options shared between AgentTool and middleware plumbing. |
|
Package foreground coordinates caller-visible task occupancy without owning durable task lifecycle state.
|
Package foreground coordinates caller-visible task occupancy without owning durable task lifecycle state. |
|
Package startwindow coordinates the bounded parent-event relay used while a background managed tool reaches its Start boundary.
|
Package startwindow coordinates the bounded parent-event relay used while a background managed tool reaches its Start boundary. |
|
Package taskcontrol carries process-local controls scoped to one task execution.
|
Package taskcontrol carries process-local controls scoped to one task execution. |