aibuildai 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. aibuildai-0.0.1.dist-info/METADATA +356 -0
  2. aibuildai-0.0.1.dist-info/RECORD +61 -0
  3. aibuildai-0.0.1.dist-info/WHEEL +5 -0
  4. aibuildai-0.0.1.dist-info/entry_points.txt +2 -0
  5. aibuildai-0.0.1.dist-info/licenses/LICENSE +21 -0
  6. aibuildai-0.0.1.dist-info/top_level.txt +1 -0
  7. aibuildai-0.0.1.dist-info/zip-safe +1 -0
  8. openai/__init__.py +104 -0
  9. openai/_openai_scripts.py +89 -0
  10. openai/api_requestor.py +778 -0
  11. openai/api_resources/__init__.py +14 -0
  12. openai/api_resources/abstract/__init__.py +10 -0
  13. openai/api_resources/abstract/api_resource.py +172 -0
  14. openai/api_resources/abstract/createable_api_resource.py +98 -0
  15. openai/api_resources/abstract/deletable_api_resource.py +48 -0
  16. openai/api_resources/abstract/engine_api_resource.py +325 -0
  17. openai/api_resources/abstract/listable_api_resource.py +95 -0
  18. openai/api_resources/abstract/nested_resource_class_methods.py +154 -0
  19. openai/api_resources/abstract/updateable_api_resource.py +16 -0
  20. openai/api_resources/audio.py +269 -0
  21. openai/api_resources/chat_completion.py +50 -0
  22. openai/api_resources/completion.py +50 -0
  23. openai/api_resources/customer.py +17 -0
  24. openai/api_resources/deployment.py +119 -0
  25. openai/api_resources/edit.py +57 -0
  26. openai/api_resources/embedding.py +91 -0
  27. openai/api_resources/engine.py +50 -0
  28. openai/api_resources/error_object.py +28 -0
  29. openai/api_resources/experimental/__init__.py +3 -0
  30. openai/api_resources/experimental/completion_config.py +11 -0
  31. openai/api_resources/file.py +261 -0
  32. openai/api_resources/fine_tune.py +204 -0
  33. openai/api_resources/image.py +273 -0
  34. openai/api_resources/model.py +5 -0
  35. openai/api_resources/moderation.py +45 -0
  36. openai/cli.py +1136 -0
  37. openai/datalib/__init__.py +14 -0
  38. openai/datalib/common.py +17 -0
  39. openai/datalib/numpy_helper.py +15 -0
  40. openai/datalib/pandas_helper.py +15 -0
  41. openai/embeddings_utils.py +252 -0
  42. openai/error.py +169 -0
  43. openai/object_classes.py +11 -0
  44. openai/openai_object.py +347 -0
  45. openai/openai_response.py +31 -0
  46. openai/py.typed +0 -0
  47. openai/tests/__init__.py +0 -0
  48. openai/tests/asyncio/__init__.py +0 -0
  49. openai/tests/asyncio/test_endpoints.py +90 -0
  50. openai/tests/test_api_requestor.py +101 -0
  51. openai/tests/test_endpoints.py +118 -0
  52. openai/tests/test_exceptions.py +40 -0
  53. openai/tests/test_file_cli.py +39 -0
  54. openai/tests/test_long_examples_validator.py +54 -0
  55. openai/tests/test_url_composition.py +209 -0
  56. openai/tests/test_util.py +55 -0
  57. openai/upload_progress.py +52 -0
  58. openai/util.py +188 -0
  59. openai/validators.py +852 -0
  60. openai/version.py +1 -0
  61. openai/wandb_logger.py +300 -0
@@ -0,0 +1,356 @@
1
+ Metadata-Version: 2.4
2
+ Name: aibuildai
3
+ Version: 0.0.1
4
+ Summary: Python client library for the aibuildai API
5
+ Home-page: https://github.com/open-lm/openai-python
6
+ Author: aibuildai
7
+ Author-email: support@gensei.ai
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7.1
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests>=2.20
15
+ Requires-Dist: tqdm
16
+ Requires-Dist: typing_extensions; python_version < "3.8"
17
+ Requires-Dist: aiohttp
18
+ Provides-Extra: dev
19
+ Requires-Dist: black~=21.6b0; extra == "dev"
20
+ Requires-Dist: pytest==6.*; extra == "dev"
21
+ Requires-Dist: pytest-asyncio; extra == "dev"
22
+ Requires-Dist: pytest-mock; extra == "dev"
23
+ Provides-Extra: datalib
24
+ Requires-Dist: numpy; extra == "datalib"
25
+ Requires-Dist: pandas>=1.2.3; extra == "datalib"
26
+ Requires-Dist: pandas-stubs>=1.1.0.11; extra == "datalib"
27
+ Requires-Dist: openpyxl>=3.0.7; extra == "datalib"
28
+ Provides-Extra: wandb
29
+ Requires-Dist: wandb; extra == "wandb"
30
+ Requires-Dist: numpy; extra == "wandb"
31
+ Requires-Dist: pandas>=1.2.3; extra == "wandb"
32
+ Requires-Dist: pandas-stubs>=1.1.0.11; extra == "wandb"
33
+ Requires-Dist: openpyxl>=3.0.7; extra == "wandb"
34
+ Provides-Extra: embeddings
35
+ Requires-Dist: scikit-learn>=1.0.2; extra == "embeddings"
36
+ Requires-Dist: tenacity>=8.0.1; extra == "embeddings"
37
+ Requires-Dist: matplotlib; extra == "embeddings"
38
+ Requires-Dist: plotly; extra == "embeddings"
39
+ Requires-Dist: numpy; extra == "embeddings"
40
+ Requires-Dist: scipy; extra == "embeddings"
41
+ Requires-Dist: pandas>=1.2.3; extra == "embeddings"
42
+ Requires-Dist: pandas-stubs>=1.1.0.11; extra == "embeddings"
43
+ Requires-Dist: openpyxl>=3.0.7; extra == "embeddings"
44
+ Dynamic: license-file
45
+
46
+ # OpenAI Python Library
47
+
48
+ The OpenAI Python library provides convenient access to the OpenAI API
49
+ from applications written in the Python language. It includes a
50
+ pre-defined set of classes for API resources that initialize
51
+ themselves dynamically from API responses which makes it compatible
52
+ with a wide range of versions of the OpenAI API.
53
+
54
+ You can find usage examples for the OpenAI Python library in our [API reference](https://beta.openai.com/docs/api-reference?lang=python) and the [OpenAI Cookbook](https://github.com/openai/openai-cookbook/).
55
+
56
+ ## Installation
57
+
58
+ You don't need this source code unless you want to modify the package. If you just
59
+ want to use the package, just run:
60
+
61
+ ```sh
62
+ pip install --upgrade aibuildai
63
+ ```
64
+
65
+ Install from source with:
66
+
67
+ ```sh
68
+ python setup.py install
69
+ ```
70
+
71
+ ### Optional dependencies
72
+
73
+ Install dependencies for [`openai.embeddings_utils`](openai/embeddings_utils.py):
74
+
75
+ ```sh
76
+ pip install openai[embeddings]
77
+ ```
78
+
79
+ Install support for [Weights & Biases](https://wandb.me/openai-docs):
80
+
81
+ ```
82
+ pip install openai[wandb]
83
+ ```
84
+
85
+ Data libraries like `numpy` and `pandas` are not installed by default due to their size. They’re needed for some functionality of this library, but generally not for talking to the API. If you encounter a `MissingDependencyError`, install them with:
86
+
87
+ ```sh
88
+ pip install openai[datalib]
89
+ ```
90
+
91
+ ## Usage
92
+
93
+ The library needs to be configured with your account's secret key which is available on the [website](https://platform.openai.com/account/api-keys). Either set it as the `OPENAI_API_KEY` environment variable before using the library:
94
+
95
+ ```bash
96
+ export OPENAI_API_KEY='sk-...'
97
+ ```
98
+
99
+ Or set `openai.api_key` to its value:
100
+
101
+ ```python
102
+ import openai
103
+ openai.api_key = "sk-..."
104
+
105
+ # list models
106
+ models = openai.Model.list()
107
+
108
+ # print the first model's id
109
+ print(models.data[0].id)
110
+
111
+ # create a chat completion
112
+ chat_completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello world"}])
113
+
114
+ # print the chat completion
115
+ print(chat_completion.choices[0].message.content)
116
+ ```
117
+
118
+ ### Params
119
+
120
+ All endpoints have a `.create` method that supports a `request_timeout` param. This param takes a `Union[float, Tuple[float, float]]` and will raise an `openai.error.Timeout` error if the request exceeds that time in seconds (See: https://requests.readthedocs.io/en/latest/user/quickstart/#timeouts).
121
+
122
+ ### Microsoft Azure Endpoints
123
+
124
+ In order to use the library with Microsoft Azure endpoints, you need to set the `api_type`, `api_base` and `api_version` in addition to the `api_key`. The `api_type` must be set to 'azure' and the others correspond to the properties of your endpoint.
125
+ In addition, the deployment name must be passed as the engine parameter.
126
+
127
+ ```python
128
+ import openai
129
+ openai.api_type = "azure"
130
+ openai.api_key = "..."
131
+ openai.api_base = "https://example-endpoint.openai.azure.com"
132
+ openai.api_version = "2023-05-15"
133
+
134
+ # create a chat completion
135
+ chat_completion = openai.ChatCompletion.create(deployment_id="deployment-name", model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello world"}])
136
+
137
+ # print the completion
138
+ print(completion.choices[0].message.content)
139
+ ```
140
+
141
+ Please note that for the moment, the Microsoft Azure endpoints can only be used for completion, embedding, and fine-tuning operations.
142
+ For a detailed example of how to use fine-tuning and other operations using Azure endpoints, please check out the following Jupyter notebooks:
143
+
144
+ - [Using Azure completions](https://github.com/openai/openai-cookbook/tree/main/examples/azure/completions.ipynb)
145
+ - [Using Azure fine-tuning](https://github.com/openai/openai-cookbook/tree/main/examples/azure/finetuning.ipynb)
146
+ - [Using Azure embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/azure/embeddings.ipynb)
147
+
148
+ ### Microsoft Azure Active Directory Authentication
149
+
150
+ In order to use Microsoft Active Directory to authenticate to your Azure endpoint, you need to set the `api_type` to "azure_ad" and pass the acquired credential token to `api_key`. The rest of the parameters need to be set as specified in the previous section.
151
+
152
+ ```python
153
+ from azure.identity import DefaultAzureCredential
154
+ import openai
155
+
156
+ # Request credential
157
+ default_credential = DefaultAzureCredential()
158
+ token = default_credential.get_token("https://cognitiveservices.azure.com/.default")
159
+
160
+ # Setup parameters
161
+ openai.api_type = "azure_ad"
162
+ openai.api_key = token.token
163
+ openai.api_base = "https://example-endpoint.openai.azure.com/"
164
+ openai.api_version = "2023-05-15"
165
+
166
+ # ...
167
+ ```
168
+
169
+ ### Command-line interface
170
+
171
+ This library additionally provides an `openai` command-line utility
172
+ which makes it easy to interact with the API from your terminal. Run
173
+ `openai api -h` for usage.
174
+
175
+ ```sh
176
+ # list models
177
+ openai api models.list
178
+
179
+ # create a chat completion (gpt-3.5-turbo, gpt-4, etc.)
180
+ openai api chat_completions.create -m gpt-3.5-turbo -g user "Hello world"
181
+
182
+ # create a completion (text-davinci-003, text-davinci-002, ada, babbage, curie, davinci, etc.)
183
+ openai api completions.create -m ada -p "Hello world"
184
+
185
+ # generate images via DALL·E API
186
+ openai api image.create -p "two dogs playing chess, cartoon" -n 1
187
+
188
+ # using openai through a proxy
189
+ openai --proxy=http://proxy.com api models.list
190
+ ```
191
+
192
+ ## Example code
193
+
194
+ Examples of how to use this Python library to accomplish various tasks can be found in the [OpenAI Cookbook](https://github.com/openai/openai-cookbook/). It contains code examples for:
195
+
196
+ - Classification using fine-tuning
197
+ - Clustering
198
+ - Code search
199
+ - Customizing embeddings
200
+ - Question answering from a corpus of documents
201
+ - Recommendations
202
+ - Visualization of embeddings
203
+ - And more
204
+
205
+ Prior to July 2022, this OpenAI Python library hosted code examples in its examples folder, but since then all examples have been migrated to the [OpenAI Cookbook](https://github.com/openai/openai-cookbook/).
206
+
207
+ ### Chat Completions
208
+
209
+ Conversational models such as `gpt-3.5-turbo` can be called using the chat completions endpoint.
210
+
211
+ ```python
212
+ import openai
213
+ openai.api_key = "sk-..." # supply your API key however you choose
214
+
215
+ completion = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello world"}])
216
+ print(completion.choices[0].message.content)
217
+ ```
218
+
219
+ ### Completions
220
+
221
+ Text models such as `text-davinci-003`, `text-davinci-002` and earlier (`ada`, `babbage`, `curie`, `davinci`, etc.) can be called using the completions endpoint.
222
+
223
+ ```python
224
+ import openai
225
+ openai.api_key = "sk-..." # supply your API key however you choose
226
+
227
+ completion = openai.Completion.create(model="text-davinci-003", prompt="Hello world")
228
+ print(completion.choices[0].text)
229
+ ```
230
+
231
+ ### Embeddings
232
+
233
+ In the OpenAI Python library, an embedding represents a text string as a fixed-length vector of floating point numbers. Embeddings are designed to measure the similarity or relevance between text strings.
234
+
235
+ To get an embedding for a text string, you can use the embeddings method as follows in Python:
236
+
237
+ ```python
238
+ import openai
239
+ openai.api_key = "sk-..." # supply your API key however you choose
240
+
241
+ # choose text to embed
242
+ text_string = "sample text"
243
+
244
+ # choose an embedding
245
+ model_id = "text-similarity-davinci-001"
246
+
247
+ # compute the embedding of the text
248
+ embedding = openai.Embedding.create(input=text_string, model=model_id)['data'][0]['embedding']
249
+ ```
250
+
251
+ An example of how to call the embeddings method is shown in this [get embeddings notebook](https://github.com/openai/openai-cookbook/blob/main/examples/Get_embeddings.ipynb).
252
+
253
+ Examples of how to use embeddings are shared in the following Jupyter notebooks:
254
+
255
+ - [Classification using embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/Classification_using_embeddings.ipynb)
256
+ - [Clustering using embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/Clustering.ipynb)
257
+ - [Code search using embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/Code_search.ipynb)
258
+ - [Semantic text search using embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/Semantic_text_search_using_embeddings.ipynb)
259
+ - [User and product embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/User_and_product_embeddings.ipynb)
260
+ - [Zero-shot classification using embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/Zero-shot_classification_with_embeddings.ipynb)
261
+ - [Recommendation using embeddings](https://github.com/openai/openai-cookbook/blob/main/examples/Recommendation_using_embeddings.ipynb)
262
+
263
+ For more information on embeddings and the types of embeddings OpenAI offers, read the [embeddings guide](https://beta.openai.com/docs/guides/embeddings) in the OpenAI documentation.
264
+
265
+ ### Fine-tuning
266
+
267
+ Fine-tuning a model on training data can both improve the results (by giving the model more examples to learn from) and reduce the cost/latency of API calls (chiefly through reducing the need to include training examples in prompts).
268
+
269
+ Examples of fine-tuning are shared in the following Jupyter notebooks:
270
+
271
+ - [Classification with fine-tuning](https://github.com/openai/openai-cookbook/blob/main/examples/Fine-tuned_classification.ipynb) (a simple notebook that shows the steps required for fine-tuning)
272
+ - Fine-tuning a model that answers questions about the 2020 Olympics
273
+ - [Step 1: Collecting data](https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-1-collect-data.ipynb)
274
+ - [Step 2: Creating a synthetic Q&A dataset](https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-2-create-qa.ipynb)
275
+ - [Step 3: Train a fine-tuning model specialized for Q&A](https://github.com/openai/openai-cookbook/blob/main/examples/fine-tuned_qa/olympics-3-train-qa.ipynb)
276
+
277
+ Sync your fine-tunes to [Weights & Biases](https://wandb.me/openai-docs) to track experiments, models, and datasets in your central dashboard with:
278
+
279
+ ```bash
280
+ openai wandb sync
281
+ ```
282
+
283
+ For more information on fine-tuning, read the [fine-tuning guide](https://beta.openai.com/docs/guides/fine-tuning) in the OpenAI documentation.
284
+
285
+ ### Moderation
286
+
287
+ OpenAI provides a Moderation endpoint that can be used to check whether content complies with the OpenAI [content policy](https://platform.openai.com/docs/usage-policies)
288
+
289
+ ```python
290
+ import openai
291
+ openai.api_key = "sk-..." # supply your API key however you choose
292
+
293
+ moderation_resp = openai.Moderation.create(input="Here is some perfectly innocuous text that follows all OpenAI content policies.")
294
+ ```
295
+
296
+ See the [moderation guide](https://platform.openai.com/docs/guides/moderation) for more details.
297
+
298
+ ## Image generation (DALL·E)
299
+
300
+ ```python
301
+ import openai
302
+ openai.api_key = "sk-..." # supply your API key however you choose
303
+
304
+ image_resp = openai.Image.create(prompt="two dogs playing chess, oil painting", n=4, size="512x512")
305
+
306
+ ```
307
+
308
+ ## Audio transcription (Whisper)
309
+
310
+ ```python
311
+ import openai
312
+ openai.api_key = "sk-..." # supply your API key however you choose
313
+ f = open("path/to/file.mp3", "rb")
314
+ transcript = openai.Audio.transcribe("whisper-1", f)
315
+
316
+ ```
317
+
318
+ ## Async API
319
+
320
+ Async support is available in the API by prepending `a` to a network-bound method:
321
+
322
+ ```python
323
+ import openai
324
+ openai.api_key = "sk-..." # supply your API key however you choose
325
+
326
+ async def create_chat_completion():
327
+ chat_completion_resp = await openai.ChatCompletion.acreate(model="gpt-3.5-turbo", messages=[{"role": "user", "content": "Hello world"}])
328
+
329
+ ```
330
+
331
+ To make async requests more efficient, you can pass in your own
332
+ `aiohttp.ClientSession`, but you must manually close the client session at the end
333
+ of your program/event loop:
334
+
335
+ ```python
336
+ import openai
337
+ from aiohttp import ClientSession
338
+
339
+ openai.aiosession.set(ClientSession())
340
+ # At the end of your program, close the http session
341
+ await openai.aiosession.get().close()
342
+ ```
343
+
344
+ See the [usage guide](https://platform.openai.com/docs/guides/images) for more details.
345
+
346
+ ## Requirements
347
+
348
+ - Python 3.7.1+
349
+
350
+ In general, we want to support the versions of Python that our
351
+ customers are using. If you run into problems with any version
352
+ issues, please let us know on our [support page](https://help.openai.com/en/).
353
+
354
+ ## Credit
355
+
356
+ This library is forked from the [Stripe Python Library](https://github.com/stripe/stripe-python).
@@ -0,0 +1,61 @@
1
+ aibuildai-0.0.1.dist-info/licenses/LICENSE,sha256=vLo94hSFHM5G7Vr0LWaYBEYW7qzoh8MjG8eiBHSrY54,1083
2
+ openai/__init__.py,sha256=CaZOhi8F0Y9PAVhkKRhda0pQnzHbhIen6I-s6W1miEI,2759
3
+ openai/_openai_scripts.py,sha256=KDA_8h9wIJqVpRBSM-_r3FOhi3S5Hh5b5zMzxIIoZ2s,2558
4
+ openai/api_requestor.py,sha256=2q9qbzcIUBjI7DVG_TucEEK0nEh6qTQD9VkPIn7cm88,25865
5
+ openai/cli.py,sha256=IL9L_7h4ZAxqnLnBgdD2MsQxNZsG-ZjMlpEtf-kH5Dw,38452
6
+ openai/embeddings_utils.py,sha256=0LweljppFfBV5GjY_oipGTnVqpicnECqseKYJOX8tWM,8592
7
+ openai/error.py,sha256=xJJSg_JWuEKL5WdASVg3wNx27J52tzXN9f86kPkCEII,4298
8
+ openai/object_classes.py,sha256=yN2tqUdG1ATov5C1zt06cG1o_ad0o5qYfZlK4bso7eY,379
9
+ openai/openai_object.py,sha256=AohBhBMUtdI96e0YBiiqMabG4ZbkcSYIN_q0LZVr_V8,10774
10
+ openai/openai_response.py,sha256=GoWVZ5kKB0-p8hEN0_0v8TTOq4drthtNRivQc3VBrsk,836
11
+ openai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ openai/upload_progress.py,sha256=L723nchd5OQ_tfDFDKOru_rlHdG73uzesOh528wOOcM,1188
13
+ openai/util.py,sha256=erOS0iwMOpjIUd1TH2clqXxdA-MU1ll0dC8cBP3DO9w,5366
14
+ openai/validators.py,sha256=lqy0NTs1rZS7lt_DFKGtyOmhBVf5LwkmYchsiMKMkBA,34275
15
+ openai/version.py,sha256=Q8raD6k02z4DoYniAz3iui5d6EdM1el95SMTLXJbeCA,18
16
+ openai/wandb_logger.py,sha256=ZQpNHqwrru0sYXMyL9ywOOWS68OhKypoxko1Jko3CuQ,10388
17
+ openai/api_resources/__init__.py,sha256=S5vOHXDRZu1kHikYR82kF5QUU4jEK7rMr2vEaoHQn20,907
18
+ openai/api_resources/audio.py,sha256=HHXQEgzR00KFzl-hq-YyiurjPET9NELPs0AJ7TkrwWs,7050
19
+ openai/api_resources/chat_completion.py,sha256=8mQ-UPp9FcJTMq2ae9nsTpLHnjEjSR7T788l-S6jQIQ,1587
20
+ openai/api_resources/completion.py,sha256=EDgsMEJXwYyTqB5fGy2Vi6nQeproKZWvNmkdNve5Ykc,1610
21
+ openai/api_resources/customer.py,sha256=vX1reXMqDHLssmT2aGev83TIE4NbnzvQ73yrQWyDpFk,539
22
+ openai/api_resources/deployment.py,sha256=9K64JZyWxVcvutebf0qguYrSRPb0V_lMALwNsWRqNzs,4055
23
+ openai/api_resources/edit.py,sha256=HlE11SFBBJH_ompIBHAYToNc4tIdUu01tZyym7f8LlE,1963
24
+ openai/api_resources/embedding.py,sha256=iQBHiBszZPuh4lbiucL9mT_c9ed6DvPatHvyER4ye1Q,3438
25
+ openai/api_resources/engine.py,sha256=_bzICgcNFmpdm08yL_W3n-vekkO0AGcCdPGl352HMT8,1665
26
+ openai/api_resources/error_object.py,sha256=gKtXIo8mYZDPE2GiJUzQ8LDzLKKEPLqQoyYo_AAqOA4,892
27
+ openai/api_resources/file.py,sha256=TX9xFoWeAtRAGyHUTJhcI3BnpQtZKHlAW35mT6fPrGQ,7737
28
+ openai/api_resources/fine_tune.py,sha256=uotwurKyV8wAnyw4x01O2b2t3b--8i_EBSBVbV-2EhE,5263
29
+ openai/api_resources/image.py,sha256=cwwVjOFRblykuBC9cLyLsmDBKmfkppF3gwTz2hF7Wgs,8341
30
+ openai/api_resources/model.py,sha256=BiXo7j4P6-rhZW8my4eAbD6aIdQ6sAf2Dw9e-U21b_Q,169
31
+ openai/api_resources/moderation.py,sha256=XLEVJbP2A5AqcnelbIcXq7-PMqvfPPibOetOf2xiMTA,1376
32
+ openai/api_resources/abstract/__init__.py,sha256=ZUZv2MkEpRUeRZ0NtRHczXNAamFTUK17z87O3WpXzLQ,540
33
+ openai/api_resources/abstract/api_resource.py,sha256=wzCww3boKgr0Ru33CIRi8lOCsMEtQJLKlz1HMHIpMkY,5443
34
+ openai/api_resources/abstract/createable_api_resource.py,sha256=w6atKaf0aUDe3NuV-wLtbmCxCGPtCxXIkH98yk8s7xQ,2573
35
+ openai/api_resources/abstract/deletable_api_resource.py,sha256=9jI4tt7RejbO0aIyLJwivyg3jclr7r55-l50mVFC7GI,1624
36
+ openai/api_resources/abstract/engine_api_resource.py,sha256=GGj9NpJkPqKozgTT3E2meIS1VsRq8YnTg_A3Uzh-P00,10007
37
+ openai/api_resources/abstract/listable_api_resource.py,sha256=-okp69Lu1OaA9aIkEK2nC-JXRW44vtCKFCN89w_4f60,2678
38
+ openai/api_resources/abstract/nested_resource_class_methods.py,sha256=7rCNmuZhLgbN7M6PcNT-P9W5taHFZF-ObDYXz7GLFuI,5086
39
+ openai/api_resources/abstract/updateable_api_resource.py,sha256=cQQd04fI85DTYpOqM_LFuZ9ldDKrkT-MRetkDG5FUU0,534
40
+ openai/api_resources/experimental/__init__.py,sha256=fLUruA1uO11wqsDNuAKxgx3qVhQyPYC79JoZNTCIq1A,104
41
+ openai/api_resources/experimental/completion_config.py,sha256=7vlxmFIkpleNCEUir50NBk31XxnqL0yBFZ5Ah1h9TpQ,274
42
+ openai/datalib/__init__.py,sha256=cCLTzxxXF1mYb_iC2zX9WMr_VnJWnuWOPxgFvLZKIYE,651
43
+ openai/datalib/common.py,sha256=YNnJ_IDOc-lF43LkwFJNftfF5h2n9mhdt6eZfAH976w,258
44
+ openai/datalib/numpy_helper.py,sha256=p5o-NYEF0DX5jN9Dy_pRbYpD9M9C1B18konK-WZSOIQ,320
45
+ openai/datalib/pandas_helper.py,sha256=WvA3nHCaTgeB5-VgSJlfqfQzVMdmi_hKFRQtamdLzAE,329
46
+ openai/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
+ openai/tests/test_api_requestor.py,sha256=rU9EJyDrtOqSzDmMaYxf-FKqdaBCFHkzJYGMCQS37EY,3582
48
+ openai/tests/test_endpoints.py,sha256=RgYp2Gcz-nkM6AH35MJ_QvNKcpN5IUvIzMth7SzsJN4,2867
49
+ openai/tests/test_exceptions.py,sha256=VbKHyi7QAoLi_t6IMuJWSdSkY4zJD4ngrNRjQ89GIjQ,1156
50
+ openai/tests/test_file_cli.py,sha256=BIBCaDJ6SZsAtvNqERhEQLDutJjoejgV9GCP3tYcu1A,1418
51
+ openai/tests/test_long_examples_validator.py,sha256=hlJSur4VkHxc3kMviBMeuZTATyEqwHCDdCTD0ok_v1g,2016
52
+ openai/tests/test_url_composition.py,sha256=d3Jr-bmCFLedEYu3FTYN180WT6wBygRABW8g9R3ccsA,6506
53
+ openai/tests/test_util.py,sha256=K268icrNV6XQBi25VSGqpBzOP2bLBoIuSj91NMV4nU0,1786
54
+ openai/tests/asyncio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
+ openai/tests/asyncio/test_endpoints.py,sha256=ko3ra_FcwlmkCzxEoVwIyOTYdSNQn7VgSqUGQ7O8kro,2362
56
+ aibuildai-0.0.1.dist-info/METADATA,sha256=in1hcnb86ra1KEbvj9k-7Src_S_9Y-hOGgRGnp3bctw,13891
57
+ aibuildai-0.0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
58
+ aibuildai-0.0.1.dist-info/entry_points.txt,sha256=q68fD1MsMkiejaG68n2mKmbuZEwWkq89oniOBBq9fo0,55
59
+ aibuildai-0.0.1.dist-info/top_level.txt,sha256=yroxRDiE4kOdI0tEpF1d7ffoQJMxe4i3z_pKoyou9wg,7
60
+ aibuildai-0.0.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
61
+ aibuildai-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ openai = openai._openai_scripts:main
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) OpenAI (https://openai.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1 @@
1
+ openai
@@ -0,0 +1 @@
1
+
openai/__init__.py ADDED
@@ -0,0 +1,104 @@
1
+ # OpenAI Python bindings.
2
+ #
3
+ # Originally forked from the MIT-licensed Stripe Python bindings.
4
+
5
+ import os
6
+ import sys
7
+ from typing import TYPE_CHECKING, Optional, Union, Callable
8
+
9
+ from contextvars import ContextVar
10
+
11
+ if "pkg_resources" not in sys.modules:
12
+ # workaround for the following:
13
+ # https://github.com/benoitc/gunicorn/pull/2539
14
+ sys.modules["pkg_resources"] = object() # type: ignore[assignment]
15
+ import aiohttp
16
+
17
+ del sys.modules["pkg_resources"]
18
+
19
+ from openai.api_resources import (
20
+ Audio,
21
+ ChatCompletion,
22
+ Completion,
23
+ Customer,
24
+ Deployment,
25
+ Edit,
26
+ Embedding,
27
+ Engine,
28
+ ErrorObject,
29
+ File,
30
+ FineTune,
31
+ Image,
32
+ Model,
33
+ Moderation,
34
+ )
35
+ from openai.error import APIError, InvalidRequestError, OpenAIError
36
+ from openai.version import VERSION
37
+
38
+ if TYPE_CHECKING:
39
+ import requests
40
+ from aiohttp import ClientSession
41
+
42
+ api_key = os.environ.get("OPENAI_API_KEY")
43
+ # Path of a file with an API key, whose contents can change. Supercedes
44
+ # `api_key` if set. The main use case is volume-mounted Kubernetes secrets,
45
+ # which are updated automatically.
46
+ api_key_path: Optional[str] = os.environ.get("OPENAI_API_KEY_PATH")
47
+
48
+ organization = os.environ.get("OPENAI_ORGANIZATION")
49
+ api_base = os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1")
50
+ api_type = os.environ.get("OPENAI_API_TYPE", "open_ai")
51
+ api_version = os.environ.get(
52
+ "OPENAI_API_VERSION",
53
+ ("2023-05-15" if api_type in ("azure", "azure_ad", "azuread") else None),
54
+ )
55
+ verify_ssl_certs = True # No effect. Certificates are always verified.
56
+ proxy = None
57
+ app_info = None
58
+ enable_telemetry = False # Ignored; the telemetry feature was removed.
59
+ ca_bundle_path = None # No longer used, feature was removed
60
+ debug = False
61
+ log = None # Set to either 'debug' or 'info', controls console logging
62
+
63
+ requestssession: Optional[
64
+ Union["requests.Session", Callable[[], "requests.Session"]]
65
+ ] = None # Provide a requests.Session or Session factory.
66
+
67
+ aiosession: ContextVar[Optional["ClientSession"]] = ContextVar(
68
+ "aiohttp-session", default=None
69
+ ) # Acts as a global aiohttp ClientSession that reuses connections.
70
+ # This is user-supplied; otherwise, a session is remade for each request.
71
+
72
+ __version__ = VERSION
73
+ __all__ = [
74
+ "APIError",
75
+ "Audio",
76
+ "ChatCompletion",
77
+ "Completion",
78
+ "Customer",
79
+ "Edit",
80
+ "Image",
81
+ "Deployment",
82
+ "Embedding",
83
+ "Engine",
84
+ "ErrorObject",
85
+ "File",
86
+ "FineTune",
87
+ "InvalidRequestError",
88
+ "Model",
89
+ "Moderation",
90
+ "OpenAIError",
91
+ "api_base",
92
+ "api_key",
93
+ "api_type",
94
+ "api_key_path",
95
+ "api_version",
96
+ "app_info",
97
+ "ca_bundle_path",
98
+ "debug",
99
+ "enable_telemetry",
100
+ "log",
101
+ "organization",
102
+ "proxy",
103
+ "verify_ssl_certs",
104
+ ]
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env python
2
+ import argparse
3
+ import logging
4
+ import sys
5
+
6
+ import openai
7
+ from openai import version
8
+ from openai.cli import api_register, display_error, tools_register, wandb_register
9
+
10
+ logger = logging.getLogger()
11
+ formatter = logging.Formatter("[%(asctime)s] %(message)s")
12
+ handler = logging.StreamHandler(sys.stderr)
13
+ handler.setFormatter(formatter)
14
+ logger.addHandler(handler)
15
+
16
+
17
+ def main():
18
+ parser = argparse.ArgumentParser(description=None)
19
+ parser.add_argument(
20
+ "-V",
21
+ "--version",
22
+ action="version",
23
+ version="%(prog)s " + version.VERSION,
24
+ )
25
+ parser.add_argument(
26
+ "-v",
27
+ "--verbose",
28
+ action="count",
29
+ dest="verbosity",
30
+ default=0,
31
+ help="Set verbosity.",
32
+ )
33
+ parser.add_argument("-b", "--api-base", help="What API base url to use.")
34
+ parser.add_argument("-k", "--api-key", help="What API key to use.")
35
+ parser.add_argument("-p", "--proxy", nargs='+', help="What proxy to use.")
36
+ parser.add_argument(
37
+ "-o",
38
+ "--organization",
39
+ help="Which organization to run as (will use your default organization if not specified)",
40
+ )
41
+
42
+ def help(args):
43
+ parser.print_help()
44
+
45
+ parser.set_defaults(func=help)
46
+
47
+ subparsers = parser.add_subparsers()
48
+ sub_api = subparsers.add_parser("api", help="Direct API calls")
49
+ sub_tools = subparsers.add_parser("tools", help="Client side tools for convenience")
50
+ sub_wandb = subparsers.add_parser("wandb", help="Logging with Weights & Biases")
51
+
52
+ api_register(sub_api)
53
+ tools_register(sub_tools)
54
+ wandb_register(sub_wandb)
55
+
56
+ args = parser.parse_args()
57
+ if args.verbosity == 1:
58
+ logger.setLevel(logging.INFO)
59
+ elif args.verbosity >= 2:
60
+ logger.setLevel(logging.DEBUG)
61
+
62
+ openai.debug = True
63
+ if args.api_key is not None:
64
+ openai.api_key = args.api_key
65
+ if args.api_base is not None:
66
+ openai.api_base = args.api_base
67
+ if args.organization is not None:
68
+ openai.organization = args.organization
69
+ if args.proxy is not None:
70
+ openai.proxy = {}
71
+ for proxy in args.proxy:
72
+ if proxy.startswith('https'):
73
+ openai.proxy['https'] = proxy
74
+ elif proxy.startswith('http'):
75
+ openai.proxy['http'] = proxy
76
+
77
+ try:
78
+ args.func(args)
79
+ except openai.error.OpenAIError as e:
80
+ display_error(e)
81
+ return 1
82
+ except KeyboardInterrupt:
83
+ sys.stderr.write("\n")
84
+ return 1
85
+ return 0
86
+
87
+
88
+ if __name__ == "__main__":
89
+ sys.exit(main())