feat(groq): parse executed_tools → metadata.builtInToolResults (#69 S5)#73
Merged
Merged
Conversation
Surfaces Groq's server-side built-in tool results on the response, completing
the citation path the S4 docs described.
- formatResponse maps message.executed_tools[] → metadata.builtInToolResults
(Array<{ type, name?, arguments?, results: [{title,url,content,score}] }>),
using the S0-locked rule: keep only executions with a non-empty
search_results.results, flatten them, preserve per-execution type/name/
arguments. Non-search runs (code_interpreter) carry no citations and drop
out by design; the field is omitted entirely when no search ran.
- message.reasoning (the model's internal search queries, present on both
families) surfaces on metadata.reasoning when present.
- GROQ_RESPONSE_SCHEMA gains an optional, deliberately SHALLOW executed_tools
entry (validates `type` only). Citation sub-fields are left unguarded:
SchemaDriftError routes through the fallback chain to a host that doesn't
run built-in tools, so a false drift on a single-sampled sub-field would
silently degrade a working search into a tool-less response. The parser
soft-degrades instead; citation-field coverage is a parser unit test (the
binding review note's accepted alternative to a deep fixture).
Docs corrected (not just added): the S4 README/CHANGELOG line that said result
parsing was "being wired in a follow-up" is now flipped to live, with a
metadata.reasoning note and a citations usage snippet.
typecheck clean; 402 tests pass (+4: compound flatten with all four citation
fields asserted, gpt-oss search-only filtering + name preservation, empty/no
executed_tools omission). schema-canary suite green (existing tool_calls
responses still validate under the extended interface).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements S5 of the Groq built-in-tools sprint (#69), on top of the merged S4 adapter (#72). This completes the end-to-end citation path the S4 docs described.
What
formatResponsenow parsesmessage.executed_tools[]→LLMResponse.metadata.builtInToolResults:Parsing follows the S0-locked wire shape (
executed_tools[].search_results.results[], results{title,url,content,score}):search_results.results;results, preserving per-executiontype/name/arguments;code_interpreter) carry no citations and drop out by design; the field is omitted entirely when no search ran.Also surfaces
message.reasoning(the model's internal search queries, present on both families) onmetadata.reasoningwhen present.Schema: deliberately shallow
GROQ_RESPONSE_SCHEMAgains an optionalexecuted_toolsentry that validates onlytype. Citation sub-fields are intentionally not guarded:Citation-field coverage lives in a parser unit test — the binding review note's explicitly-accepted alternative to a deep fixture (the committed shape-map fixtures are depth-truncated at
search_results, the caveat flagged on #70).Docs corrected, not just added
The S4 README/CHANGELOG line saying result parsing was "being wired in a follow-up" is now flipped to live, with a
metadata.reasoningnote and a citations usage snippet.Tests
typecheck clean; 402 pass (+4): compound flatten with all four citation fields asserted directly, gpt-oss search-only filtering +
namepreservation, empty-results and no-executed_toolsomission. schema-canary suite green — existingtool_callsresponses still validate under the extended interface.Sprint status: S0–S2 (#70), S3 (#71), S4 (#72) merged. This is S5. Remaining: S6 — round-out tests (request-shape parity already covered),
CreditLedgerdoc note on surcharge non-attribution, and any final doc polish.🤖 Generated with Claude Code