openai/openai-python
Publicmirrored from https://github.com/openai/openai-pythonAvailable
openai/__init__.py
39lines · modecode
| 1 | import os |
| 2 | |
| 3 | # OpenAI Python bindings. |
| 4 | # |
| 5 | # Originally forked from the MIT-licensed Stripe Python bindings. |
| 6 | |
| 7 | # Configuration variables |
| 8 | |
| 9 | api_key = os.environ.get("OPENAI_API_KEY") |
| 10 | organization = os.environ.get("OPENAI_ORGANIZATION") |
| 11 | client_id = None |
| 12 | api_base = os.environ.get("OPENAI_API_BASE", "https://api.openai.com") |
| 13 | file_api_base = None |
| 14 | api_version = None |
| 15 | verify_ssl_certs = True |
| 16 | proxy = None |
| 17 | default_http_client = None |
| 18 | app_info = None |
| 19 | enable_telemetry = True |
| 20 | max_network_retries = 0 |
| 21 | ca_bundle_path = os.path.join(os.path.dirname(__file__), "data/ca-certificates.crt") |
| 22 | debug = False |
| 23 | |
| 24 | # Set to either 'debug' or 'info', controls console logging |
| 25 | log = None |
| 26 | |
| 27 | # API resources |
| 28 | from openai.api_resources import ( # noqa: E402,F401 |
| 29 | Answer, |
| 30 | Classification, |
| 31 | Completion, |
| 32 | Engine, |
| 33 | ErrorObject, |
| 34 | File, |
| 35 | FineTune, |
| 36 | Snapshot, |
| 37 | ) |
| 38 | |
| 39 | from openai.error import OpenAIError, APIError, InvalidRequestError # noqa: E402,F401 |
| 40 | |