Metadata-Version: 2.4
Name: rai-audit-llm
Version: 0.1.8
Summary: LLM and RAG audits including safety, security, hallucination, and citation checks
Author: Sai Teja Erukude
License: MIT License
        
        Copyright (c) 2026 Sai Teja Erukude
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: hallucination,llm,prompt-injection,rag,responsible-ai
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Requires-Dist: pyyaml>=6.0
Requires-Dist: rai-audit-core>=0.1.0
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.20; extra == 'anthropic'
Provides-Extra: openai
Requires-Dist: openai>=1.0; extra == 'openai'
Description-Content-Type: text/markdown

# 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:

```bash
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

```python
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.
