05 Custom Tool#
Script: example/05_custom_tool.py.
This script implements a deterministic calculator by subclassing FlowToolCall. The model chooses when to call it; the tool itself is local Python code.
python example/05_custom_tool.py
Method/member |
Role |
|---|---|
|
OpenAI function tool name. |
|
Model-visible tool description. |
|
JSON Schema, generated from a Pydantic model. |
|
Runtime execution. |
|
Lets the async runtime group this pure tool separately. |
The script avoids eval; it parses arithmetic with ast and a small operator whitelist.