Skip to main content

Python SDK for the Alveare Private SLM Inference-as-a-Service platform

Project description

Alveare Python SDK

Python client for the Alveare Private SLM Inference-as-a-Service platform.

Installation

pip install alveare

Quick start

from alveare import Alveare

client = Alveare(api_key="alv_live_...")

# Native inference
result = client.infer(
    specialist="summarise",
    prompt="Summarise this quarterly report...",
    max_tokens=256,
)
print(result.text)

# OpenAI-compatible chat completions
completion = client.chat.completions.create(
    model="alveare-summarise",
    messages=[{"role": "user", "content": "Summarise this..."}],
    max_tokens=256,
)
print(completion.choices[0].message.content)

Async usage

import asyncio
from alveare import AsyncAlveare

async def main():
    async with AsyncAlveare(api_key="alv_live_...") as client:
        result = await client.infer(specialist="summarise", prompt="...")
        print(result.text)

asyncio.run(main())

Configuration

Parameter Environment variable Default
api_key ALVEARE_API_KEY required
base_url ALVEARE_BASE_URL https://api.alveare.ai
timeout -- 60.0
max_retries -- 3

Error handling

from alveare import Alveare, AuthenticationError, RateLimitError, APIError

client = Alveare(api_key="alv_live_...")

try:
    result = client.infer(specialist="summarise", prompt="...")
except AuthenticationError:
    print("Check your API key")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after}s")
except APIError as e:
    print(f"API error {e.status_code}: {e.message}")

Requirements

  • Python 3.9+
  • httpx (installed automatically)

License

MIT

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

alveare-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

alveare-0.1.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file alveare-0.1.0.tar.gz.

File metadata

  • Download URL: alveare-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for alveare-0.1.0.tar.gz
Algorithm Hash digest
SHA256 471e185133f10b621bb5ed11e26daff799327127d596baff9183379a452b821e
MD5 6cf81acd6cbd5a8caafd374ecf418c99
BLAKE2b-256 706c2d16bafb29dd2d83f7ef21b5f5ed2eb01999145c451bfba3a615455679a7

See more details on using hashes here.

File details

Details for the file alveare-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: alveare-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for alveare-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70769579b1c7e84e275b696db31eb6de3b83f14d2cf4ebb1497ab458d9b70511
MD5 e6b05348e7104ecad7220421d03928e2
BLAKE2b-256 3ebb02a1cf83c4083fb9beea2c2fc40a5fa7e9ae89237465fd57b0db2ae08975

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