Skip to main content

Python client for the Olive distributed AI compute platform

Project description

Olive Python SDK

Distributed AI compute — embeddings and inference — with one import.

pip install olive-compute

Quickstart

from olive import OliveClient

client = OliveClient(api_key="olv_...")

# Embed text — uses the default embeddings model
vectors = client.embeddings(["hello world", "olive compute"])
print(vectors[0][:4])  # [0.0521, -0.1234, ...]

# Run inference — uses the default chat model
reply = client.inference("What is a neural network?", max_tokens=128)
print(reply)

Choosing a model

Olive supports a catalog of curated open-source models. Browse them at olivecompute.com/models or programmatically:

# List all available chat models
for m in client.list_models(modality="chat"):
    print(m["id"], "—", m["pricing"]["input_per_1m_tokens_usd"], "/1M tokens")

# Get one model's full record
m = client.get_model("meta/llama-3.1-8b-instruct")
print(m["description"])

Pass model= to any inference call to pin a specific model:

reply = client.inference(
    "Write a Python function to reverse a list.",
    model="qwen/qwen-2.5-coder-7b",
)

vectors = client.embeddings(
    ["semantic search query"],
    model="baai/bge-large-en-v1.5",
)

If model= is omitted, Olive picks the default (featured) model for the workload.

Authentication

Get an API key from provider.olivecompute.com → Settings → API Keys.

# API key (recommended)
client = OliveClient(api_key="olv_...")

# Email + password (issues a short-lived token automatically)
client = OliveClient(email="you@example.com", password="...")

Compute tiers

Tier CPU RAM Use case
"light" 1 core 2 GB Embeddings, small inputs
"medium" 2 cores 4 GB Standard inference (default)
"heavy" 4 cores 8 GB Long context, large batches

Async jobs

For long-running workloads, submit and poll separately:

job = client.submit_job(
    workload_type="inference",
    input_data='{"prompt": "Write a haiku", "max_tokens": 64}',
    model="meta/llama-3.1-8b-instruct",   # optional — default chat model otherwise
    compute="medium",
)
print(job.id)       # e3b2a1c0-...
print(job.status)   # "running"

result = job.wait(timeout=120)
print(result["output_data"])

Error handling

from olive import OliveClient, AuthError, JobError

try:
    client = OliveClient(api_key="bad_key")
    vectors = client.embeddings(["test"])
except AuthError:
    print("Check your API key")
except JobError as e:
    print(f"Job failed: {e}")

Context manager

with OliveClient(api_key="olv_...") as client:
    vectors = client.embeddings(["hello"])

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

olive_compute-0.1.1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

olive_compute-0.1.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file olive_compute-0.1.1.tar.gz.

File metadata

  • Download URL: olive_compute-0.1.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for olive_compute-0.1.1.tar.gz
Algorithm Hash digest
SHA256 60c95c6b366d969ca1a5e41a89d635c06ad3f687d986d829386af29176297dc0
MD5 e1ee9575b6202b16c6434f27868907e0
BLAKE2b-256 e241c2f0a5ada228ae7ae88f45088947dd1eee915268609ce60fa210639c3631

See more details on using hashes here.

File details

Details for the file olive_compute-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: olive_compute-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for olive_compute-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 db833ff1334e2c4d4e75f0dc5959f3162b3ff62cb08f92689fef3c31c737c7b8
MD5 dd93fe956112962a2e7d48408f278703
BLAKE2b-256 ae7d9660d436d62741da5266bad6015448871b34e9a1041da18b55fbbaac8a20

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