To make it short: Is there any way to use the structured output Parser together with the Streaming API cause the way I use it, it tries to Structure the Output for every snippet so to speek whcih leads to a "Max iterations (10) reached. The agent could not complete the task within the allowed number of iterations.
" error
This issue occurs because the Structured Output Parser attempts to parse each streaming chunk separately. To handle this, you could try collecting the streamed chunks first using a Function node or Code node, then parse the complete output once all chunks are received.
If you’re using OpenAI’s streaming API, consider disabling streaming temporarily when using the Structured Output Parser, or implement a buffer to accumulate chunks before parsing.
This collects all chunks and outputs the complete text when the last chunk is received. You can then feed this complete text to the Structured Output Parser.