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.4.tar.gz (5.3 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.4-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: klg_llm_audit-0.1.4.tar.gz
  • Upload date:
  • Size: 5.3 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.4.tar.gz
Algorithm Hash digest
SHA256 b759d516e7ecdae5abb779241a755448a36e5f6e2c51d72d01511fb3cb8855d8
MD5 1e2203aac189c55999519eb1a9fe5106
BLAKE2b-256 227863b653e32a310cd56d20784b262d405432efa2534187473c20de94e85806

See more details on using hashes here.

File details

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

File metadata

  • Download URL: klg_llm_audit-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dfbffb69c4663b47799740feeb3661e8501b76f158d1d3eb10e579008a4fd35a
MD5 65ffd9113e93a80352235a9b4d17b8ee
BLAKE2b-256 60a2bf583ae40c85df34c44ff187f690570390175c5cb7c68a2ae9e4a34ac481

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