Skip to main content

Python SDK for M3 Chat

Project description

Python SDK for M3 Chat

PyPI version License Build

Official Python SDK for M3 Chat – Stream and fetch AI-generated responses from models like LLaMA, Mistral, Gemma, and more.

Features

  • Simple interface to call M3 Chat models
  • Stream or fetch full responses
  • Batch support (non-streaming)
  • Model validation
  • Typed API and clean structure
  • CLI-friendly

Installation

pip install m3chat_sdk

or

python3 -m pip install m3chat_sdk

Quick Start

from m3chat_sdk import M3ChatClient

client = M3ChatClient(stream=False)
response = client.get_response(model="mistral", content="Hello, how are you?")
print("Response:", response)

Usage

Initialize Client

from m3chat_sdk import M3ChatClient

client = M3ChatClient(stream=True) # or False

Get a Response

response = client.get_response(model="llama3:8b", content="Explain quantum physics.")
print(response)

Batch Requests (Non-Streaming)

prompts = [
"What is the capital of Germany?",
"Tell me a joke.",
"What's 12 * 8?",
]

responses = client.batch_requests(messages=prompts, model="gemma")
for i, res in enumerate(responses):
print(f"Response {i + 1}: {res}")

Supported Models

[
"llama3:8b",
"llama2-uncensored",
"gemma3",
"gemma",
"phi3:mini",
"mistral",
"gemma:2b",
"gemma:7b",
"qwen:7b",
"qwen2.5-coder",
"qwen3",
"deepseek-coder:6.7b",
"deepseek-v2:16b",
"dolphin-mistral:7b",
"dolphin3",
"starcoder2:7b",
"magistral",
"devstral",
]

Testing

Run the client test with:

python3 tests/test_client.py

License

Apache License 2.0 — see LICENSE

Contributing

Issues and PRs welcome! https://github.com/m3-chat/python-sdk

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

m3chat_sdk-0.0.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

m3chat_sdk-0.0.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file m3chat_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: m3chat_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for m3chat_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e08c7b9aa265b2f0e9e58d242c1c7fabdd5c59011397268955524f505d3f5925
MD5 89e7c12ed751c73ad7f5927c9cc5c6f3
BLAKE2b-256 62e8b4092b072da5f5550442f20568a57eda1ce8103f1da6fe8478de9fa93679

See more details on using hashes here.

File details

Details for the file m3chat_sdk-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: m3chat_sdk-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for m3chat_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba4ed6f78a3c5f8533215fe798d3f4ef436fe6e00c16c735ca991a5e52442794
MD5 c4cb0cd654d7a800e90e0d705cb7da90
BLAKE2b-256 27f642c0e784754cfa2e4766ab06c8bf6a067140410d663712c9a795717d92f5

See more details on using hashes here.

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