Skip to main content

Persistent chat conversation logging & QM for Django apps

Project description

chat-logging

Persistent chat conversation logging & quality management for Django apps.

Part of the platform ecosystem (ADR-037). Works with any app using chat-agent.

Features

  • ChatConversation + ChatMessage — Full conversation persistence
  • UseCaseCandidate — Track unmet user needs
  • EvaluationScore — Store evaluation metrics (DeepEval, LangFuse)
  • LoggingSessionBackend — Drop-in wrapper for any SessionBackend
  • Django Admin — Filter, search, review, export conversations

Installation

pip install chat-logging

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "chat_logging",
]

Run migrations:

python manage.py migrate chat_logging

Usage

from chat_agent import ChatAgent, InMemorySessionBackend
from chat_logging import LoggingSessionBackend

backend = LoggingSessionBackend(
    wrapped=InMemorySessionBackend(),
    app_name="drifttales",
    user=request.user,
)

agent = ChatAgent(
    toolkit=my_toolkit,
    completion=my_backend,
    session_backend=backend,  # conversations are now logged!
    system_prompt="...",
)

Export

from chat_logging.exporters import (
    export_conversations_csv,
    export_conversations_jsonl,
)
from chat_logging.models import ChatConversation

qs = ChatConversation.objects.filter(app_name="drifttales")
jsonl = export_conversations_jsonl(qs)
csv_data = export_conversations_csv(qs)

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

iil_chat_logging-0.2.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

iil_chat_logging-0.2.0-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file iil_chat_logging-0.2.0.tar.gz.

File metadata

  • Download URL: iil_chat_logging-0.2.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for iil_chat_logging-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9a8e595f7e3eda0f39e77079eccb6e5aa62dd826637b6881becf380ce1b07709
MD5 5507b493041131560ed5a230bdd8cd3f
BLAKE2b-256 92ba5ebf80a09f3d159c3d63273d5538b4119758f3583dc49a95fd05ea05bcbc

See more details on using hashes here.

File details

Details for the file iil_chat_logging-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for iil_chat_logging-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13d991fc215b182ccd48cacd3ad816471d8debf49af6ba1c0851af7c1d95ddd7
MD5 9322ecfa7b39d5f0cd4b22a7bbfc1bbb
BLAKE2b-256 65c0f9214f26d9fc1fdadca98e9420054a950430c9ed47254461b1d435b7194b

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