-
Notifications
You must be signed in to change notification settings - Fork 922
Issues using non-"OpenAIModel" models with Azure AI Foundry #1808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@schmidt-marvin It's a bit confusing, but model classes implement specific APIs, and provider classes implement API base URLs and authentication. So in, your case, no matter which actual model you're using, you'd want to use the The only issue you may run into is that while the Azure API is OpenAI-compatible, not all models have the same requirements of e.g. tool JSON schemas as OpenAI's do. So if it doesn't work right, you'd need to override the JSON schema transformation. We don't have a clean solution for that yet, but are designing one in #1782. If you run into issues with AzureProvider + OpenAIModel + Mistral-Large-2411, let us know and we can help you work around them. |
Ah, I see - Thank you so much for the swift response and explanation! |
@DouweM Related to this, am I right in understanding that the Azure AI Inference library which we are now starting to use instead of the OpenAI library with the AzureOpenAI provider is then a different This python package seems to be a bit different from the AzureOpenAI package and I think might have a slightly different url with Seems Microsoft is keen we use this Python library now. Here's a link in case it hasn't crossed your radar. Thanks https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-inference |
@ttamg Using a different SDK would require a new Model class, which (as you can see from OpenAIModel) is quite a bit of work to build and maintain as we add new features to PydanticAI. So if a provider has an OpenAI-compatible API that works with the OpenAI SDK, we prefer using the existing OpenAIModel and just adding a Provider class that sets a base URL and handles authentication (like the existing AzureProvider) instead of adding a whole new Model. If Microsoft is pushing in that direction and their OpenAI-compatible API will start falling behind, we'll have to do that at some point, but for the moment I'm hoping all the providers keep seeing the value of being OpenAI-compatible which saves us a bunch of work. |
Question
✅ Question / request still persists on most up-to-date version of PydanticAI.
✅ I checked open/closed issues and pull requests before opening this issue.
Problem description
Hey everyone! This is the first issue I'm opening, so pardon any rookie mistakes on the style / reporting side.
Within my application, I want to support various different LLMs hosted within Azure AI Foundry. For
OpenAIModels
(eg. gpt-4.1), this works really well following the examples from your documentation page on Azure AI Foundry.I am however having issues using other models. Most of my testing was on the
Mistral-Large-2411
model, so I'll just describe my issue implementing this model.I assumed that usage of
MistralModel
andMistralProvider
are required for using this particular model. As a reference, I used the template from #1617:(Notes: XXX is the project name which I redacted here; The endpoint, as well as model names are known-good and work in a separate implementation not based on PydanticAI.)
The result to using it like this yields a
HTTPValidationError
:Stack trace here
Related issues
This request is similar to #940 which has been closed.
Question
llama-3-3-70B
, how am I able to find a reference on how to use them? I wasn't able to find aLlamaModel
orMetaModel
or something similar.Additional Context
No response
The text was updated successfully, but these errors were encountered: