gm.tools.ToolHandlerBase

gm.tools.ToolHandlerBase#

class gemma.gm.tools.ToolHandlerBase[source]

Bases: etils.epy.contextlib.ContextManager, abc.ABC

Base class to orchestrate tools.

is_active: bool = False
add_system_prompt(
prompt: dialog._src.conversation.Conversation,
) dialog._src.conversation.Conversation[source]

Returns the system prompt.

maybe_execute_tool(
model_output: str,
) list[dialog._src.conversation.ToolResponse] | None[source]

Parses the model output answer and call the associated tool if needed.

property tools: list[mcp.types.Tool]

Returns the tools.

call_tool(
name: str,
arguments: dict[str, Any],
) Any[source]

Calls the tool.