Hi Fedir Tykhonov,
Yes, Azure OpenAI Assistants API (Preview) and Azure AI Agents Service both support structured outputs even when the Code Interpreter tool is used. You can define function tools alongside the Python tool and the assistant will invoke them as needed.
Let us see how to Use Both (Code Interpreter + Structured Output):
Option A: Azure OpenAI Assistants API (Preview)
Use the Assistants API like this:
{
"assistant_id": "...",
"thread": {
"messages": [
{
"role": "user",
"content": "Can you calculate something and return results in a structured way?",
"tool_choice": "auto"
}
]
}
}
Your assistant can have both:
· A function (for structured output)
· The code_interpreter tool
And it will decide when to use which.
Option B: Azure AI Studio (Agents)
· Build an agent in Azure AI Studio.
· Add:
o Code Interpreter (Python Tool)
o Function tool (with a defined schema)
· The agent can use Python to calculate and then return via a structured schema you provide.
Hope this helps, do let me know if you have any further queries.
Thank you!