Python SDK for VassaAI multi-LLM consultation system
Project description
VassaAI Python SDK
A Python client library for the VassaAI multi-LLM consultation system.
Installation
pip install vassa-ai
Quick Start
from vassa import Client
# Initialize client with API key
client = Client(api_key="your-api-key")
# Or use environment variable Vassa_API_KEY
client = Client()
# Send a query and get council response
response = client.query("What is the meaning of life?")
# Access the three stages
print("Stage 1 - Individual Responses:")
for model_response in response.stage1:
print(f"{model_response.model}: {model_response.response}")
print("\nStage 2 - Peer Rankings:")
for ranking in response.stage2:
print(f"{ranking.model}: {ranking.parsed_ranking}")
print("\nStage 3 - Chairman Synthesis:")
print(response.stage3.response)
Features
- 3-Stage Council Process: Query multiple AI models, get peer reviews, and receive synthesized consensus
- Streaming Support: Real-time updates as each stage completes
- Async/Await: Full async support with
AsyncClient - Conversation Management: Create, list, search, and delete conversations
- Usage Tracking: Monitor your API consumption and limits
- Type Safety: Complete type hints for IDE autocomplete and type checking
- Error Handling: Comprehensive exception hierarchy for graceful error handling
Usage Examples
Streaming Responses
from vassa import Client
client = Client(api_key="your-api-key")
# Stream council process updates in real-time
for update in client.stream("Explain quantum computing"):
if update.type == "stage1_complete":
print(f"Stage 1 complete: {len(update.data['stage1'])} responses")
elif update.type == "stage3_complete":
print(f"Final answer: {update.data['response']}")
Async Usage
import asyncio
from vassa import AsyncClient
async def main():
async with AsyncClient(api_key="your-api-key") as client:
response = await client.query("What is machine learning?")
print(response.stage3.response)
asyncio.run(main())
Conversation Management
from vassa import Client
client = Client(api_key="your-api-key")
# Create a new conversation
conversation = client.create_conversation(title="AI Discussion")
# Add messages to the conversation
response = client.query("What is AI?", conversation_id=conversation.id)
# List all conversations
conversations = client.list_conversations()
# Search conversations
results = client.search_conversations("machine learning")
# Get specific conversation
conv = client.get_conversation(conversation.id)
# Delete conversation
client.delete_conversation(conversation.id)
Usage Statistics
from vassa import Client
client = Client(api_key="your-api-key")
# Check your usage
usage = client.get_usage()
print(f"Used: {usage.queries_used_today}/{usage.daily_limit}")
print(f"Tier: {usage.tier}")
Configuration
from vassa import Client
client = Client(
api_key="your-api-key",
base_url="https://api.vassa.ai", # Custom API endpoint
timeout=60.0, # Request timeout in seconds
max_retries=3 # Max retry attempts for failed requests
)
Error Handling
from vassa import Client, AuthenticationError, RateLimitError, APIError
client = Client(api_key="your-api-key")
try:
response = client.query("Hello")
except AuthenticationError:
print("Invalid API key")
except RateLimitError as e:
print(f"Rate limit exceeded. Reset at: {e.reset_time}")
except APIError as e:
print(f"API error: {e.message} (status: {e.status_code})")
Requirements
- Python 3.8+
- httpx >= 0.24.0
- pydantic >= 2.0.0
- python-dateutil >= 2.8.0
License
MIT License - see LICENSE file for details
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
vassa_ai-0.1.0.tar.gz
(28.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
vassa_ai-0.1.0-py3-none-any.whl
(18.2 kB
view details)
File details
Details for the file vassa_ai-0.1.0.tar.gz.
File metadata
- Download URL: vassa_ai-0.1.0.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aef8ef8bd9394b2b4cd921a2b50c3cadc5486a67d315b49a5025ba2d23f8d34b
|
|
| MD5 |
ed7c6276c4ef54e816451015a2f8b3af
|
|
| BLAKE2b-256 |
1ddc9828396bf6ba9f4a8472ca9e6640c839a75cd62d7f14e74bc3e03451550c
|
File details
Details for the file vassa_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: vassa_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1860a91e5db2b278022c15a2d4a2873f4d7c06b7d400efdd1d2b7dfaa2fdabe
|
|
| MD5 |
06a1dc5a89528d4663db88ea998a28ff
|
|
| BLAKE2b-256 |
86107329e49681e62d8bf11d4fb826b8ec668e2f1c8023d621109fbbb8544153
|