Skip to content
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

Issue with Azure OpenAI Model in HackerNews Team Example #1851

Open
PankajDeck opened this issue Jan 22, 2025 · 1 comment
Open

Issue with Azure OpenAI Model in HackerNews Team Example #1851

PankajDeck opened this issue Jan 22, 2025 · 1 comment

Comments

@PankajDeck
Copy link

I have used the Azure OpenAI model as follows in cookbook/teams/01_hn_team.py example:

from phi.model.azure import AzureOpenAIChat

azure_model = AzureOpenAIChat(
    id="gpt4o",
    api_version="2024-08-01-preview",
    azure_endpoint="https://xxx-eus.openai.azure.com/",
    api_key="azure api key",
    azure_deployment="gpt-4o"
)

I then pass azure_model as a model parameter in each Agent.

Problem:
The provided example in HackerNews Team (cookbook/teams/01_hn_team.py) does not work with the Azure OpenAI model, and I receive the following error:

Error code: 400 - {'error': {'message': "'messages' must contain the word 'json' in some form, to use 'response_format' of type 'json_object'.", 'type': 'invalid_request_error', 'param': 'messages', 'code': None}}
  • Does the Azure OpenAI model require a different format for messages to support response_format='json_object'?
  • Are there any known workarounds or modifications needed to make this example work with Azure OpenAI?

Would appreciate any insights or fixes! Thanks in advance.

@ysolanky
Copy link
Contributor

Hello @PankajDeck ! You will need to use separate instances of AzureOpenAIChat with each Agent.

This issue arrises as for hn_team, we are providing a response_model but not for the other Agents.

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

No branches or pull requests

2 participants