OpenaiBatchAPI: A Python Library that supports OpenAI Batch API
Project description
OpenaiBatchAPI: A Python Library that support OpenAI Batch API
Installation
You can install this package from PyPI using pip:
$ pip install OpenaiBatchAPI
Example
from openai_batch_api import OpenaiBatchAPI
batch_client = OpenaiBatchAPI(api_key = "YOUR_KEY")
messages = []
# For custom ID
for i in range(23):
messages.append(
{
"id": f"calc_{i}",
"content": [
{
"role": "user",
"content": f"Calculate: 1 + {i} = "
}
]
}
)
# For auto ID (ID will be the index of the message in the list)
for i in range(23):
messages.append(
{
"role": "user",
"content": f"Calculate: 1 + {i} = "
}
)
batchs = batch_client.batchs_completion(
messages,
max_completion_tokens=32,
model="gpt-4o-mini",
temperature=0,
seed=42
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file OpenaiBatchAPI-1.0.2-py2.py3-none-any.whl.
File metadata
- Download URL: OpenaiBatchAPI-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0f97a808e16cfb1f182a085416e44644694bcff8a6510025989590a9a3877ec
|
|
| MD5 |
b2ca8243489ee424a803147ac216da3d
|
|
| BLAKE2b-256 |
9eb91a9e5905498cf4a52a79bfef9cadf77f6463eb0f3fed64c1eba510263baf
|