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
- type I18nPrompts
- type Language
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.
Types ¶
type I18nPrompts ¶
I18nPrompts holds prompt strings for different languages.