Skip to content

Commit 5a10969

Browse files
committed
Merge remote-tracking branch 'origin/v2' into feat/agent-framework-integration
2 parents 65ebd29 + 9904510 commit 5a10969

40 files changed

Lines changed: 4162 additions & 33 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ venv.bak/
114114
# Milvus DB
115115
db/
116116
*.db
117+
*.db.lock
117118

118119
# Project files
119120
tmp/

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ brew install cairo pango gdk-pixbuf libffi
6666
uv pip install weasyprint
6767
```
6868

69+
You can also run MMORE on Windows by following our [Windows setup notes](docs/source/getting_started/windows.md).
70+
6971
#### Step 1 – Install MMORE
7072

7173
Dependencies are split by pipeline stage. Install only what you need:
@@ -103,6 +105,22 @@ uv pip install "mmore[process,cpu]"
103105
104106
> :warning: **Check the instructions for contributors directly at [`docs/for_devs.md`](./docs/for_devs.md)**
105107
108+
### Interactive TUI
109+
110+
Prefer a guided experience over editing YAML by hand? Install the `tui` extra and launch the interactive Terminal UI:
111+
112+
```bash
113+
uv sync --extra tui
114+
mmore tui
115+
```
116+
117+
From the launcher you can:
118+
119+
- run any stage (process / postprocess / index / rag / chat) interactively,
120+
- chain the full pipeline (process → postprocess → index → chat),
121+
- generate stage YAML configs through a guided wizard,
122+
- pick from existing example configs without leaving the terminal.
123+
106124
### Minimal Example
107125

108126
You can use our predefined CLI commands to execute parts of the pipeline. Note that you might need to prepend `python -m` to the command if the package does not properly create bash aliases.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# LLM as a judge
2+
3+
Add a `judge:` block to your RAG config to check retrieval quality before generation. When chunks are not good enough, the judge can trigger a corrective action such as re-search, sub-questions, or web context and then merge everything into one deduplicated list.
4+
5+
## How it works
6+
7+
1. Retrieve chunks from the index (Milvus + optional BGE rerank).
8+
2. Evaluate them in a loop (at most `max_corrective_steps` corrective actions, default `1`):
9+
- **`PROCEED` without calling the judge LLM** when index metrics meet `metric_thresholds` — retrieval is already considered good enough.
10+
- Otherwise, call `judge.llm` and run the chosen corrective action.
11+
- Repeat on the merged chunks until the judge says `PROCEED` or the step budget is exhausted.
12+
3. Generate the answer from the final context.
13+
14+
Disallowed decisions are coerced to a fallback action (`RE_RETRIEVE`, `ADD_QUESTIONS`, or `PROCEED`). Invalid JSON defaults to `PROCEED`.
15+
16+
## Decisions
17+
18+
19+
| Decision | What it does |
20+
| --------------- | --------------------------------------------------------------- |
21+
| `PROCEED` | Chunks are good enough; continue to the answer LLM |
22+
| `RE_RETRIEVE` | Search the index again (reformulated query and/or more results) |
23+
| `ADD_QUESTIONS` | Up to 3 extra searches from sub-questions, then merge |
24+
| `ADD_CONTEXT` | DuckDuckGo web snippets, then merge |
25+
26+
27+
## Configuration
28+
29+
`examples/rag/config_judge.yaml` is a standalone config — it does not load on top of `config.yaml`.
30+
31+
```bash
32+
python3 -m mmore rag --config-file examples/rag/config_judge.yaml
33+
```
34+
35+
Or copy the `judge:` block into your own config.
36+
37+
Key settings under `rag.judge`:
38+
39+
- `metric_thresholds` — index minimums (`min_mean_similarity`, `min_max_rerank_score`, `min_num_docs`, …)
40+
- `max_corrective_steps` — how many corrective actions after the first retrieval
41+
- `allow_re_retrieve` / `allow_add_questions` / `allow_add_context` — which corrective actions the judge may choose (see below)
42+
- `system_prompt` / `user_prompt` — judge prompts; user prompt supports `{query}`, `{metrics}`, `{chunks}`, `{allowed_actions}`, and correction-step placeholders
43+
44+
### Using one corrective action
45+
46+
In your RAG config, under `**rag.judge**`, set `allow_re_retrieve`, `allow_add_questions`, and `allow_add_context` so **only one** corrective action is `true` (the others `false`). `PROCEED` is always available in `{allowed_actions}`.
47+
48+
When `**metric_thresholds` are met**, the pipeline `**PROCEEDS` immediately** without calling the judge LLM: index retrieval is already of high quality (similarity, rerank scores, enough documents).
49+
50+
When **thresholds fail**, the judge LLM is invoked. With a single corrective action enabled, it **systematically chooses that action** and fills the matching payload (`extra_questions`, `web_query`, or `retrieve_params`). Use a query suited to that action (multi-part question → `ADD_QUESTIONS`; missing corpus fact → `ADD_CONTEXT`; weak or mis-phrased retrieval → `RE_RETRIEVE`). Adjust `system_prompt` / `user_prompt` under `rag.judge` if needed.
51+
52+
53+
| Goal | `rag.judge` `allow_`* settings |
54+
| ------------------------------- | ----------------------------------------------------------------------------------- |
55+
| Sub-questions (`ADD_QUESTIONS`) | `allow_add_questions: true`, `allow_add_context: false`, `allow_re_retrieve: false` |
56+
| Web context (`ADD_CONTEXT`) | `allow_add_context: true`, `allow_add_questions: false`, `allow_re_retrieve: false` |
57+
| Re-retrieval (`RE_RETRIEVE`) | `allow_re_retrieve: true`, `allow_add_questions: false`, `allow_add_context: false` |
58+
59+
60+
Examples: `examples/rag/demo/config_add_questions.yaml`, `config_judge_add_questions.yaml`.
61+
62+
For `ADD_CONTEXT`, install web search support:
63+
64+
```bash
65+
pip install "mmore[rag,websearch]"
66+
```
67+
68+
## See also
69+
70+
- [RAG](../getting_started/rag.md)
71+
- [Websearch](websearch.md)
72+

docs/source/developer_documentation/for_devs.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ This guide will help you set up your development environment and contribute to t
3131
- [Writing tests](#writing-tests)
3232
- [🔀 Pull Request Process](#-pull-request-process)
3333
- [PR checklist](#pr-checklist)
34+
- [🖥️ Interactive TUI](#️-interactive-tui)
3435
- [💡 Development tips](#-development-tips)
3536
- [Working with `uv`](#working-with-uv)
3637
- [❓ Questions](#-questions)
@@ -256,6 +257,25 @@ def test_something_on_gpu():
256257
- [ ] Examples are provided for new features
257258
- [ ] Commit messages are clear and descriptive
258259

260+
## 🖥️ Interactive TUI
261+
262+
MMORE ships with a Terminal UI that wraps the CLI commands behind guided menus and config wizards. Useful for trying the pipeline without writing YAML by hand.
263+
264+
Launch it from a project working directory:
265+
266+
```bash
267+
mmore tui
268+
```
269+
270+
From the main menu you can:
271+
272+
- **Run a single command** — pick any stage (`process`, `postprocess`, `index`, `retrieve`, `rag`, `ragcli`, `websearch`), then either select an existing YAML, generate one through a guided wizard, or type a path manually. Generated configs are written to `./tui-configs/` and validated against the stage's dataclass before running.
273+
- **Run full pipeline** — chains `process → postprocess → index` using existing configs.
274+
- **Build a full pipeline config (guided wizard)** — walks through the three stages in order, wiring the postprocess output JSONL into the index config automatically.
275+
- **Chat with indexed documents** — shortcut to `ragcli`.
276+
277+
Stages whose extras are missing are disabled in the menu with an install hint (e.g. `uv sync --extra rag --extra cpu`). Press `Ctrl-C` inside any sub-flow to cancel back to the main menu; press it again at the main menu to quit.
278+
259279
## 💡 Development tips
260280

261281
### Working with `uv`

docs/source/developer_documentation/retriever_api_specs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ paths:
265265
type: string
266266
chunkId:
267267
type: string
268+
filename:
269+
type: string
270+
nullable: true
271+
description: Original filename of the source document.
268272
content:
269273
type: string
270274
metadata:

docs/source/getting_started/installation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,4 @@ For a manual non-Docker setup, use either the standard installation or the `uv`
216216
- [Quickstart](quickstart.md)
217217
- [Process](process.md)
218218
- [uv workflow](../advanced_usage/uv.md)
219+
- [Running on Windows](windows.md) — what differs on Windows and how to fix it
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# 🪟 Running MMORE on Windows
2+
3+
## Overview
4+
5+
MMORE was developed and tested mainly on Linux. It runs on Windows too, but a few things behave differently. This page lists those differences and the fix for each one.
6+
7+
If you work on Linux or macOS, you can skip this page.
8+
9+
## 1. Install the prerequisites
10+
11+
Unlike most Linux distributions, Windows does not ship Python, Git, or FFmpeg.
12+
Install them first with
13+
[winget](https://learn.microsoft.com/windows/package-manager/winget/):
14+
15+
```powershell
16+
winget install Python.Python.3.11
17+
winget install Git.Git
18+
winget install astral-sh.uv
19+
winget install Gyan.FFmpeg
20+
```
21+
22+
Then clone the repo and install MMORE into a virtual environment:
23+
24+
```powershell
25+
git clone https://github.com/swiss-ai/mmore.git
26+
cd mmore
27+
uv venv
28+
.venv\Scripts\activate
29+
uv pip install -e ".[all,cu126]"
30+
```
31+
32+
Use `cu126` for an NVIDIA GPU, or `cpu` otherwise. See the
33+
[README](https://github.com/swiss-ai/mmore#step-1--install-mmore) for the full
34+
list of extras.
35+
36+
## 2. `milvus-lite` is not available on Windows
37+
38+
Every example config whose `db.uri` is `./proc_demo.db` relies on `milvus-lite`
39+
(`examples/index/config.yaml`, `examples/retriever_api/config.yaml`,
40+
`examples/rag/config.yaml`, `examples/rag/config_api.yaml`). There is no Windows
41+
build of `milvus-lite`, so any of them fails with:
42+
43+
```
44+
ModuleNotFoundError: No module named 'milvus_lite'
45+
```
46+
47+
### Fix: run Milvus in Docker
48+
49+
This repo ships no Compose file, so download the official Milvus standalone one
50+
matching your installed `pymilvus` version (see the
51+
[Milvus install docs](https://milvus.io/docs/install_standalone-docker-compose.md)):
52+
53+
```powershell
54+
# Download the Milvus docker compose file from GitHub
55+
Invoke-WebRequest `
56+
-Uri "https://github.com/milvus-io/milvus/releases/download/v2.6.6/milvus-standalone-docker-compose.yml" `
57+
-OutFile "milvus-docker-compose.yml"
58+
# Start Milvus containers
59+
docker compose -f milvus-docker-compose.yml up -d
60+
```
61+
62+
Wait about a minute, then check `docker ps` shows the three containers
63+
(`etcd`, `minio`, `milvus-standalone`) as `(healthy)`.
64+
65+
### Create the database
66+
67+
MMORE does not create the database automatically when connecting to a remote Milvus. Run this once:
68+
69+
```powershell
70+
python -c "from pymilvus import connections, db; connections.connect(uri='http://127.0.0.1:19530'); db.create_database('my_db')"
71+
```
72+
73+
### Point the configs at the Docker instance
74+
75+
The `db` block lives at a different level depending on the config. Change
76+
`uri: ./proc_demo.db` to `uri: http://127.0.0.1:19530` in each one you use.
77+
78+
`examples/retriever_api/config.yaml` (and `examples/rag/config*.yaml`) — `db`
79+
is at the root:
80+
81+
```yaml
82+
db:
83+
uri: http://127.0.0.1:19530
84+
name: my_db
85+
```
86+
87+
`examples/index/config.yaml` — `db` is nested under `indexer`:
88+
89+
```yaml
90+
indexer:
91+
db:
92+
uri: http://127.0.0.1:19530
93+
name: my_db
94+
```
95+
96+
### Check that the setup works
97+
98+
Once Milvus is running, confirm the connection:
99+
100+
```powershell
101+
python -c "from pymilvus import MilvusClient; c = MilvusClient(uri='http://127.0.0.1:19530', db_name='my_db'); print(c.list_collections())"
102+
```
103+
104+
This returns a list of collections (empty before you index anything).
105+
106+
## 3. Surya OCR can crash the process on large PDFs
107+
108+
When processing large PDFs, the surya-based OCR may crash with:
109+
110+
```
111+
Process finished with exit code 0xC0000005
112+
```
113+
114+
This is a hard crash inside a native dependency. On Windows, use the fast processors instead, which rely on PyMuPDF rather than surya.
115+
116+
In your `process` config, `use_fast_processors` goes under `dispatcher_config`:
117+
118+
```yaml
119+
dispatcher_config:
120+
use_fast_processors: true
121+
```
122+
123+
You lose some accuracy on heavily scanned PDFs, but the pipeline no longer crashes.
124+
125+
## See also
126+
127+
- [Installation](installation.md)
128+
- [Quickstart](quickstart.md)

docs/source/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ getting_started/architecture
4141
getting_started/process
4242
getting_started/indexing
4343
getting_started/rag
44+
getting_started/windows
4445
```
4546

4647
```{toctree}
@@ -50,6 +51,7 @@ getting_started/rag
5051
core_features/colpali
5152
core_features/websearch
5253
core_features/evaluation
54+
core_features/llm_as_a_judge
5355
```
5456

5557
```{toctree}
@@ -75,6 +77,7 @@ developer_documentation/index_api
7577
Here is a quick overview of the main pages:
7678

7779
- [Installation](getting_started/installation.md): set up MMORE and prepare your environment
80+
- [Running on Windows](getting_started/windows.md): what differs on Windows and how to fix it
7881
- [Quickstart](getting_started/quickstart.md): run a first minimal workflow end to end
7982
- [Architecture](getting_started/architecture.md): understand the main system components and how they interact
8083
- [Processing pipeline](getting_started/process.md): understand how documents are ingested and transformed
@@ -83,6 +86,7 @@ Here is a quick overview of the main pages:
8386
- [ColPali](core_features/colpali.md): multimodal retrieval-related documentation
8487
- [Websearch](core_features/websearch.md): web search integration and related workflows
8588
- [Evaluation](core_features/evaluation.md): assess system performance
89+
- [LLM as a judge](core_features/llm_as_a_judge.md): corrective retrieval with an LLM judge
8690
- [Distributed processing](advanced_usage/distributed_processing.md): scale processing across larger workloads
8791
- [Profiler](advanced_usage/profiler.md): profile and analyze performance
8892
- [uv](advanced_usage/uv.md): environment and dependency workflow

0 commit comments

Comments
 (0)