[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116533":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":13,"contributorsCount":13,"subscribersCount":13,"size":13,"stars1d":13,"stars7d":15,"stars30d":15,"stars90d":13,"forks30d":13,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":38,"updatedAt":39,"readmeContent":40,"aiSummary":41,"trendingCount":13,"starSnapshotCount":13,"syncStatus":42,"lastSyncTime":43,"discoverSource":44},116533,"meridian-multimodal-rag","punit2911\u002Fmeridian-multimodal-rag","punit2911","Evidence-grounded multimodal RAG for industrial maintenance documentation, with hybrid retrieval, citations, conflict resolution, claim verification and abstention. Includes an optional tool-using LLM agent and deterministic offline mode.","",null,"Python",73,0,1,13,6,47.8,"MIT License",false,"main",true,[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"document-processing","fastapi","hybrid-search","industrial-maintenance","information-retrieval","llm","multimodal-rag","ocr","ollama","python","qdrant","rag","retrieval-augmented-generation","semantic-search","vector-search","2026-11-17 15:42:26","2026-11-22 15:55:13","# Meridian — evidence-grounded multimodal RAG\n\nMeridian answers questions about **industrial maintenance documentation**: PDF manuals (text, tables, charts, diagrams, warnings), scanned pages, Word service bulletins, CSV\u002FXLSX maintenance logs and photos of alarm panels or data plates. Every answer is **cited to a page region**, **verified claim by claim**, and **refused when the evidence is not there**.\n\nIt runs in **deterministic offline mode by default** (no API key, no GPU, no model download). When configured, an optional tool-using LLM agent (Anthropic or any OpenAI-compatible server, including Ollama) can search documents and look up specifications while composing answers. Its output goes through the same verifier, with the offline composer as fallback.\n\n![Ask tab](docs\u002Fask.png)\n\n## Why it is different\n\n| Typical RAG demo | Meridian |\n|---|---|\n| Chunk text, embed, top-k | Layout-aware parsing: tables → table + per-row chunks + typed numeric facts, warning call-outs, figures, OCR for scans, bounding boxes |\n| Charts and images ignored or captioned | A **chart digitiser** reads values off bar\u002Fline charts (calibrated axes, OCR-voted tick labels); image → figure retrieval with a visual descriptor |\n| One vector search | 8 retrieval channels (BM25, LSA dense, char-n-gram, entity, fact, visual, PRF, graph PageRank) → weighted RRF → late-interaction rerank → learned ranker hook → MMR |\n| Always answers | **CRAG-style grader** + corrective retries + abstention (unknown model, out-of-corpus terms) |\n| Conflicting sources silently mixed | **Provenance-aware conflict resolution** (bulletin supersedes manual) and false-premise detection |\n| \"The LLM said so\" | **Claim-level hallucination verifier** (units-aware numbers, identifiers, negation, references) with automatic repair |\n| Arithmetic by the LLM | **Tools**: exact pandas analytics over logs, unit conversion, chart interpolation |\n| Anecdotal quality | **Benchmark harness**: held-out split, ablations, bootstrap CIs, ECE\u002FBrier, hallucination injection |\n\n## Quick start (5 minutes)\n\nRequires Python 3.10+ and the Tesseract OCR program.\n\n```bash\n# 1. system OCR engine (once)\n#    Ubuntu\u002FDebian: sudo apt install tesseract-ocr     macOS: brew install tesseract\n#    Windows: install from https:\u002F\u002Fgithub.com\u002FUB-Mannheim\u002Ftesseract\u002Fwiki and add it to PATH\n\n# 2. get the code, then inside the project folder:\npython -m venv .venv\nsource .venv\u002Fbin\u002Factivate            # Windows: .venv\\Scripts\\activate\npip install -r requirements.txt\n\n# 3. start (first start ingests the demo corpus, ~30 s)\npython -m meridian --load-demo\n# open http:\u002F\u002F127.0.0.1:8000\n```\n\nDocker alternative: `docker compose up -d --build` (Tesseract and the free, self-hosted Qdrant vector database are included; open `http:\u002F\u002F127.0.0.1:8001`). The regular Python quick start remains fully offline and uses the in-memory dense index.\n\n### Docker live demo with 100 additional documents (Windows PowerShell)\n\nThe default Docker corpus loads 10 mixed-format demo documents. To add the generated stress notes without deleting them, start the app and upload the 100 `.txt`\u002F`.md` files once; the named Docker volume preserves them across restarts. Re-running the upload is safe because identical files are skipped.\n\n```powershell\n# First setup (build the Meridian image):\ndocker compose up -d --build\n```\n\n```powershell\n# Normal starts after the image has been built:\ndocker compose up -d --no-build\ndocker compose ps\n# Run once per fresh Docker volume; safe to repeat.\n.\\scripts\\upload_stress_docs.ps1\nStart-Process http:\u002F\u002F127.0.0.1:8001\n```\n\nCheck the loaded corpus with `Invoke-RestMethod http:\u002F\u002F127.0.0.1:8001\u002Fapi\u002Fhealth`. On a fresh Docker volume, the 10 defaults plus the uploaded stress corpus should total 110 documents.\n\n## Using it\n\n* **Ask** tab: type a question or click an example; attach\u002Fpaste a photo (e.g. `eval_data\u002Fimages\u002Fphoto_alarm_E47_hx500.png`). Watch the agent trace, click `[n]` to jump to evidence, “View source page” to see the highlighted region.\n* **Knowledge base** tab: drag in your own PDF\u002FDOCX\u002FCSV\u002FXLSX\u002FTXT\u002FMD\u002Fimages, delete documents, reload the demo corpus.\n* **Evaluation** tab: view or re-run the benchmark.\n\nGood demo questions: *What torque should I use for the HX-200 impeller bolt?* (conflict: manual 45 Nm vs bulletin 52 Nm) · *Is the HX-200 rated for fluid at 150 °C?* (false premise) · *What is the HX-500 specific power at 50% load?* (value read from a chart image) · *Which alarm code occurs most often in the maintenance log?* (exact analytics) · *Who is the CEO of Helix Dynamics?* (abstains).\n\n## Architecture and data flow\n\nMeridian has two connected pipelines: document changes build the knowledge base, and user questions retrieve and verify evidence from it.\n\n### Document ingestion and indexing\n\n```mermaid\nflowchart TD\n    A[\"PDF, DOCX, CSV\u002FXLSX, TXT\u002FMD, or image\"] --> B[\"Format-specific parsing\"]\n    B --> C[\"Citable chunks, metadata, and structured facts\"]\n    C --> D[\"Persist documents and chunks in SQLite\"]\n    C --> E[\"Save derived page images, figure crops, and table data\"]\n    D --> F[\"Build a new index snapshot\"]\n    F --> G[\"Lexical and character indexes\"]\n    F --> H[\"Entity, fact, visual, and graph indexes\"]\n    F --> I[\"Dense vectors: offline LSA by default\"]\n    I --> J[\"In-memory store (Python) or Qdrant (Docker Compose)\"]\n    G --> K[\"Swap in the complete snapshot\"]\n    H --> K\n    J --> K\n```\n\nParsers preserve useful structure: table rows become searchable evidence and facts; scanned pages use OCR; figures can be classified and charts digitized when readable; safety callouts remain separate evidence. Adding, replacing, or deleting a document automatically rebuilds the indexes from the stored corpus. The snapshot is swapped only after it is built, so retrieval does not use a partially rebuilt index. In the Docker setup, Qdrant is the dense-vector backend; the other indexes are built by Meridian.\n\n### Question answering\n\n```mermaid\nflowchart TD\n    A[\"Question and optional image\"] --> B[\"Starlette API\"]\n    B --> C[\"Optional image perception\"]\n    C --> D[\"Analyze intent, model, codes, quantities, and premise\"]\n    D --> E{\"Unknown model named?\"}\n    E -->|\"Yes\"| X[\"Abstain rather than answer for another model\"]\n    E -->|\"No\"| F{\"Log analytics intent?\"}\n    F -->|\"Yes\"| G[\"Exact pandas calculation over uploaded log\"]\n    G -->|\"Computed\"| L\n    G -->|\"Not applicable\"| H\n    F -->|\"No\"| H[\"Hybrid document retrieval\"]\n    H --> I[\"BM25, dense, character, entity, fact, visual, and PRF candidates\"]\n    I --> J[\"Weighted rank fusion, graph expansion, reranking, and MMR\"]\n    J --> K{\"Evidence grader\"}\n    K -->|\"Insufficient; retries remain\"| H\n    K -->|\"Still insufficient\"| X\n    K -->|\"Supported or ambiguous\"| M[\"Expand evidence and run relevant tools\"]\n    M --> N[\"Spec lookup and conflict resolution; chart reading; premise checks\"]\n    N --> L{\"Answer composer\"}\n    L -->|\"Default \u002F fallback\"| O[\"Offline evidence-extractive composer\"]\n    L -->|\"LLM configured\"| P[\"Optional tool-using LLM writer\"]\n    P -->|\"May call\"| Q[\"search_documents or lookup_spec\"]\n    Q --> P\n    O --> R[\"Claim-level verifier\"]\n    P --> R\n    R -->|\"Unsupported claim\"| S[\"Repair, fall back, or abstain\"]\n    R -->|\"Verified\"| T[\"Cited answer, confidence, and trace to UI\"]\n    S --> T\n```\n\nThe deterministic controller decides whether the evidence is sufficient. With no LLM configured, Meridian composes an answer directly from evidence; when an LLM is configured, its cited answer goes through the same verifier and falls back to the offline composer if unavailable or not sufficiently supported. If repair cannot produce a verified answer, Meridian abstains. The API can stream trace events to the UI. See [docs\u002FARCHITECTURE.md](docs\u002FARCHITECTURE.md) for retrieval and verification details, and [docs\u002FDEPLOYMENT.md](docs\u002FDEPLOYMENT.md) for persistence and deployment limitations.\n\n## Optional: use an LLM\n\nMeridian supports any OpenAI-compatible LLM server, including **Ollama** running locally.\n\n### Using Ollama (local, free, no API key)\n\n```bash\n# 1. Install Ollama from https:\u002F\u002Follama.com and pull the model\nollama pull llama3.1\n\n# 2. Create a .env file in the project root with these values:\nMERIDIAN_LLM_PROVIDER=openai\nOPENAI_BASE_URL=http:\u002F\u002Flocalhost:11434\u002Fv1\nMERIDIAN_LLM_MODEL=llama3.1\nMERIDIAN_AGENT_MODE=auto\n\n# 3. Start Meridian (it auto-loads .env)\npython -m meridian\n```\n\n> **Windows note:** Ollama usually starts automatically on install. If you see `address already in use` when running `ollama serve`, it's already running — just pull the model and start Meridian.\n\n> **Docker note:** When Meridian runs in Docker Compose, set `OPENAI_BASE_URL=http:\u002F\u002Fhost.docker.internal:11434\u002Fv1` instead of `localhost`. Inside a container, `localhost` refers to that container, not the Windows host. Also set `MERIDIAN_AGENT_MODE=auto` to enable LLM writing (`policy` forces offline mode). Recreate Meridian after changing `.env` with `docker compose up -d --no-build --force-recreate meridian`.\n\n### Using Anthropic or OpenAI\n\n```bash\n# Anthropic\nexport MERIDIAN_LLM_PROVIDER=anthropic\nexport ANTHROPIC_API_KEY=sk-ant-...\n\n# OpenAI\nexport MERIDIAN_LLM_PROVIDER=openai\nexport OPENAI_API_KEY=sk-...\n```\n\nThe deterministic pipeline still decides *whether* an answer is possible; the LLM writes it from numbered evidence and may call `search_documents` \u002F `lookup_spec`. Anything it writes is verified; failures fall back to the offline composer. `MERIDIAN_AGENT_MODE=policy` forces offline mode.\n\n## Vector search\n\nThe Docker Compose deployment uses **Qdrant** for dense vector search and persists its data in the `qdrant-data` volume. No Qdrant API key or LLM API key is needed for the local Compose setup. The embedder remains offline LSA by default; Qdrant is the vector database, not the embedding model. Document updates are automatically re-ingested and indexed by the app, but currently rebuild the full vector collection rather than applying incremental vector updates. See [docs\u002FDEPLOYMENT.md](docs\u002FDEPLOYMENT.md) for configuration and current scaling limitations.\n\n## Command line\n\n| Command | What it does |\n|---|---|\n| `python -m meridian [--load-demo] [--port 8000]` | web app + API |\n| `python -m pytest -q` | 42 tests (unit, pipeline, agent, live-server API) |\n| `python scripts\u002Frun_eval.py [--no-train]` | full benchmark → `reports\u002Feval_report.{md,json}`, charts |\n| `python scripts\u002Fbuild_corpus.py` | regenerate the synthetic corpus and golden questions (needs `reportlab`) |\n| `python scripts\u002Fbuild_stress_corpus.py [--docs 100]` | generate a separate larger synthetic corpus and held-out QA set |\n\n## API\n\n`POST \u002Fapi\u002Fask` (JSON or multipart with `image`) · `POST \u002Fapi\u002Fask\u002Fstream` (SSE: `trace`, `result`, `done`) · `GET\u002FPOST\u002FDELETE \u002Fapi\u002Fdocuments` · `POST \u002Fapi\u002Fdemo\u002Fload` · `GET \u002Fapi\u002Fpage\u002F{doc}\u002F{page}.png?chunk=` (highlighted evidence) · `GET \u002Fapi\u002Fgraph?chunks=` · `GET \u002Fapi\u002Feval\u002Freport` · `POST \u002Fapi\u002Feval\u002Frun` · `GET \u002Fapi\u002Fhealth`. Errors are JSON `{ \"error\": \"...\" }` with 400\u002F404\u002F413\u002F422\u002F500.\n\n## Measured results (bundled synthetic benchmark, 93 questions, 43 held-out)\n\n| | Result |\n|---|---|\n| Retrieval, full pipeline, held-out | Hit@1 89.5% · Hit@5 100% · MRR 0.88 (BM25 alone: Hit@1 84.2%, Hit@5 97.4%) |\n| Answer correctness (unit-aware) | 93.1% overall, 92.5% held-out |\n| Unanswerable questions declined | 100% (false abstention on answerable: 1.1%) |\n| Faithfulness of delivered answers | 100% claims supported |\n| Confidence calibration (held-out) | ECE 0.027 → 0.008 after Platt scaling |\n| Hallucination-injection detection | 91.7% (numeric 87.5, fabricated 94.4, negation 93.8, entity 91.5); 12.3% false-positive on clean answers |\n\nThese figures are from the original generated baseline (6 documents, 157 chunks), not a claim about real manuals. The learned ranker was trained but **not adopted** because it did not beat the hand-tuned weights on the held-out split. Known failures (6\u002F93): multi-hop questions that need two documents joined, a data-plate OCR read, and some prose procedure questions. Full report: `reports\u002Feval_report.md`.\n\n### Larger synthetic stress benchmark\n\nTo exercise retrieval over a larger corpus, generate a separate, reproducible stress set:\n\n```powershell\npython .\\scripts\\build_stress_corpus.py\n$env:MERIDIAN_DEMO_DIR = (Resolve-Path .\\demo_corpus_stress).Path\n$env:MERIDIAN_EVAL_DIR = (Resolve-Path .\\eval_data_stress).Path\n$env:MERIDIAN_DATA_DIR = (Resolve-Path .).Path + \"\\data_stress\"\n$env:MERIDIAN_REPORTS_DIR = (Resolve-Path .).Path + \"\\reports_stress\"\n$env:MERIDIAN_VECTOR_STORE = \"memory\"\npython .\\scripts\\run_eval.py --no-train --calibration-path .\\reports_stress\\calibration.json\n```\n\nBy default this creates **100 generated model-specific notes, 700 chunks, and 700 questions** (600 answerable, 100 unanswerable), with test questions held out by model. The documents include controlled layout, wording, and transcription noise. They are still synthetic text records—not real-world manuals—and do not establish production accuracy. The generator writes only to the separate `demo_corpus_stress` and `eval_data_stress` directories.\n\nThe full held-out report is in `reports_stress\u002Feval_report.md` (JSON and charts alongside it). On this synthetic 140-question model-held-out test split, end-to-end answer correctness was 90.0%; unanswerable abstention recall was 100%, with a 10.0% false-abstention rate on answerable questions. The full pipeline had retrieval Hit@1 65.0%, Hit@5 100%, MRR 0.771 (in-memory backend). These are reproducible synthetic stress-test results, not real-world or production-accuracy claims; the benchmark does not exercise Qdrant or messy real manuals.\n\n## Project layout\n\n```\nmeridian\u002F\n  config.py schemas.py kb.py bootstrap.py __main__.py\n  ingest\u002F      pdf.py ocr.py figures.py (chart digitiser) office.py images.py common.py pipeline.py\n  index\u002F       lexical.py dense.py graph.py facts.py store.py\n  retrieval\u002F   analyzer.py perception.py pipeline.py rerank.py grader.py context.py\n  verify\u002F      verifier.py\n  agent\u002F       agent.py compose.py tools.py llm_agent.py factory.py\n  llm\u002F         base.py anthropic_client.py openai_client.py mock.py\n  eval\u002F        world.py datagen.py qa.py metrics.py runner.py report.py\n  api\u002F         app.py static\u002F{index.html,app.css,app.js}\ndemo_corpus\u002F eval_data\u002F reports\u002F docs\u002F scripts\u002F tests\u002F\n```\nMore: [docs\u002FARCHITECTURE.md](docs\u002FARCHITECTURE.md) · [docs\u002FMODULES.md](docs\u002FMODULES.md) · [docs\u002FINTERVIEW_GUIDE.md](docs\u002FINTERVIEW_GUIDE.md) · [docs\u002FDEPLOYMENT.md](docs\u002FDEPLOYMENT.md)\n\n## Troubleshooting\n\n* `TesseractNotFoundError` \u002F scanned pages not read → install Tesseract (step 1). Everything except OCR still works without it.\n* Port in use → `python -m meridian --port 8010`.\n* Upload says “could not parse” → the file is corrupt or password-protected; the rest of the batch still ingests.\n* Reset everything → delete the `data\u002F` folder (or “Clear all” in the UI).\n","Meridian 是一个面向工业维护场景的证据可追溯多模态检索增强生成（RAG）系统。它支持PDF手册、扫描件、Word服务通告、表格日志及设备照片等异构文档，具备布局感知解析、图表数值提取、OCR集成、8通道混合检索（BM25\u002FLSA\u002F视觉\u002F图谱等）、声明级事实验证、冲突溯源消解与主动拒答能力；默认运行于无需GPU、API密钥或联网的确定性离线模式，可选配工具调用型LLM代理增强分析。适用于制造业、能源、轨道交通等需高可靠性技术文档问答与合规性核查的工业运维场景。",2,"2026-11-24 04:53:46","CREATED_QUERY"]