Commit 09bea08
committed
feat: add generate_object tool for structured JSON output
Add a built-in `generate_object` tool that produces schema-validated JSON
objects from any LLM provider. Features:
- Four output modes: tool-call (default), prompt, strict, json
- Robust JSON extraction from dirty LLM output (code fences, prose)
- Streaming partial objects via tool_output_delta events
- Automatic repair loop with schema validation feedback
- Built-in JSON Schema validator (anyOf/oneOf, nullable, pattern, ranges)
- Cross-provider: works with Anthropic, OpenAI, and OpenAI-compatible APIs
Includes 70 unit tests + 4 integration tests against real MiniMax API,
Node.js SDK integration test (6 cases), and Python SDK integration test
(6 cases).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8eaf24f commit 09bea08
19 files changed
Lines changed: 3058 additions & 31 deletions
File tree
- core
- src
- agent_api
- llm
- tools
- builtin
- sdk
- node
- examples
- basic
- python
- examples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
10 | 32 | | |
11 | 33 | | |
12 | 34 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
0 commit comments