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.6.tar.gz (5.1 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.6-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: klg_llm_audit-0.1.6.tar.gz
  • Upload date:
  • Size: 5.1 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.6.tar.gz
Algorithm Hash digest
SHA256 8bd6e5a9649aba16b1859a21e5198ae8dd593ef4c876a9edfa3ab251767d1e51
MD5 3a2249df585c12f9bbf6d34e5db2391d
BLAKE2b-256 8276a394ab813e36a00db771a79da71684f819cf62f3f45fb31d78c7241e407a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: klg_llm_audit-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.8 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3d40755c6afaaa848fa401b9c902ead342ce241a16ad78089d754dc2b393963e
MD5 d6540e5f0ed69e3ef4a8d79539913ebf
BLAKE2b-256 89db003d3f238b6ef0451abad449055de43e30e9700434e6577087e435d11ad9

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