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.10.tar.gz (61.8 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.10-py3-none-any.whl (131.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: asteroid_sdk-0.1.10.tar.gz
  • Upload date:
  • Size: 61.8 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.10.tar.gz
Algorithm Hash digest
SHA256 7f192639270c743b3274f49ab5774ce7a451f475af081d335d3429a79bf08021
MD5 cc0e7bda0e14f20feb557c4116eb9f8a
BLAKE2b-256 630e552c359ce6c12fcaba9264b1a502b29316c430e79f5998799e05a758be76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asteroid_sdk-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 131.8 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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 48b79ab950789fd026ecd9f5521c67b23e1c620e5f965d4849c74a345683bdf4
MD5 dbaffcaf7e5c8018723958b47973e213
BLAKE2b-256 cf7f12a0bf7c68ca9ebc9eebacbd8963ef2479b2a5bfa95ee35f9a8e319ea2e4

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