forked from openai/openai-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
87 lines (80 loc) · 2.05 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# OpenAI Python bindings.
#
# Originally forked from the MIT-licensed Stripe Python bindings.
import os
from contextvars import ContextVar
from typing import Optional, TYPE_CHECKING
from openai.api_resources import (
Answer,
Classification,
Completion,
Customer,
Edit,
Deployment,
Embedding,
Engine,
ErrorObject,
File,
FineTune,
Image,
Model,
Moderation,
Search,
)
from openai.error import APIError, InvalidRequestError, OpenAIError
if TYPE_CHECKING:
from aiohttp import ClientSession
api_key = os.environ.get("OPENAI_API_KEY")
# Path of a file with an API key, whose contents can change. Supercedes
# `api_key` if set. The main use case is volume-mounted Kubernetes secrets,
# which are updated automatically.
api_key_path: Optional[str] = os.environ.get("OPENAI_API_KEY_PATH")
organization = os.environ.get("OPENAI_ORGANIZATION")
api_base = os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1")
api_type = os.environ.get("OPENAI_API_TYPE", "open_ai")
api_version = (
"2022-03-01-preview" if api_type in ("azure", "azure_ad", "azuread") else None
)
verify_ssl_certs = True # No effect. Certificates are always verified.
proxy = None
app_info = None
enable_telemetry = False # Ignored; the telemetry feature was removed.
ca_bundle_path = None # No longer used, feature was removed
debug = False
log = None # Set to either 'debug' or 'info', controls console logging
aiosession: ContextVar[Optional["ClientSession"]] = ContextVar(
"aiohttp-session", default=None
)
__all__ = [
"APIError",
"Answer",
"Classification",
"Completion",
"Customer",
"Edit",
"Image",
"Deployment",
"Embedding",
"Engine",
"ErrorObject",
"File",
"FineTune",
"InvalidRequestError",
"Model",
"Moderation",
"OpenAIError",
"Search",
"api_base",
"api_key",
"api_type",
"api_key_path",
"api_version",
"app_info",
"ca_bundle_path",
"debug",
"enable_elemetry",
"log",
"organization",
"proxy",
"verify_ssl_certs",
]