render_tool_description#
Build typed tools from annotations and docstrings. See the guide.
- zett_agent.tools.base.render_tool_description(tool, *, snippet=True, guidelines=True, base=None)[源代码]#
Return a tool description that carries its snippet and guidelines.
Some endpoints show the model only a tool's
description, and a deferred tool reaches the model through tool search with no system prompt beside it. Folding the guidance into the description keeps it next to the tool in both cases. The result is the plain description when the tool has nothing to add, so it is safe to call for every tool.- 参数:
tool (AgentTool) -- Tool whose metadata is rendered.
snippet (bool) -- Include the
Snippetsection when the tool has one.guidelines (bool) -- Include the
Guidelinessection when the tool has any.base (str | None) -- Text to put the sections after, instead of
tool.description. Extensions that each add to a request's descriptions pass the text they received, so one does not overwrite what another appended.
- 返回类型:
str
示例
Render everything the model should know in one string:
text = render_tool_description(read_file)