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
The project follows a slightly modified version of semantic versioning using the form `0.Y.Z`. The leading `0` indicates the SDK is still evolving rapidly. Increment the components as follows:
4
+
5
+
## Minor (`Y`) versions
6
+
7
+
We will increase minor versions `Y` for **breaking changes** to any public interfaces that are not marked as beta. For example, going from `0.0.x` to `0.1.x` might include breaking changes.
8
+
9
+
If you don't want breaking changes, we recommend pinning to `0.0.x` versions in your project.
# Scan the agent’s outputs in reverse order until we find a JSON-like message from a tool call.
300
+
for item inreversed(run_result.new_items):
301
+
ifisinstance(item, ToolCallOutputItem) and item.output.strip().startswith("{"):
302
+
return item.output.strip()
303
+
# Fallback to an empty JSON object if nothing was found
304
+
return"{}"
305
+
306
+
307
+
json_tool = data_agent.as_tool(
308
+
tool_name="get_data_json",
309
+
tool_description="Run the data agent and return only its JSON payload",
310
+
custom_output_extractor=extract_json_payload,
311
+
)
312
+
```
313
+
287
314
## Handling errors in function tools
288
315
289
316
When you create a function tool via `@function_tool`, you can pass a `failure_error_function`. This is a function that provides an error response to the LLM in case the tool call crashes.
0 commit comments