# prateek1771/jev_lab architecture

> Architecture diagram of the GitHub repository prateek1771/jev_lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prateek1771/jev_lab
- Repository: https://github.com/prateek1771/jev_lab

## Overview

Jev Lab compares Jev, LLM, and plain-code approaches across 24 independent AI decision experiments. Users select an experiment, submit one example or run its labeled dataset, then inspect outcomes and reports in the Next.js or Streamlit UI. The API exposes experiment metadata, live and streamed dataset runs, saved-run reports, and downloads. The experiments span classification and scoring, routing and tool safety, retrieval and verification, and agent and business workflows. Their implementations vary; the sampled clients show Jev and OpenRouter calls, while unsampled project details are represented only at the documented experiment-suite level.

Main entry points: [`projects`](https://github.com/prateek1771/jev_lab/tree/main/projects) (Experiment suite), [`api/main.py`](https://github.com/prateek1771/jev_lab/blob/main/api/main.py) (Web API), [`app.py`](https://github.com/prateek1771/jev_lab/blob/main/app.py) (Streamlit UI), [`shared/openrouter.py`](https://github.com/prateek1771/jev_lab/blob/main/shared/openrouter.py) (Model-call helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_next["Next.js UI<br/>[page.tsx]"]
  node_streamlit["Streamlit UI<br/>[app.py]"]
  node_uilayer["Streamlit rendering<br/>[ui.py]"]
end

subgraph group_service["API and orchestration"]
  node_webapi["Web API<br/>[main.py]"]
  node_discovery["Project discovery<br/>[projects.py]"]
end

subgraph group_experiments["Decision experiments"]
  node_execution["Experiment suite"]
  node_classify["Classification and scoring"]
  node_routing["Routing and tool gates"]
  node_retrieval["RAG and citation checks"]
  node_safety["Safety and detection"]
  node_agents["Agents and workflows"]
  node_context["Context and memory"]
end

subgraph group_providers["Model integrations"]
  node_shared["Model-call helpers<br/>[openrouter.py]"]
  node_settings["Provider settings<br/>[settings.py]"]
end

subgraph group_analysis["Results and reporting"]
  node_runmodel["Run and result<br/>[run.py]"]
  node_report["Metrics and reports<br/>[report.py]"]
  node_savedruns[("Saved dataset runs")]
end

node_user(("User"))
node_jev["OpenRouter service"]

node_user -->|"uses"| node_next
node_user -->|"uses"| node_streamlit
node_next -->|"requests data"| node_webapi
node_webapi -->|"discovers projects"| node_discovery
node_streamlit -->|"discovers projects"| node_discovery
node_webapi -->|"runs experiment"| node_execution
node_streamlit -->|"runs experiment"| node_execution
node_execution -->|"uses shared calls"| node_shared
node_shared -->|"reads settings"| node_settings
node_shared -->|"calls API"| node_jev
node_execution -->|"returns results"| node_runmodel
node_webapi -->|"builds reports"| node_report
node_webapi -->|"writes and reads"| node_savedruns
node_webapi -->|"serializes results"| node_runmodel
node_streamlit -->|"renders results"| node_uilayer
node_uilayer -->|"formats batch results"| node_report
node_execution -.->|"includes"| node_classify
node_execution -.->|"includes"| node_routing
node_execution -.->|"includes"| node_retrieval
node_execution -.->|"includes"| node_safety
node_execution -.->|"includes"| node_agents
node_execution -.->|"includes"| node_context

click node_next "https://github.com/prateek1771/jev_lab/blob/main/web/app/page.tsx"
click node_streamlit "https://github.com/prateek1771/jev_lab/blob/main/app.py"
click node_webapi "https://github.com/prateek1771/jev_lab/blob/main/api/main.py"
click node_discovery "https://github.com/prateek1771/jev_lab/blob/main/core/projects.py"
click node_execution "https://github.com/prateek1771/jev_lab/tree/main/projects"
click node_classify "https://github.com/prateek1771/jev_lab/tree/main/projects/01_classification"
click node_routing "https://github.com/prateek1771/jev_lab/tree/main/projects/04_routing"
click node_retrieval "https://github.com/prateek1771/jev_lab/tree/main/projects/08_rag_filter"
click node_safety "https://github.com/prateek1771/jev_lab/tree/main/projects/11_injection_detector"
click node_agents "https://github.com/prateek1771/jev_lab/tree/main/projects/16_agent_router"
click node_context "https://github.com/prateek1771/jev_lab/tree/main/projects/21_context_filter"
click node_shared "https://github.com/prateek1771/jev_lab/blob/main/shared/openrouter.py"
click node_settings "https://github.com/prateek1771/jev_lab/blob/main/config/settings.py"
click node_runmodel "https://github.com/prateek1771/jev_lab/blob/main/core/run.py"
click node_report "https://github.com/prateek1771/jev_lab/blob/main/core/report.py"
click node_uilayer "https://github.com/prateek1771/jev_lab/blob/main/core/ui.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_next,node_streamlit,node_uilayer,node_user toneBlue
class node_webapi,node_discovery toneAmber
class node_execution,node_classify,node_routing,node_retrieval,node_safety,node_agents,node_context,node_jev toneMint
class node_shared,node_settings toneRose
class node_runmodel,node_report,node_savedruns toneIndigo
```

## Components

### User interfaces

- [Next.js UI](https://github.com/prateek1771/jev_lab/blob/main/web/app/page.tsx): `web/app/page.tsx`
- [Streamlit UI](https://github.com/prateek1771/jev_lab/blob/main/app.py): `app.py`
- [Streamlit rendering](https://github.com/prateek1771/jev_lab/blob/main/core/ui.py): `core/ui.py`

### API and orchestration

- [Web API](https://github.com/prateek1771/jev_lab/blob/main/api/main.py): `api/main.py`
- [Project discovery](https://github.com/prateek1771/jev_lab/blob/main/core/projects.py): `core/projects.py`

### Decision experiments

- [Experiment suite](https://github.com/prateek1771/jev_lab/tree/main/projects): `projects`
- [Classification and scoring](https://github.com/prateek1771/jev_lab/tree/main/projects/01_classification): `projects/01_classification`
- [Routing and tool gates](https://github.com/prateek1771/jev_lab/tree/main/projects/04_routing): `projects/04_routing`
- [RAG and citation checks](https://github.com/prateek1771/jev_lab/tree/main/projects/08_rag_filter): `projects/08_rag_filter`
- [Safety and detection](https://github.com/prateek1771/jev_lab/tree/main/projects/11_injection_detector): `projects/11_injection_detector`
- [Agents and workflows](https://github.com/prateek1771/jev_lab/tree/main/projects/16_agent_router): `projects/16_agent_router`
- [Context and memory](https://github.com/prateek1771/jev_lab/tree/main/projects/21_context_filter): `projects/21_context_filter`

### Model integrations

- [Model-call helpers](https://github.com/prateek1771/jev_lab/blob/main/shared/openrouter.py): `shared/openrouter.py`
- [Provider settings](https://github.com/prateek1771/jev_lab/blob/main/config/settings.py): `config/settings.py`

### Results and reporting

- [Run and result](https://github.com/prateek1771/jev_lab/blob/main/core/run.py): `core/run.py`
- [Metrics and reports](https://github.com/prateek1771/jev_lab/blob/main/core/report.py): `core/report.py`
- **Saved dataset runs**

### Other components

- **User**
- **OpenRouter service**

## Connections

- User → Next.js UI: uses
- User → Streamlit UI: uses
- Next.js UI → Web API: requests data
- Web API → Project discovery: discovers projects
- Streamlit UI → Project discovery: discovers projects
- Web API → Experiment suite: runs experiment
- Streamlit UI → Experiment suite: runs experiment
- Experiment suite → Model-call helpers: uses shared calls
- Model-call helpers → Provider settings: reads settings
- Model-call helpers → OpenRouter service: calls API
- Experiment suite → Run and result: returns results
- Web API → Metrics and reports: builds reports
- Web API → Saved dataset runs: writes and reads
- Web API → Run and result: serializes results
- Streamlit UI → Streamlit rendering: renders results
- Streamlit rendering → Metrics and reports: formats batch results
- Experiment suite → Classification and scoring: includes
- Experiment suite → Routing and tool gates: includes
- Experiment suite → RAG and citation checks: includes
- Experiment suite → Safety and detection: includes
- Experiment suite → Agents and workflows: includes
- Experiment suite → Context and memory: includes
