Lightweight parallel AI API calls in Python.
Project description
Parallax-AI
Lightweight parallel AI API calls in Python.
Installation
You can install Parallax using pip:
pip install parallax-ai
Usage (Compatible with any OpenAI-API–compatible server, e.g., vLLM)
Initialize Client
from parallax_ai import ParallaxOpenAIClient
# Initialize Client
parallax_client = ParallaxOpenAIClient(
api_key=YOUR_API_KEY,
base_url=YOUR_API_BASE_URL,
)
list_of_messages = [
[{"role": "user", "content": "..."}],
[{"role": "user", "content": "..."}],
[{"role": "user", "content": "..."}],
.
.
.
[{"role": "user", "content": "..."}],
]
chat_completions: Returns a list of outputs in order (waits until all are finished)
outputs = parallax_client.chat_completions(list_of_messages, model="gpt-3.5-turbo")
for output in outputs:
# PROCESS OUTPUT
pass
ichat_completions: Returns outputs one by one in order (yields as soon as each finishes)
for output in parallax_client.ichat_completions(list_of_messages, model="gpt-3.5-turbo"):
# PROCESS OUTPUT
pass
ichat_completions_unordered: Returns outputs as they finish (order not guaranteed)
for output, index in parallax_client.ichat_completions_unordered(list_of_messages, model="gpt-3.5-turbo"):
# PROCESS OUTPUT
pass
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
parallax_ai-0.1.2.tar.gz
(7.1 kB
view details)
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 parallax_ai-0.1.2.tar.gz.
File metadata
- Download URL: parallax_ai-0.1.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84af2338da1a41cfdbb6fc389ee1a33aaa3b3bcfed37b769a8b6bc3f38b97047
|
|
| MD5 |
5ddbb8e83ed5deb782991d0e67fc8e4d
|
|
| BLAKE2b-256 |
bd08a7d8b36ba6aa195d9ff9d06522ba9fb81b5237b8e897e8175d30e34905a4
|
File details
Details for the file parallax_ai-0.1.2-py3-none-any.whl.
File metadata
- Download URL: parallax_ai-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7db6a5386d1a62f3270e2fbed56adf7d7166a1bcbb9340943341d6123d869cf4
|
|
| MD5 |
8ebefabd86c176c928b7c3bb21028da8
|
|
| BLAKE2b-256 |
c61c7c2421f8a8edb1adeb479ca55a2196a490f1d9c165af299334bf37f10136
|