Urgent.News

What's breaking now, across hundreds of outlets.

AI

Streaming tool_calls on a non-OpenAI upstream

Function calling is the part of the OpenAI contract most likely to break when the model behind the endpoint is not OpenAI's, and the breakage is rarely a clean error. Arguments arrive as fragments, content is null on the turn that emits a call, finish_reason becomes tool_calls instead of stop , and JSON Schema mode may not exist at all. This article walks a complete, runnable tool loop, then the…

Streaming API calls can cause issues when the underlying model is not from OpenAI. The function calling feature in the OpenAI contract is prone to errors in this scenario, with arguments arriving as incomplete fragments and finish_reason switching to tool_calls instead of stop. This article provides a runnable tool loop example, followed by the streaming variant that gathers fragments by index.

The article highlights three main failures that cause most integration issues, as well as the implications when a gateway bill charges tool schemas as input tokens on every turn.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in AI

Foxit’s MCP Server Lets AI Agents Handle PDFs Without the Boilerplate

Anyone who has built a document automation pipeline knows the routine: upload a file, poll for completion, download the result, handle errors, juggle auth tokens.

  • Foxit's MCP Server integrates PDF tools for AI agents.
  • Asynchronous polling simplifies AI agent interactions.
  • eSign and DocGen APIs require separate handling.

More from Tuesday 24 November →