Skip to main content

Snow Leopard SDK for Python

This repo contains the Python client library for Snow Leopard APIs.

See our API documentation for more details.

Installation

pip install snowleopard

Quick Start

from snowleopard import SnowLeopardClient

# Initialize the client (or AsyncSnowLeopardClient)
client = SnowLeopardClient(api_key="your-api-key")

# Query your data in natural language
response = client.retrieve(user_query="How many users signed up last month?", instance_id="your-instance-id")

Getting Started

  1. Try Snow Leopard here https://cloud.snowleopard.ai

  2. Set your API key via environment variable:

    export SNOWLEOPARD_API_KEY="your-api-key"
    

    Or pass it directly to the client:

    SnowLeopardClient(api_key="your-api-key")
    

Usage

Synchronous Client

from snowleopard import SnowLeopardClient

with SnowLeopardClient() as client:
   # Get data directly from a natural language query
   response = client.retrieve(user_query="How many superheroes are there?")
   print(response.data)

   # Stream natural language summary of live data
   for chunk in client.response(user_query="How many superheroes are there?"):
      print(chunk)

   # Give feedback to help Snow Leopard understand your business logic better
   client.feedback(
      feedback_text="The revenue column in the orders table should be labeled "
      "'gross revenue before discounts', not 'net revenue'.",
      instance_id="<instance-id>"
   )

Async Client

from snowleopard import AsyncSnowLeopardClient

async with AsyncSnowLeopardClient() as client:
   # Get complete results
   response = await client.retrieve(user_query="How many superheroes are there?")
   print(response.data)

   # Get streaming results
   async for chunk in client.response(user_query="How many superheroes are there?"):
      print(chunk)

   # Give feedback to help Snow Leopard understand your business logic better
   await client.feedback(
      feedback_text="The revenue column in the orders table should be labeled "
      "'gross revenue before discounts', not 'net revenue'.",
      instance_id="<instance-id>"
   )

CLI

The SDK includes a command-line interface:

pip install snowleopard
snowy retrieve --instance <instance-id> "How many records are there?"
snowy response --instance <instance-id> "Summarize the data"
snowy feedback --instance <instance-id> "The revenue totals looked wrong"

On-Premises Customers

For our customers who have a separate deployment per dataset, you should declare explicitly when creating a client and omit <instance_id> when querying.

Example:

client = SnowLeopardClient(url="https://{your-vm-ip}:{port}", api_key="your-api-key")
response = client.retrieve(user_query="How many users signed up last month?")

Contributing

For SDK developer docs and how to contribute, see CONTRIBUTING.md

Release files for snowleopard 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snowleopard 0.5.1
File Size Uploaded
snowleopard-0.5.1.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snowleopard 0.5.1
File Interpreter ABI Platform
snowleopard-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / snowleopard-0.5.1.tar.gz

Download URL snowleopard-0.5.1.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5d263cf2f3a5b044f30c157e2ed811b37c301b24bad8189ce9f48976ffb8708a
BLAKE2b-256 checksum
How to use checksums
26e6e1884e6d08e21f9742abd09b876bc87b9a5a0aba03e3d7eb405fcba0b012
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release files / snowleopard-0.5.1-py3-none-any.whl

Download URL snowleopard-0.5.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
820c582e6538935e72103baeb094ab70e0fb9bd1e2051de0df524ad1d81c0d29
BLAKE2b-256 checksum
How to use checksums
3c83ad7f75933f7c133d2bcf135c4b21d948c64bbc83d112c79b39206d6ab903
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.28.1

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page