Skip to content

Commit 17541c4

Browse files
author
Vish Devarajan
committed
updated examples
1 parent 9ece229 commit 17541c4

3 files changed

Lines changed: 71 additions & 1 deletion

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
__pycache__/
22
*.pyc
33
.pytest_cache/
4+
.mypy_cache/
5+
.ruff_cache/
46
.venv/
57
dist/
68
build/
79
*.egg-info/
10+
.coverage
811
.DS_Store
912
.env
10-
13+
.idea/
14+
*.tgz

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ Enterprise deployments can also enrich emitted events with SSO/user context and
8989

9090
Use `BlackwallFastAPIMiddleware`, `create_flask_middleware()`, `create_langchain_callbacks()`, or `create_llamaindex_callback()` to wire Blackwall into framework or orchestration entry points with less glue code.
9191

92+
### Example guide
93+
94+
Use the wiki-ready examples page at [`wiki/Running-Examples.md`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/wiki/Running-Examples.md) for copy-paste setup and run commands.
95+
9296
### Zero-config UI and sidecar
9397

9498
Run `python -m blackwall_llm_shield.ui` for a local dashboard, or build from [`Dockerfile`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/Dockerfile) to expose Blackwall as a local sidecar proxy for non-Python stacks.
@@ -395,6 +399,7 @@ Produces signed events you can summarize into operations dashboards or audit pip
395399
- [`examples/python-fastapi/main.py`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/main.py)
396400
- [`examples/python-fastapi/dashboard_model.py`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/dashboard_model.py)
397401
- [`examples/python-fastapi/streamlit_app.py`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/streamlit_app.py)
402+
- [`wiki/Running-Examples.md`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/wiki/Running-Examples.md)
398403

399404
## Release Commands
400405

wiki/Running-Examples.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Running Examples
2+
3+
This page is wiki-ready and can be copied directly into the GitHub Wiki for the Python package if you want the examples guide to live there permanently.
4+
5+
## Available Examples
6+
7+
- `examples/python-fastapi`
8+
9+
## FastAPI Gateway Example
10+
11+
Path: [`examples/python-fastapi`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi)
12+
13+
This example shows a Python gateway that applies Blackwall middleware before requests reach your LLM route, plus a small Streamlit dashboard for security visibility.
14+
15+
### Run the API
16+
17+
1. Create and activate a virtual environment.
18+
2. Install the example requirements.
19+
3. Copy environment values from [`.env.example`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/.env.example).
20+
4. Start the API:
21+
22+
```bash
23+
cd examples/python-fastapi
24+
python3 -m venv .venv
25+
source .venv/bin/activate
26+
pip install -r requirements.txt
27+
uvicorn main:app --reload
28+
```
29+
30+
The API will start on `http://127.0.0.1:8000`.
31+
32+
### Run the Dashboard
33+
34+
In a second terminal, from the same folder:
35+
36+
```bash
37+
source .venv/bin/activate
38+
streamlit run streamlit_app.py
39+
```
40+
41+
### What It Demonstrates
42+
43+
- `BlackwallFastAPIMiddleware` on `/chat`
44+
- request interception before model access
45+
- telemetry and audit-friendly event handling
46+
- a simple local dashboard for security operations
47+
48+
### Main Files
49+
50+
- [`main.py`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/main.py)
51+
- [`streamlit_app.py`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/streamlit_app.py)
52+
- [`dashboard_model.py`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/dashboard_model.py)
53+
- [`requirements.txt`](/Users/vishnu/Documents/blackwall-llm-shield/blackwall-llm-shield-python/examples/python-fastapi/requirements.txt)
54+
55+
## Suggested Wiki Placement
56+
57+
If you want this to live in the GitHub Wiki instead of the repo tree, publish it as:
58+
59+
- `Running Examples`
60+
61+
and keep the in-repo copy as the source of truth for future edits.

0 commit comments

Comments
 (0)