Mirmer AI Python SDK
A Python client library for the Mirmer AI multi-LLM consultation system.
Installation
pip install mirmer-ai
Quick Start
from mirmer import Client
# Initialize client with API key
client = Client(api_key="your-api-key")
# Or use environment variable MIRMER_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 mirmer 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 mirmer 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 mirmer 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 mirmer 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 mirmer import Client
client = Client(
api_key="your-api-key",
base_url="https://api.mirmer.ai", # Custom API endpoint
timeout=60.0, # Request timeout in seconds
max_retries=3 # Max retry attempts for failed requests
)
Error Handling
from mirmer 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
Support
- Documentation: https://docs.mirmer.ai
- Issues: https://github.com/mirmer-ai/python-sdk/issues
- Email: support@mirmer.ai
Metadata
Release files for mirmer-ai 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mirmer_ai-0.1.3.tar.gz | 22.0 kB | Without provenance | Details for mirmer_ai-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mirmer_ai-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for mirmer_ai-0.1.3-py3-none-any.whl |
Total release size: 40.3 kB
Release files / mirmer_ai-0.1.3.tar.gz
| Download URL | mirmer_ai-0.1.3.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
90e1015f9d89ca80bc70fe4152a02a96321e58318d22203e3fc193f8b1a324ea
|
|
BLAKE2b-256 checksum How to use checksums |
1fc18a8afaf05a46de6e042f76aa666e0a06e7322e197b496bacbcd2ffd9174f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"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}
|
Release files / mirmer_ai-0.1.3-py3-none-any.whl
| Download URL | mirmer_ai-0.1.3-py3-none-any.whl |
|---|---|
| Size | 18.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3cc0d68ca4239ceaad07dc520e973ecfeba156f4dd3dc6033d949529846efd2c
|
|
BLAKE2b-256 checksum How to use checksums |
55373f61935ac3c680b3f90bb28c00e0d3ef6e2e6040623756aa4e2bb42162aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"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}
|
Security for mirmer-ai 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.