AlinsRan opened a new pull request, #13599:
URL: https://github.com/apache/apisix/pull/13599

   ### Description
   
   In the Anthropic-messages → OpenAI-chat converter, when an OpenAI-compatible 
upstream returns `tool_call` arguments that are **not valid JSON** (or decode 
to a non-object such as a number/string), `convert_response` did `return nil, 
"invalid tool_call arguments: ..."`. This **aborts the entire non-streaming 
response conversion** and drops any already-collected text/thinking content — 
the client receives nothing instead of a partial-but-usable message.
   
   This patch falls back to an empty input object (`{}`) and logs a warning, so 
the rest of the message (text, other tool calls) is still delivered. 
Anthropic's `tool_use.input` must be an object, so non-object decoded values 
are handled the same way as a decode failure.
   
   Added `t/plugin/ai-proxy-anthropic.t` TEST 52 covering malformed 
`arguments`: conversion still returns, text content is preserved, 
`tool_use.input` is an empty object, and a warning is logged.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have verified that this change is backward compatible


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to