Skip to main content

A Python SDK for Asteroid

Project description

Asteroid Python SDK ☄️

A Python SDK for interacting with the Asteroid platform. To successfully use Asteroid Python SDK, you need to have a running instance of the Asteroid server. Book a demo with Asteroid founders to get started!

Installation

pip install asteroid-sdk

Quick Start

from asteroid_sdk.wrappers.openai import asteroid_openai_client
from asteroid_sdk.registration.initialise_project import asteroid_init
from asteroid_sdk.supervision.decorators import supervise
from asteroid_sdk.supervision.supervisors import openai_llm_supervisor, human_supervisor
from openai import OpenAI

# Initialize the SDK
run_id = asteroid_init()


# Define your tools with supervisors
@supervise(supervision_functions=[
    [openai_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

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.12.tar.gz (62.9 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.12-py3-none-any.whl (133.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: asteroid_sdk-0.1.12.tar.gz
  • Upload date:
  • Size: 62.9 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.12.tar.gz
Algorithm Hash digest
SHA256 940d9d3669c5cc201564e31b806e1ed6fc443177bec09a38f5e015dd9d089f78
MD5 eef2508d25b208726151df5c3c1691c9
BLAKE2b-256 8cbd95f517c8f8dc381d70c56cba007fd701e7ff4e49e505ee63b5567a585684

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asteroid_sdk-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 133.9 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.12-py3-none-any.whl
Algorithm Hash digest
SHA256 b459988cf1ed4e8ddaf20b637245884788da5db096342ee83f60b25506ee5c56
MD5 ecc444a66050e42a86647517f5024c3b
BLAKE2b-256 087fafa7902175ee75a8ae6e82d9696980218d82f3d67f359a76a04048d1e17d

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