Skip to main content

LLM and RAG audits including safety, security, hallucination, and citation checks

Project description

rai-audit-llm

LLM and RAG audits for prompt injection, unsafe output, toxicity, faithfulness, citations, retrieval quality, and retrieval security.

CLI

Audit captured responses from a YAML suite:

rai-audit llm run --suite packages/rai-audit-llm/examples/llm_audit_suite.yml --format html

New suites should set schema_version: "1.0". Existing unversioned suites and the legacy tests key are migrated during loading.

Use --audit-type rag to run only RAG checks or --audit-type rag-security to scan only retrieval security cases.

Python API

from rai_audit.llm import LLMAudit, load_test_suite

suite = load_test_suite("packages/rai-audit-llm/examples/llm_audit_suite.yml")
report = LLMAudit(suite, persist=False).run()

For live evaluation, pass responder=lambda case: .... RAG faithfulness checks require an LLM-as-judge verdict: provide judge_result in captured YAML or pass faithfulness_judge=lambda case, response: {"score": 0.9, "reasoning": "..."}.

RAG suites can set relevant_sources and retrieval_k for recall@k and reciprocal rank checks. Retrieved contexts support document_id, tenant_id, updated_at, and poisoned metadata for provenance, tenant-isolation, freshness, and poisoned document checks.

OpenAIResponder and AnthropicResponder capture latency, token usage, and optional caller-supplied pricing. Suites can also run structured_output, pii_redaction, prompt_leakage, refusal_overblocking, rate_limit, latency, and token_budget checks. Use rubric_judge for configurable LLM-as-judge scoring and summarize_reports for repeated-run benchmarks.

All findings include OWASP LLM Top 10 2025 references where applicable.

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

rai_audit_llm-0.1.8.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

rai_audit_llm-0.1.8-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file rai_audit_llm-0.1.8.tar.gz.

File metadata

  • Download URL: rai_audit_llm-0.1.8.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rai_audit_llm-0.1.8.tar.gz
Algorithm Hash digest
SHA256 1fd8a16b3024f8f3ef95b29b593e56de39f4e6b6e238e6a541ebba8d4fd2574a
MD5 08f62ca87254c373d70087e8d9652af9
BLAKE2b-256 6c7a084a9cede79dca64dc78259c208f260f934e6726bad71f089f02aec66d9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rai_audit_llm-0.1.8.tar.gz:

Publisher: publish.yml on SaiTeja-Erukude/rai-audit

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

File details

Details for the file rai_audit_llm-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: rai_audit_llm-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rai_audit_llm-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 98bbe75434b0cb023cff01cac0d5b37d0a18e077ef4d6fa6c808b40c2b822eb7
MD5 50754e03789dea79cfd145c6e5d86ddc
BLAKE2b-256 9a036d1866504fb700e301c4fb0cb0d525d984bbc994993c612fc019b9f20a8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rai_audit_llm-0.1.8-py3-none-any.whl:

Publisher: publish.yml on SaiTeja-Erukude/rai-audit

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