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

Descrepancy results AsyncAzureOpenAI.azure_deployment and client.chat.completions.create(model) #1868

Open
1 task done
woutkonings opened this issue Nov 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@woutkonings
Copy link

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

When running the AzureOpenAI service with azure_deployment gpt-4o 2024-05-13 I get very different completion results when I enter model='gpt-4' and model='gpt-4o'.
I would expect the model parameter not to matter in this case, as there is only one model to choose from the given deployment.

To Reproduce

Run and observe stream:

async with AsyncAzureOpenAI(
        api_key=openai_api_key,
        azure_deployment=deployment_model,
        azure_endpoint=openai_azure_endpoint,
        api_version="2023-12-01-preview"
    ) as client:
        openai_stream = await client.chat.completions.create(
            model=model_name,
            messages=messages,
            temperature=0.2,
            max_tokens=1200,
            top_p=0.45,
            frequency_penalty=0,
            presence_penalty=0,
            stop=None,
            stream=True
        )

twice:

  • azure_deployment='gpt-4o-0513', model_name='gpt-4'
  • azure_deployment='gpt-4o-0513', model_name='gpt-4o'

The first deployment will give markdown heavy response, structured with bold titles etc., while the second response will give solely paragraphs.

Code snippets

No response

OS

python:3.12-slim

Python version

python v.3.12

Library version

openai v.1.51.2

@woutkonings woutkonings added the bug Something isn't working label Nov 14, 2024
@kristapratico
Copy link
Contributor

@woutkonings when passing azure_deployment into the AsyncAzureOpenAI constructor, the client will use that deployment for all requests. Any value provided for model will be ignored.

For chat completions, you can try adjusting temperature or provide a seed to get more deterministic results, but it is not guaranteed. Here's some docs that explain those two parameters: https://learn.microsoft.com/azure/ai-services/openai/reference-preview#createchatcompletionrequest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants