Moda SDK - LLM Observability with Automatic Conversation Threading
Project description
moda-ai
Moda's Python SDK for LLM observability with automatic conversation threading. Built on OpenTelemetry.
Installation
pip install moda-ai
Quick Start
import moda
from openai import OpenAI
moda.init("YOUR_MODA_API_KEY")
# Set conversation ID for your session (recommended)
moda.conversation_id = "session_" + session_id
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)
moda.flush()
Conversation Tracking
Setting Conversation ID (Recommended)
For production use, explicitly set a conversation ID to group related LLM calls:
# Property-style (recommended)
moda.conversation_id = "support_ticket_123"
client.chat.completions.create(...)
moda.conversation_id = None # clear when done
# Or use the setter function
moda.set_conversation_id_value("support_ticket_123")
moda.set_conversation_id_value(None) # clear
# Or use context manager (scoped)
with moda.set_conversation_id("support_ticket_123"):
client.chat.completions.create(...)
Setting User ID
Associate LLM calls with specific users:
moda.user_id = "user_12345"
client.chat.completions.create(...)
moda.user_id = None # clear
Automatic Fallback
If you don't set a conversation ID, the SDK automatically computes one from the first user message and system prompt. This works for simple use cases but explicit IDs are recommended for production.
Full Documentation
See the main repository README for complete documentation.
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
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 moda_ai-0.1.4.tar.gz.
File metadata
- Download URL: moda_ai-0.1.4.tar.gz
- Upload date:
- Size: 266.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
951ffe99cb0a4fb68fd7af7e1de5cf9ca8289186feb2e6f3084e74f55274a6b4
|
|
| MD5 |
b12b7197041f73b4cc4d84e5a9451bea
|
|
| BLAKE2b-256 |
49c49040d3ec7bd4ae085c665f349da6167b699aa2b92072f72eed5e795ac277
|
Provenance
The following attestation bundles were made for moda_ai-0.1.4.tar.gz:
Publisher:
publish.yml on ModaLabs/moda-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moda_ai-0.1.4.tar.gz -
Subject digest:
951ffe99cb0a4fb68fd7af7e1de5cf9ca8289186feb2e6f3084e74f55274a6b4 - Sigstore transparency entry: 932524654
- Sigstore integration time:
-
Permalink:
ModaLabs/moda-python@522b44d425eebed4cd9873ba11ffdb92975d104c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ModaLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@522b44d425eebed4cd9873ba11ffdb92975d104c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file moda_ai-0.1.4-py3-none-any.whl.
File metadata
- Download URL: moda_ai-0.1.4-py3-none-any.whl
- Upload date:
- Size: 85.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 |
cb9be6dc574068a65f4dd2151b9ee555e8021cade808d92226dc652244813e1f
|
|
| MD5 |
c8ba3a0cd05896719f19afde20f25bc8
|
|
| BLAKE2b-256 |
32a0e5fca6b9b9b8604780c41078de15473f42f954a6e5580215556a5feca03f
|
Provenance
The following attestation bundles were made for moda_ai-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on ModaLabs/moda-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moda_ai-0.1.4-py3-none-any.whl -
Subject digest:
cb9be6dc574068a65f4dd2151b9ee555e8021cade808d92226dc652244813e1f - Sigstore transparency entry: 932524685
- Sigstore integration time:
-
Permalink:
ModaLabs/moda-python@522b44d425eebed4cd9873ba11ffdb92975d104c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ModaLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@522b44d425eebed4cd9873ba11ffdb92975d104c -
Trigger Event:
workflow_dispatch
-
Statement type: