Skip to main content

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

moda_ai-0.1.4.1.tar.gz (318.8 kB view details)

Uploaded Source

Built Distribution

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

moda_ai-0.1.4.1-py3-none-any.whl (87.3 kB view details)

Uploaded Python 3

File details

Details for the file moda_ai-0.1.4.1.tar.gz.

File metadata

  • Download URL: moda_ai-0.1.4.1.tar.gz
  • Upload date:
  • Size: 318.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for moda_ai-0.1.4.1.tar.gz
Algorithm Hash digest
SHA256 0f1985cb80550248b92e9e01d65d5d317acc28daa84f159d4c906abb69645a26
MD5 681c385e0c47b53b3258d46d2c8f5bb8
BLAKE2b-256 c1313365ace9c24d5939c018c1378ad897345ed4606e8812c871bfd987dfc430

See more details on using hashes here.

Provenance

The following attestation bundles were made for moda_ai-0.1.4.1.tar.gz:

Publisher: publish.yml on ModaLabs/moda-python

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

File details

Details for the file moda_ai-0.1.4.1-py3-none-any.whl.

File metadata

  • Download URL: moda_ai-0.1.4.1-py3-none-any.whl
  • Upload date:
  • Size: 87.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for moda_ai-0.1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49174aabf50d5ad8f50742e40f4623a1930e716a8573a63b87b0e37a94fa06be
MD5 dc63af8a97e8e5a1e81e6c5882920f6b
BLAKE2b-256 3dc8c8d85da08f8ae6106bf4a4c9a1fe42102539ff5c1c9aa086464f0b91ccd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for moda_ai-0.1.4.1-py3-none-any.whl:

Publisher: publish.yml on ModaLabs/moda-python

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