Jeremiah Lowin commited on
Commit
0b08fee
·
1 Parent(s): 79436d0

Update docs

Browse files
docs/patterns/tool-transformation.mdx CHANGED
@@ -93,7 +93,7 @@ To modify an argument, you need to create an `ArgTransform` object. This object
93
  - `type`: The new type for the argument.
94
 
95
  <Tip>
96
- 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
97
  </Tip>
98
 
99
 
@@ -182,7 +182,11 @@ Default values are especially useful in combination with hidden arguments.
182
 
183
  ### Hiding Arguments
184
 
185
- 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.
 
 
 
 
186
 
187
  ```python {19-20}
188
  import os
@@ -398,7 +402,7 @@ async def ensure_a_positive(a: int, **kwargs) -> int:
398
 
399
  new_tool = Tool.from_tool(
400
  add,
401
- transform_fn=ensure_positive,
402
  transform_args={
403
  "x": ArgTransform(name="a"),
404
  "y": ArgTransform(name="b"),
 
93
  - `type`: The new type for the argument.
94
 
95
  <Tip>
96
+ 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.
97
  </Tip>
98
 
99
 
 
182
 
183
  ### Hiding Arguments
184
 
185
+ 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.
186
+
187
+ <Tip>
188
+ To pass a constant value to the parent tool, combine `hide=True` with `default=<value>`.
189
+ </Tip>
190
 
191
  ```python {19-20}
192
  import os
 
402
 
403
  new_tool = Tool.from_tool(
404
  add,
405
+ transform_fn=ensure_a_positive,
406
  transform_args={
407
  "x": ArgTransform(name="a"),
408
  "y": ArgTransform(name="b"),