Skip to content

ValueError for missing api_version when calling with_options() on an (Async)AzureOpenAI client instance #779

@gleason-m

Description

@gleason-m

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

Calling with_options() on an AzureOpenAI or AsyncAzureOpenAI client instance throws a ValueError exception:

ValueError: Must provide either the api_version argument or the OPENAI_API_VERSION environment variable

To Reproduce

Initialize an AzureOpenAI client and call with_options() on it.

Code snippets

from openai import AsyncAzureOpenAI

client = AsyncAzureOpenAI(
    azure_endpoint="",
    api_key="mykey",
    api_version="2023-07-01-preview",
)

copied_client = client.with_options(timeout=30)

OS

ubuntu 22.04

Python version

v3.10.12

Library version

opeanai v1.1.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions