Skip to main content

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

  1. Non-streaming generation: Returns a full APIResponse object.
  2. Streaming generation: Returns a generator yielding chunks of text.
  3. Custom parameters: Supports model, temperature, max_tokens, etc.
  4. Automatic error handling with AuthenticationError and APIError.
  5. 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 like model, 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

  1. Chatbots
  2. Email drafting
resp = client.generate(
    "Draft a follow-up email to a prospect we spoke with.",
    context={"prospect_name": "Jane Doe"}
)
print(resp.text)
  1. 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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orionac_ai-0.2.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

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

Hashes for orionac_ai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 883081c03ede25f119ed40f51a1672099a091d572d2a292a1753b20bdc70e0bb
MD5 e4bc5c4972fa97ab3763ebbbc3dec9ae
BLAKE2b-256 40ddf6a01f5b5179a4dc1dd834ce809518873b304ee68bd179da68c1ec0a8454

See more details on using hashes here.

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

Hashes for orionac_ai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14db4c06d708473477e05a3a2b1946693b3e58cf06360b36340a20a9acfce0cd
MD5 53c789575773b20b856d35a38ce0ddba
BLAKE2b-256 bc87ce72e9f936aec6c08e9b899e63b999799224d16dc58c76efd85c433a441d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page