You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mintlify/reference/camel.toolkits.function_tool.mdx
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -460,3 +460,35 @@ the method will raise :obj:`jsonschema.exceptions.SchemaError`.
460
460
**Parameters:**
461
461
462
462
-**value** (Dict[str, Any]): the new dictionary value for the function's parameters.
463
+
464
+
<aid="camel.toolkits.function_tool.tool"></a>
465
+
466
+
## tool
467
+
468
+
```python
469
+
deftool(func: Optional[Callable] =None):
470
+
```
471
+
472
+
A decorator that converts a Python function into a FunctionTool
473
+
instance.
474
+
475
+
This decorator can be used with or without parentheses:
476
+
-@tool - without parentheses, uses default settings
477
+
-@tool() - with parentheses, uses default settings
478
+
-@tool(synthesize_output=True) - with custom settings
479
+
480
+
**Parameters:**
481
+
482
+
-**func** (Optional[Callable], optional): The function to be decorated. This is automatically passed when using @tool without parentheses. (default: :obj:`None`)
483
+
-**openai_tool_schema** (Optional[Dict[str, Any]], optional): A user-defined OpenAI tool schema to override the default result. (default: :obj:`None`)
484
+
-**synthesize_schema** (bool, optional): Whether to enable schema synthesis. (default: :obj:`False`)
485
+
-**synthesize_schema_model** (Optional[BaseModelBackend], optional): Model to use for schema synthesis. (default: :obj:`None`)
486
+
-**synthesize_schema_max_retries** (int, optional): Maximum number of retries for schema synthesis. (default: :obj:`2`)
487
+
-**synthesize_output** (bool, optional): Whether to enable output synthesis. (default: :obj:`False`)
488
+
-**synthesize_output_model** (Optional[BaseModelBackend], optional): Model to use for output synthesis. (default: :obj:`None`)
489
+
-**synthesize_output_format** (Optional[Type[BaseModel]], optional): Format for synthesized output. (default: :obj:`None`)
490
+
491
+
**Returns:**
492
+
493
+
Callable[[Callable], FunctionTool]: A decorator function that converts
494
+
the decorated function into a FunctionTool instance.
0 commit comments