fix: fix tool-search in response api - #2434
Open
hustxiayang wants to merge 2 commits into
Open
Conversation
Signed-off-by: yxia216 <yxia216@bloomberg.net>
hustxiayang
marked this pull request as draft
July 27, 2026 19:08
hustxiayang
marked this pull request as ready for review
July 27, 2026 20:13
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (71.42%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2434 +/- ##
==========================================
- Coverage 84.86% 84.81% -0.05%
==========================================
Files 154 154
Lines 22419 22489 +70
==========================================
+ Hits 19026 19075 +49
- Misses 2237 2248 +11
- Partials 1156 1166 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
Currently, ai-gateway did not recognize
tool_search_callandtool_search_outputin responses input/output item unions. This caused two errors:When parsing a response output item for a non-streaming request, ai-gateway can fail a valid upstream response with:
unknown_type_field_value_'tool_search_call'_for_response_output_item_unionThis is because the response output union does not know that type, parsing hits the output-union default error:
ai-gateway/internal/apischema/openai/openai.go
Line 6452 in 6722cca
When parsing a later request that resends prior output items as
input, ai-gateway would reject the request with:cannot unmarshal unknown input type: tool_search_callThis is because response input union does not know that type:ai-gateway/internal/apischema/openai/openai.go
Line 3984 in 6722cca
Fix Add
tool_search_callandtool_search_outputto both unions.Other Schema Items Added:
additional_toolscompaction_triggercomputer_call_outputcustom_tool_call_outputmcp_approval_response