Skip to main content

Internal LLM audit logger for maybeai services

Project description

py-llm-audit

Internal Python package for unified LLM audit logging.

Exports:

  • configure_audit_logger(...)
  • use_structlog_context(...)
  • set_audit_context(...)
  • aset_audit_context(...)
  • get_audit_context()
  • clear_audit_context()
  • bind_tool_name(...)
  • register_user_resolver(...)
  • clear_user_resolver()
  • resolve_audit_user_id(...)
  • audit_context_from_headers(...)
  • merge_audit_headers(...)
  • build_llm_audit_doc(...)
  • log_llm_audit(...)
  • alog_llm_audit(...)
  • MongoAuditWriter
  • AsyncMongoAuditWriter

Notes:

  • Supports native contextvars
  • Can reuse existing structlog.contextvars
  • Supports async user_id resolution for cases such as gpt_id -> user_id
  • log_llm_audit(...) is for sync writers
  • alog_llm_audit(...) is for async writers such as Motor-backed Mongo
  • Default behavior is non-blocking: audit context resolution, doc building, and write failures do not interrupt the original business flow unless strict mode is explicitly enabled with fail_silently=False

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

klg_llm_audit-0.1.5.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

klg_llm_audit-0.1.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file klg_llm_audit-0.1.5.tar.gz.

File metadata

  • Download URL: klg_llm_audit-0.1.5.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for klg_llm_audit-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0301a4dd505c4a0f2824d37f9a3409606867510872f2a60c4a2e66043bfd966c
MD5 eb990c9b09e3f1c4c1792f06fc192f93
BLAKE2b-256 0fa0fc5c65b7fccab37a37a0ccdb6e1de53ef6eb617c40c3d1aa6accbde3c5f1

See more details on using hashes here.

File details

Details for the file klg_llm_audit-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: klg_llm_audit-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for klg_llm_audit-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0848365cbae86231704697a9e711368918eca9981111dd891594c9011d2f0171
MD5 8e0898cb8aec8cd5581a12f5da717ae4
BLAKE2b-256 d38d3abb4d5a75d09ca459bf4b2370f1ba59baaaeab9d9e46e9e0652b5dc5c98

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