The SDK now separates the text used for structured-output parsing from the complete response.
OpenAI Responses can emit multiple assistant messages containing JSON. Joining them can break parsing even when the final answer is valid. This patch lets OpenAI and Azure Responses models select the last message marked final_answer for non-streaming parsing while retaining generated content, annotations, conversation history and token accounting.
Evidence & limits. The release and linked code change document the fix and added tests. The change covers generateText, generateObject and related middleware; streaming is unchanged. We inspected the implementation evidence, but did not run the tests or establish how often this failure occurs in production.
Keep the answer-selection contract separate from the audit record. Add a regression fixture with commentary JSON followed by final-answer JSON, then check both parsed output and preserved history. Do not “fix” parsing by deleting evidence.