Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mirrorsdk-0.1.3.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mirrorsdk-0.1.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for mirrorsdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e2418fde6d734f4e07aba7f8d1ae990c154c96464609faac51458060dc39be88
MD5 3c126c02570d36a9ba2a9e838a9ddbb0
BLAKE2b-256 b3f23ba89ac8f282061b35dfb95efbd788233c4c07e8165a27b71a33cff594b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mirrorsdk-0.1.3.tar.gz:

Publisher: publish.yml on DipeshMajithia/mirror_sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for mirrorsdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 91afdc841288816fd630b68426f659fd072df1356178a71b0978fc6ea5c8d9f6
MD5 96697a46ba98428c22a75937f04e5a16
BLAKE2b-256 8a349be8db66773f4d2ccb2de58aaac3513dbace44e5db412e3fbcfe1a2536ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for mirrorsdk-0.1.3-py3-none-any.whl:

Publisher: publish.yml on DipeshMajithia/mirror_sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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