-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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
The Azure AsyncAzureOpenAI
class has a single parameter to set the deployment name azure_deployment
.
A common situation is to have an embeddings model deployment and a chat model deployment. In the calls for embeddings.create()
and chat.completions.create()
there is no parameter to set the deployment name.
What this means is you need to create multiple clients for each deployment you want to use.
To Reproduce
openai_client = AsyncAzureOpenAI(
api_version="2023-07-01-preview",
azure_endpoint=f"https://{AZURE_OPENAI_SERVICE}.openai.azure.com",
azure_ad_token_provider=token_provider,
organization=OPENAI_ORGANIZATION,
azure_deployment='?', # A single parameter for the whole client?
)
# No parameter for the chat deployment name?
await openai_client.chat.completions.create(
model='gpt-35-turbo',
messages=messages,
temperature=0.0,
max_tokens=100,
n=1,
functions=functions,
function_call="auto",
)
# No deployment name parameter?
await openai_client.embeddings.create(model=embedding_model, input=query_text)
Without the deployment name being correct, calls to the embeddings API give an error message
Code snippets
No response
OS
macOS
Python version
Python 3.11.1
Library version
1.3.6
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working