From fc2599144f6d10dca67fc653a5be8ea303d7f3a7 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Mon, 9 Jun 2025 20:44:13 -0400 Subject: [PATCH] Update docs --- docs/patterns/tool-transformation.mdx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/patterns/tool-transformation.mdx b/docs/patterns/tool-transformation.mdx index 304f505eb..b3c85dc65 100644 --- a/docs/patterns/tool-transformation.mdx +++ b/docs/patterns/tool-transformation.mdx @@ -93,7 +93,7 @@ To modify an argument, you need to create an `ArgTransform` object. This object - `type`: The new type for the argument. -Certain combinations of parameters are not allowed. For example, you can only use `default_factory` with `hide=True`, because dynamic defaults cannot be represented in a JSON schema for the client. You can only set required=True +Certain combinations of parameters are not allowed. For example, you can only use `default_factory` with `hide=True`, because dynamic defaults cannot be represented in a JSON schema for the client. You can only set required=True for arguments that do not declare a default value. @@ -182,7 +182,11 @@ Default values are especially useful in combination with hidden arguments. ### Hiding Arguments -Sometimes a tool requires arguments that shouldn't be exposed to the LLM, such as API keys, configuration flags, or internal IDs. You can hide these parameters using `hide=True`. You can only hide arguments that already have a default value, or that you provide a new `default` or `default_factory` for. +Sometimes a tool requires arguments that shouldn't be exposed to the LLM, such as API keys, configuration flags, or internal IDs. You can hide these parameters using `hide=True`. Note that you can only hide arguments that have a default value (or for which you provide a new default), because the LLM can't provide a value at call time. + + +To pass a constant value to the parent tool, combine `hide=True` with `default=`. + ```python {19-20} import os @@ -398,7 +402,7 @@ async def ensure_a_positive(a: int, **kwargs) -> int: new_tool = Tool.from_tool( add, - transform_fn=ensure_positive, + transform_fn=ensure_a_positive, transform_args={ "x": ArgTransform(name="a"), "y": ArgTransform(name="b"),