Commit 3824708
committed
feat(agency): robust structured output with brace-matched JSON extraction and validation retries
parseStructuredOutput now:
- Tries direct JSON parse (happy path)
- Strips markdown code fences (```json ... ```)
- Falls back to brace-matched extraction that walks the string respecting
quote and escape state, so nested braces in string values and trailing
commentary after a valid JSON object no longer break parsing
Agency execute() now retries validation failures:
- New controls.maxValidationRetries field (default 1)
- When opts.output is set and parsed is undefined, retry the generation
with an error-feedback hint appended to the prompt so the model can
self-correct
Fixes the class of failures where providers return valid JSON followed
by commentary.1 parent 067a554 commit 3824708
60 files changed
Lines changed: 1538 additions & 90 deletions
File tree
- dist
- api
- runtime
- media/images
- providers
- memory
- core
- prompt
- pipeline/observation
- retrieval/store
- voice-pipeline
- providers
- src/api
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
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 | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
58 | 82 | | |
59 | 83 | | |
60 | 84 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments