Skip to main content

A Python SDK for Asteroid

Project description

Asteroid Python SDK

A Python SDK for interacting with the Asteroid platform. This SDK is designed to be used with the Asteroid server.

Installation

pip install asteroid-sdk

Quick Start

from asteroid_sdk.wrappers.openai import asteroid_openai_client, asteroid_init
from asteroid_sdk.supervision.decorators import supervise
from asteroid_sdk.supervision.supervisors import llm_supervisor, human_supervisor
from openai import OpenAI

# Initialize the SDK
run_id = asteroid_init()

# Define your tools with supervisors
@supervise(supervision_functions=[[llm_supervisor(instructions="For flights above $1000, escalate."), human_supervisor()]])
def book_flight(departure_city: str, arrival_city: str, datetime: str):
    """Book a flight ticket."""
    return f"Flight booked from {departure_city} to {arrival_city} on {datetime}."

# Wrap your LLM client
client = OpenAI()
wrapped_client = asteroid_openai_client(client, run_id)

# Run your LLM
response = wrapped_client.chat.completions.create(
  model="gpt-4o",
  messages=[{"role": "user", "content": "Book a flight from SF to LA for tomorrow for $1100."}],
  tools=[book_flight]
)
# The response is supervised by Asteroid, check the web UI for the results and human review

To successfully run this example, you need to have a running instance of the Asteroid server. Book a demo with Asteroid founders to get started!

Documentation

For more information, please refer to the Asteroid Documentation!

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

asteroid_sdk-0.1.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

asteroid_sdk-0.1.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: asteroid_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for asteroid_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f794e91cb1c244ccf985f5d8dfffd9d6055e12ed04bd0459c26e31d6e7209e58
MD5 906ade086a3c05322b86f14a50166ae8
BLAKE2b-256 1e71d07824ef4e71e1f318f3dd9bdad54102450a1e9c67f8f9d16a21d42b1dd1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asteroid_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for asteroid_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fca7a999aecd6a422024ae460ef7bcd154edfe034f0db57954036e47618e346c
MD5 2b2bb45600f2e80e88ee62d8f678ff39
BLAKE2b-256 b43107acc9ded7b3471926588f5dfb34ca8498f84b009ac2fd109851c6b589f7

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