Skip to content

Fixing ChatCompletionsClinet call#3910

Merged
lorenzejay merged 9 commits intocrewAIInc:mainfrom
Vidit-Ostwal:vo/fix/azure-ChatCompletionsClient
Nov 29, 2025
Merged

Fixing ChatCompletionsClinet call#3910
lorenzejay merged 9 commits intocrewAIInc:mainfrom
Vidit-Ostwal:vo/fix/azure-ChatCompletionsClient

Conversation

@Vidit-Ostwal
Copy link
Copy Markdown
Contributor

@Vidit-Ostwal Vidit-Ostwal commented Nov 13, 2025

Fixes #3906

Structured Output: https://learn.microsoft.com/en-us/azure/ai-foundry/foundry-models/how-to/use-structured-outputs?utm_source=chatgpt.com&pivots=programming-language-python#use-structured-outputs-1

JsonSchemaFormat Class https://learn.microsoft.com/en-us/python/api/azure-ai-inference/azure.ai.inference.models.jsonschemaformat?view=azure-python-preview


Note

Switches Azure completion to build structured outputs using the SDK’s JsonSchemaFormat derived from generate_model_description.

  • Azure AI Inference provider (crewai/llms/providers/azure/completion.py):
    • Structured outputs: Replace dict-based response_format with Azure SDK JsonSchemaFormat, constructed via generate_model_description for OpenAI models.
    • Imports: Add JsonSchemaFormat and generate_model_description.

Written by Cursor Bugbot for commit f14c89b. This will update automatically on new commits. Configure here.

@LouisLecouturier
Copy link
Copy Markdown

Hey, thanks again for the fix !
Do you have an idea of when it will be in main ?

@Vidit-Ostwal
Copy link
Copy Markdown
Contributor Author

Hey, thanks again for the fix !
Do you have an idea of when it will be in main ?

Tagging @greysonlalonde, @lorenzejay for a quick review!

@LouisLecouturier
Copy link
Copy Markdown

Thanks, @lorenzejay @greysonlalonde the library is not usable with Azure AI Foundry without this PR

@Vidit-Ostwal
Copy link
Copy Markdown
Contributor Author

Fixes #3986

Copy link
Copy Markdown
Contributor

@greysonlalonde greysonlalonde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Vidit-Ostwal 🥇

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@lorenzejay
Copy link
Copy Markdown
Collaborator

nice work !
Screenshot 2025-11-28 at 5 17 38 PM

@lorenzejay lorenzejay merged commit 37526c6 into crewAIInc:main Nov 29, 2025
42 checks passed
@Vidit-Ostwal Vidit-Ostwal deleted the vo/fix/azure-ChatCompletionsClient branch November 29, 2025 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] CrewAI >= 1.4.0 - Structured outputs no longer working with azure models

4 participants