Skip to content

Commit 03f848e

Browse files
allow api_version to be set by environment variable (openai#438)
1 parent f24d193 commit 03f848e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

openai/__init__.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@
4848
organization = os.environ.get("OPENAI_ORGANIZATION")
4949
api_base = os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1")
5050
api_type = os.environ.get("OPENAI_API_TYPE", "open_ai")
51-
api_version = (
52-
"2023-03-15-preview" if api_type in ("azure", "azure_ad", "azuread") else None
51+
api_version = os.environ.get(
52+
"OPENAI_API_VERSION",
53+
("2023-03-15-preview" if api_type in ("azure", "azure_ad", "azuread") else None),
5354
)
5455
verify_ssl_certs = True # No effect. Certificates are always verified.
5556
proxy = None

0 commit comments

Comments
 (0)