Skip to content

Commit 20b3945

Browse files
authored
Merge pull request #36 from m-misiura/add-claude-md
docs: Add CLAUDE.md
2 parents 2b15b8e + 69f0911 commit 20b3945

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

CLAUDE.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# CLAUDE.md - NVIDIA NeMo Guardrails (TrustyAI fork)
2+
3+
## Overview
4+
5+
NVIDIA NeMo Guardrails — toolkit for adding programmable guardrails to LLM apps.
6+
This is the **trustyai-fork** (`trustyai-explainability/NeMo-Guardrails`) with Red Hat / TrustyAI customisations.
7+
8+
## Repository layout
9+
10+
```
11+
nemoguardrails/ # main package
12+
rails/llm/llmrails.py # LLMRails — core engine
13+
rails/llm/config.py # RailsConfig
14+
server/api.py # FastAPI server (+ fork-specific /v1/guardrail/checks endpoint)
15+
actions/llm/utils.py # llm_call(), header forwarding
16+
context.py # context vars (request headers, runtime auth registry)
17+
logging/callbacks.py # LangChain callback handler (invocation param logging)
18+
library/ # built-in rails (30+ guardrail types)
19+
colang/v1_0/ # Colang v1
20+
colang/v2_x/ # Colang v2
21+
tests/ # pytest tests
22+
scripts/ # entrypoint, filter_guardrails, model discovery
23+
Dockerfile.server # UBI9 multi-stage build (fork-specific)
24+
```
25+
26+
## Git remotes
27+
28+
- `upstream` — NVIDIA/NeMo-Guardrails (original)
29+
- `trustyai-fork` — trustyai-explainability/NeMo-Guardrails
30+
- `midstream` — opendatahub-io/NeMo-Guardrails
31+
- `downstream` — red-hat-data-services/NeMo-Guardrails
32+
33+
Default branch with the latest changes: `develop`
34+
35+
## Build and install python package
36+
37+
```bash
38+
# Install with Poetry (Python 3.10-3.13)
39+
poetry install --all-extras
40+
```
41+
42+
## Running the server locally
43+
44+
```bash
45+
# Start with a config directory (each subdirectory is a config_id)
46+
nemoguardrails server --config /path/to/configs --port 8000
47+
48+
# With a default config and verbose logging
49+
nemoguardrails server --config /path/to/configs --default-config-id my-config --verbose
50+
```
51+
52+
## Running tests
53+
54+
```bash
55+
# All tests
56+
pytest tests/
57+
58+
# Specific test file
59+
pytest tests/test_header_forwarding.py -v
60+
61+
# Fork-specific tests
62+
pytest tests/test_guardrail_checks_api.py -v
63+
```
64+
65+
## CI
66+
67+
PR workflows (`.github/workflows/pr-tests.yml``_test.yml`):
68+
69+
1. `poetry check --lock` — lock file must be in sync with `pyproject.toml`
70+
2. `pytest` across Python 3.10, 3.11, 3.12, 3.13 (coverage on 3.11)
71+
72+
Fork-specific (`security.yml`): Trivy + Bandit scans on PRs and pushes to `develop`.
73+
74+
## Key fork changes
75+
76+
- `/v1/guardrail/checks` endpoint — check messages against rails without LLM generation
77+
- Header forwarding — X-* headers forwarded to LLM providers, auth token redaction in logs
78+
- `Dockerfile.server` — UBI9 multi-stage build with baked-in models
79+
- `scripts/filter_guardrails.py` — open/closed source guardrail filtering via profiles
80+
- `requirements.txt` — pinned deps via `uv pip compile`

0 commit comments

Comments
 (0)