Python client for Orionac AI API
Project description
Orionac GenAI Python SDK Documentation
Installation
Install via PyPI:
pip install orionac_ai
Or install locally:
pip install ./dist/orionac_ai-0.2.1-py3-none-any.whl
Quick Start
from orionac_genai.client import Theta
client = Theta(api_key="YOUR_API_KEY_HERE", base_url="http:///v1")
# Non-streaming generation
response = client.generate("Hello EC2!", stream=False)
print(response.text)
# Streaming generation
stream_gen = client.generate("Hello EC2!", stream=True)
for chunk in stream_gen:
print(chunk, end="")
Features
- Non-streaming generation: Returns a full
APIResponseobject. - Streaming generation: Returns a generator yielding chunks of text.
- Custom parameters: Supports
model,temperature,max_tokens, etc. - Automatic error handling with
AuthenticationErrorandAPIError. - Stateless: Each request is independent.
API Reference
Class: Theta
Theta(api_key: str, base_url: str = "")
api_key: Your API key for authentication.base_url: URL of the Orionac GenAI server.
Method: generate
generate(prompt: str, stream: bool = False, **kwargs) -> APIResponse | generator
prompt: Text to generate from.stream: If True, returns a generator.kwargs: Additional parameters likemodel,max_tokens,temperature, etc.
Returns APIResponse for non-streaming, or generator for streaming.
Class: APIResponse
APIResponse._data
APIResponse.text
APIResponse.model_used
APIResponse.prompt_tokens
APIResponse.completion_tokens
APIResponse.total_tokens
Error Handling
from orionac_genai.client import Theta, AuthenticationError, APIError
try:
client = Theta(api_key="YOUR_API_KEY")
response = client.generate("Hello!")
except AuthenticationError as e:
print("Invalid API key:", e)
except APIError as e:
print("API request failed:", e, e.status_code)
Example Use Cases
- Chatbots
- Email drafting
resp = client.generate(
"Draft a follow-up email to a prospect we spoke with.",
context={"prospect_name": "Jane Doe"}
)
print(resp.text)
- Streaming terminal applications
for chunk in client.generate("Explain AWS EC2 to a beginner.", stream=True):
print(chunk, end="")
Notes
- Ensure EC2 security group allows inbound traffic on port
8000. - Supports HTTP and HTTPS.
- Fully stateless.
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
orionac_ai-0.2.1.tar.gz
(3.6 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 orionac_ai-0.2.1.tar.gz.
File metadata
- Download URL: orionac_ai-0.2.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
883081c03ede25f119ed40f51a1672099a091d572d2a292a1753b20bdc70e0bb
|
|
| MD5 |
e4bc5c4972fa97ab3763ebbbc3dec9ae
|
|
| BLAKE2b-256 |
40ddf6a01f5b5179a4dc1dd834ce809518873b304ee68bd179da68c1ec0a8454
|
File details
Details for the file orionac_ai-0.2.1-py3-none-any.whl.
File metadata
- Download URL: orionac_ai-0.2.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14db4c06d708473477e05a3a2b1946693b3e58cf06360b36340a20a9acfce0cd
|
|
| MD5 |
53c789575773b20b856d35a38ce0ddba
|
|
| BLAKE2b-256 |
bc87ce72e9f936aec6c08e9b899e63b999799224d16dc58c76efd85c433a441d
|