Python SDK for Mirror Chat API
Project description
Mirror SDK
The official Python SDK for the Mirror Chat API. Easily integrate your Mirror agents into any Python application.
Features
- Session Management: Create and manage chat sessions with your agents.
- Streaming Chat: Real-time streaming responses from your agents.
- Simple Authentication: Easy-to-use API key authentication.
- Type Hinting: Fully typed for better development experience.
Installation
Install the package via pip:
pip install mirrorsdk
Quick Start
Here's how to get started with the Mirror SDK:
from mirror_sdk import MirrorClient
# 1. Initialize the client
# Replace with your actual API key and base URL
client = MirrorClient(
api_key="your_api_key_here",
base_url="http://localhost:807"
)
# 2. Create a new chat session
session = client.create_session(model="mirror_general")
print(f"Created session: {session['id']}")
# 3. Chat with your agent
prompt = "Hello! Tell me a fun fact about space."
print(f"User: {prompt}")
print("Assistant: ", end="", flush=True)
# Responses are streamed in chunks
for chunk in client.chat(session['id'], prompt):
print(chunk, end="", flush=True)
Configuration
The MirrorClient accepts the following parameters:
api_key(str): Your secret API key.base_url(str): The base URL of your Mirror API server (default:http://localhost:807).
Error Handling
The SDK raises standard exceptions when things go wrong:
try:
client.create_session()
except Exception as e:
print(f"An error occurred: {e}")
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file mirrorsdk-0.1.3.tar.gz.
File metadata
- Download URL: mirrorsdk-0.1.3.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2418fde6d734f4e07aba7f8d1ae990c154c96464609faac51458060dc39be88
|
|
| MD5 |
3c126c02570d36a9ba2a9e838a9ddbb0
|
|
| BLAKE2b-256 |
b3f23ba89ac8f282061b35dfb95efbd788233c4c07e8165a27b71a33cff594b6
|
Provenance
The following attestation bundles were made for mirrorsdk-0.1.3.tar.gz:
Publisher:
publish.yml on DipeshMajithia/mirror_sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mirrorsdk-0.1.3.tar.gz -
Subject digest:
e2418fde6d734f4e07aba7f8d1ae990c154c96464609faac51458060dc39be88 - Sigstore transparency entry: 737859376
- Sigstore integration time:
-
Permalink:
DipeshMajithia/mirror_sdk@2878abee78b33c06607b3a930e0e731db8fa331d -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/DipeshMajithia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2878abee78b33c06607b3a930e0e731db8fa331d -
Trigger Event:
push
-
Statement type:
File details
Details for the file mirrorsdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mirrorsdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91afdc841288816fd630b68426f659fd072df1356178a71b0978fc6ea5c8d9f6
|
|
| MD5 |
96697a46ba98428c22a75937f04e5a16
|
|
| BLAKE2b-256 |
8a349be8db66773f4d2ccb2de58aaac3513dbace44e5db412e3fbcfe1a2536ca
|
Provenance
The following attestation bundles were made for mirrorsdk-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on DipeshMajithia/mirror_sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mirrorsdk-0.1.3-py3-none-any.whl -
Subject digest:
91afdc841288816fd630b68426f659fd072df1356178a71b0978fc6ea5c8d9f6 - Sigstore transparency entry: 737859381
- Sigstore integration time:
-
Permalink:
DipeshMajithia/mirror_sdk@2878abee78b33c06607b3a930e0e731db8fa331d -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/DipeshMajithia
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2878abee78b33c06607b3a930e0e731db8fa331d -
Trigger Event:
push
-
Statement type: