# hasanimer/banchmark-turkishlaw architecture

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

- Interactive diagram: https://gitdiagram.com/hasanimer/banchmark-turkishlaw
- Repository: https://github.com/hasanimer/banchmark-turkishlaw

## Overview

TRLawBench-Practice evaluates how well language models handle Turkish legal-practice tasks. The main workflow loads legal questions and a mode-specific prompt, queries a candidate model, saves raw answers, grades them deterministically or with an LLM judge, and writes scored results. The dashboard then presents comparisons and per-question reviews, including human score overrides. The README also describes broad legal-task coverage and open-/closed-book modes. The graph follows documented and excerpted relationships; output directories and some dashboard interactions are documented but not present in the supplied tree.

Main entry points: [`src/runner.py`](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/runner.py) (Evaluation runner), [`src/evaluator.py`](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/evaluator.py) (Run evaluator), [`src/models.py`](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/models.py) (Model API wrapper), [`dashboard/app.py`](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/dashboard/app.py) (Dashboard and leaderboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_benchmark["Benchmark inputs"]
  node_question_bank["Legal question bank"]
  node_prompt_templates["Evaluation prompts"]
end

subgraph group_execution["Evaluation runtime"]
  node_runner["Evaluation runner<br/>[runner.py]"]
  node_configuration["Runtime configuration<br/>[config.py]"]
  node_evaluator["Run evaluator<br/>[evaluator.py]"]
  node_mcq_grading["Deterministic MCQ grading<br/>[evaluator.py]"]
  node_judge_grading["LLM judge grading<br/>[evaluator.py]"]
end

subgraph group_review["Results and review"]
  node_raw_results["Raw run results"]
  node_scored_results["Scored run results"]
  node_dashboard["Dashboard and leaderboard<br/>[app.py]"]
  node_human_review["Human review and override<br/>[app.py]"]
end

subgraph group_integrations["Model integrations"]
  node_model_wrapper["Model API wrapper<br/>[models.py]"]
end

node_lawyer(("Benchmark user"))
node_candidate_models{{"Candidate LLMs"}}
node_judge_model{{"Judge LLM"}}

node_lawyer -->|"starts run"| node_runner
node_runner -->|"loads questions"| node_question_bank
node_runner -->|"loads template"| node_prompt_templates
node_runner -->|"uses paths"| node_configuration
node_runner -->|"requests completion"| node_model_wrapper
node_model_wrapper -->|"maps models"| node_configuration
node_model_wrapper -->|"calls provider"| node_candidate_models
node_runner -->|"writes answers"| node_raw_results
node_lawyer -->|"grades run"| node_evaluator
node_evaluator -->|"reads run"| node_raw_results
node_evaluator -->|"grades MCQs"| node_mcq_grading
node_evaluator -->|"grades open-ended"| node_judge_grading
node_judge_grading -->|"loads rubric"| node_prompt_templates
node_judge_grading -->|"requests judgment"| node_model_wrapper
node_judge_grading -->|"selects judge"| node_configuration
node_model_wrapper -->|"calls provider"| node_judge_model
node_evaluator -->|"writes scores"| node_scored_results
node_dashboard -->|"uses result paths"| node_configuration
node_dashboard -->|"loads and saves"| node_scored_results
node_lawyer -->|"reviews results"| node_dashboard
node_dashboard -->|"offers review form"| node_human_review
node_human_review -->|"saves overrides"| node_scored_results

click node_question_bank "https://github.com/hasanimer/banchmark-turkishlaw/tree/main/data/questions"
click node_prompt_templates "https://github.com/hasanimer/banchmark-turkishlaw/tree/main/prompts"
click node_runner "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/runner.py"
click node_configuration "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/config.py"
click node_model_wrapper "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/models.py"
click node_evaluator "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/evaluator.py"
click node_mcq_grading "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/evaluator.py"
click node_judge_grading "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/evaluator.py"
click node_dashboard "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/dashboard/app.py"
click node_human_review "https://github.com/hasanimer/banchmark-turkishlaw/blob/main/dashboard/app.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_question_bank,node_prompt_templates,node_lawyer toneBlue
class node_runner,node_configuration,node_evaluator,node_mcq_grading,node_judge_grading toneAmber
class node_raw_results,node_scored_results,node_dashboard,node_human_review toneMint
class node_model_wrapper toneRose
class node_candidate_models,node_judge_model toneIndigo
```

## Components

### Benchmark inputs

- [Legal question bank](https://github.com/hasanimer/banchmark-turkishlaw/tree/main/data/questions): `data/questions`
- [Evaluation prompts](https://github.com/hasanimer/banchmark-turkishlaw/tree/main/prompts): `prompts`

### Evaluation runtime

- [Evaluation runner](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/runner.py): `src/runner.py`
- [Runtime configuration](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/config.py): `src/config.py`
- [Run evaluator](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/evaluator.py): `src/evaluator.py`
- [Deterministic MCQ grading](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/evaluator.py): `src/evaluator.py`
- [LLM judge grading](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/evaluator.py): `src/evaluator.py`

### Results and review

- **Raw run results**
- **Scored run results**
- [Dashboard and leaderboard](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/dashboard/app.py): `dashboard/app.py`
- [Human review and override](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/dashboard/app.py): `dashboard/app.py`

### Model integrations

- [Model API wrapper](https://github.com/hasanimer/banchmark-turkishlaw/blob/main/src/models.py): `src/models.py`

### Other components

- **Benchmark user**
- **Candidate LLMs**
- **Judge LLM**

## Connections

- Benchmark user → Evaluation runner: starts run (evidence: `README.md`)
- Evaluation runner → Legal question bank: loads questions (evidence: `src/runner.py`)
- Evaluation runner → Evaluation prompts: loads template (evidence: `src/runner.py`)
- Evaluation runner → Runtime configuration: uses paths (evidence: `src/runner.py`)
- Evaluation runner → Model API wrapper: requests completion (evidence: `src/runner.py`)
- Model API wrapper → Runtime configuration: maps models (evidence: `src/models.py`)
- Model API wrapper → Candidate LLMs: calls provider (evidence: `src/models.py`)
- Evaluation runner → Raw run results: writes answers (evidence: `src/runner.py`)
- Benchmark user → Run evaluator: grades run (evidence: `README.md`)
- Run evaluator → Raw run results: reads run (evidence: `src/evaluator.py`)
- Run evaluator → Deterministic MCQ grading: grades MCQs (evidence: `src/evaluator.py`)
- Run evaluator → LLM judge grading: grades open-ended (evidence: `src/evaluator.py`)
- LLM judge grading → Evaluation prompts: loads rubric (evidence: `src/evaluator.py`)
- LLM judge grading → Model API wrapper: requests judgment (evidence: `src/evaluator.py`)
- LLM judge grading → Runtime configuration: selects judge (evidence: `src/evaluator.py`)
- Model API wrapper → Judge LLM: calls provider
- Run evaluator → Scored run results: writes scores (evidence: `src/evaluator.py`)
- Dashboard and leaderboard → Runtime configuration: uses result paths (evidence: `dashboard/app.py`)
- Dashboard and leaderboard → Scored run results: loads and saves (evidence: `dashboard/app.py`)
- Benchmark user → Dashboard and leaderboard: reviews results (evidence: `README.md`)
- Dashboard and leaderboard → Human review and override: offers review form (evidence: `dashboard/app.py`)
- Human review and override → Scored run results: saves overrides (evidence: `dashboard/app.py`)
