# ragatouille - Doramagic AI Context Pack

> 定位：安装前体验与判断资产。它帮助宿主 AI 有一个好的开始，但不代表已经安装、执行或验证目标项目。

## 充分原则

- **充分原则，不是压缩原则**：AI Context Pack 应该充分到让宿主 AI 在开工前理解项目价值、能力边界、使用入口、风险和证据来源；它可以分层组织，但不以最短摘要为目标。
- **压缩策略**：只压缩噪声和重复内容，不压缩会影响判断和开工质量的上下文。

## 给宿主 AI 的使用方式

你正在读取 Doramagic 为 ragatouille 编译的 AI Context Pack。请把它当作开工前上下文：帮助用户理解适合谁、能做什么、如何开始、哪些必须安装后验证、风险在哪里。不要声称你已经安装、运行或执行了目标项目。

## Claim 消费规则

- **事实来源**：Repo Evidence + Claim/Evidence Graph；Human Wiki 只提供显著性、术语和叙事结构。
- **事实最低状态**：`supported`
- `supported`：可以作为项目事实使用，但回答中必须引用 claim_id 和证据路径。
- `weak`：只能作为低置信度线索，必须要求用户继续核实。
- `inferred`：只能用于风险提示或待确认问题，不能包装成项目事实。
- `unverified`：不得作为事实使用，应明确说证据不足。
- `contradicted`：必须展示冲突来源，不得替用户强行选择一个版本。

## 它最适合谁

- **想在安装前理解开源项目价值和边界的用户**：当前证据主要来自项目文档。 证据：`README.md` Claim：`clm_0002` supported 0.86

## 它能做什么

- **项目知识预览**（可做安装前预览）：项目可被阅读和解释，但当前证据不足以确认可安装能力或运行入口。 证据：`README.md`, `docs/index.md`, `docs/roadmap.md`, `LICENSE` 等 Claim：`clm_0001` supported 0.86

## 怎么开始

- 项目证据中没有稳定 Quick Start 命令；此项应留空，而不是由 Doramagic 编造。

## 继续前判断卡

- **当前建议**：先体验研究框架
- **为什么**：当前信息足以做安装前体验，但真实兼容性、输出质量或风险边界还不能直接相信。

### 30 秒判断

- **现在怎么做**：先体验研究框架
- **最小安全下一步**：先跑 Prompt Preview
- **先别相信**：研究结论、引用和实验结果不能在安装前相信。
- **继续会触碰**：研究判断、宿主 AI 上下文

### 现在可以相信

- **适合人群线索：想在安装前理解开源项目价值和边界的用户**（supported）：有 supported claim 或项目证据支撑，但仍不等于真实安装效果。 证据：`README.md` Claim：`clm_0002` supported 0.86
- **能力存在：项目知识预览**（supported）：可以相信项目包含这类能力线索；是否适合你的具体任务仍要试用或安装后验证。 证据：`README.md`, `docs/index.md`, `docs/roadmap.md`, `LICENSE` 等 Claim：`clm_0001` supported 0.86

### 现在还不能相信

- **研究结论、引用和实验结果不能在安装前相信。**（unverified）：研究 Skill 可以组织问题和路径，但不能替代真实资料检索、论文核验和实验复现。
- **是否适合你的具体研究领域不能直接相信。**（unverified）：Skill 覆盖很多研究主题，不代表对你的领域、资料要求和可信度标准足够。
- **真实输出质量不能在安装前相信。**（unverified）：Prompt Preview 只能展示引导方式，不能证明真实项目中的结果质量。
- **宿主 AI 版本兼容性不能在安装前相信。**（unverified）：Claude、Cursor、Codex、Gemini 等宿主加载规则和版本差异必须在真实环境验证。
- **不会污染现有宿主 AI 行为，不能直接相信。**（inferred）：Skill、plugin、AGENTS/CLAUDE/GEMINI 指令可能改变宿主 AI 的默认行为。
- **可安全回滚不能默认相信。**（unverified）：除非项目明确提供卸载和恢复说明，否则必须先在隔离环境验证。
- **真实安装后是否与用户当前宿主 AI 版本兼容？**（unverified）：兼容性只能通过实际宿主环境验证。
- **项目输出质量是否满足用户具体任务？**（unverified）：安装前预览只能展示流程和边界，不能替代真实评测。

### 继续会触碰什么

- **研究判断**：问题拆解、资料路径、实验路径、结论结构和可信度判断。 原因：研究型 Skill 可能让输出看起来更专业，但不能替代真实证据核验。
- **宿主 AI 上下文**：AI Context Pack、Prompt Preview、Skill 路由、风险规则和项目事实。 原因：导入上下文会影响宿主 AI 后续判断，必须避免把未验证项包装成事实。

### 最小安全下一步

- **先跑 Prompt Preview**：先验证它能否正确界定研究问题和证据边界，不要先相信研究输出。（适用：任何项目都适用，尤其是输出质量未知时。）
- **安装后只验证一个最小任务**：先验证加载、兼容、输出质量和回滚，再决定是否深用。（适用：准备从试用进入真实工作流时。）

### 退出方式

- **保留安装前状态**：记录原始宿主配置和项目状态，后续才能判断是否可恢复。
- **保留资料和结论核验清单**：如果后续发现引用或实验路径不可靠，可以回到证据边界阶段重新校验。
- **如果没有回滚路径，不进入主力环境**：不可回滚是继续前阻断项，不应靠信任或运气继续。

## 哪些只能预览

- 解释项目适合谁和能做什么
- 基于项目文档演示典型对话流程
- 帮助用户判断是否值得安装或继续研究

## 哪些必须安装后验证

- 真实安装 Skill、插件或 CLI
- 执行脚本、修改本地文件或访问外部服务
- 验证真实输出质量、性能和兼容性

## 边界与风险判断卡

- **把安装前预览误认为真实运行**：用户可能高估项目已经完成的配置、权限和兼容性验证。 处理方式：明确区分 prompt_preview_can_do 与 runtime_required。 Claim：`clm_0003` inferred 0.45
- **待确认**：真实安装后是否与用户当前宿主 AI 版本兼容？。原因：兼容性只能通过实际宿主环境验证。
- **待确认**：项目输出质量是否满足用户具体任务？。原因：安装前预览只能展示流程和边界，不能替代真实评测。

## 开工前工作上下文

### 加载顺序

- 先读取 how_to_use.host_ai_instruction，建立安装前判断资产的边界。
- 读取 claim_graph_summary，确认事实来自 Claim/Evidence Graph，而不是 Human Wiki 叙事。
- 再读取 intended_users、capabilities 和 quick_start_candidates，判断用户是否匹配。
- 需要执行具体任务时，优先查 role_skill_index，再查 evidence_index。
- 遇到真实安装、文件修改、网络访问、性能或兼容性问题时，转入 risk_card 和 boundaries.runtime_required。

### 任务路由

- **项目知识预览**：先基于 role_skill_index / evidence_index 帮用户挑选可用角色、Skill 或工作流。 边界：可做安装前 Prompt 体验。 证据：`README.md`, `docs/index.md`, `docs/roadmap.md`, `LICENSE` 等 Claim：`clm_0001` supported 0.86

### 上下文规模

- 文件总数：34
- 重要文件覆盖：34/34
- 证据索引条目：34
- 角色 / Skill 条目：4

### 证据不足时的处理

- **missing_evidence**：说明证据不足，要求用户提供目标文件、README 段落或安装后验证记录；不要补全事实。
- **out_of_scope_request**：说明该任务超出当前 AI Context Pack 证据范围，并建议用户先查看 Human Manual 或真实安装后验证。
- **runtime_request**：给出安装前检查清单和命令来源，但不要替用户执行命令或声称已执行。
- **source_conflict**：同时展示冲突来源，标记为待核实，不要强行选择一个版本。

## Prompt Recipes

### 适配判断

- 目标：判断这个项目是否适合用户当前任务。
- 预期输出：适配结论、关键理由、证据引用、安装前可预览内容、必须安装后验证内容、下一步建议。

```text
请基于 ragatouille 的 AI Context Pack，先问我 3 个必要问题，然后判断它是否适合我的任务。回答必须包含：适合谁、能做什么、不能做什么、是否值得安装、证据来自哪里。所有项目事实必须引用 evidence_refs、source_paths 或 claim_id。
```

### 安装前体验

- 目标：让用户在安装前感受核心工作流，同时避免把预览包装成真实能力或营销承诺。
- 预期输出：一段带边界标签的体验剧本、安装后验证清单和谨慎建议；不含真实运行承诺或强营销表述。

```text
请把 ragatouille 当作安装前体验资产，而不是已安装工具或真实运行环境。

请严格输出四段：
1. 先问我 3 个必要问题。
2. 给出一段“体验剧本”：用 [安装前可预览]、[必须安装后验证]、[证据不足] 三种标签展示它可能如何引导工作流。
3. 给出安装后验证清单：列出哪些能力只有真实安装、真实宿主加载、真实项目运行后才能确认。
4. 给出谨慎建议：只能说“值得继续研究/试装”“先补充信息后再判断”或“不建议继续”，不得替项目背书。

硬性边界：
- 不要声称已经安装、运行、执行测试、修改文件或产生真实结果。
- 不要写“自动适配”“确保通过”“完美适配”“强烈建议安装”等承诺性表达。
- 如果描述安装后的工作方式，必须使用“如果安装成功且宿主正确加载 Skill，它可能会……”这种条件句。
- 体验剧本只能写成“示例台词/假设流程”：使用“可能会询问/可能会建议/可能会展示”，不要写“已写入、已生成、已通过、正在运行、正在生成”。
- Prompt Preview 不负责给安装命令；如用户准备试装，只能提示先阅读 Quick Start 和 Risk Card，并在隔离环境验证。
- 所有项目事实必须来自 supported claim、evidence_refs 或 source_paths；inferred/unverified 只能作风险或待确认项。

```

### 角色 / Skill 选择

- 目标：从项目里的角色或 Skill 中挑选最匹配的资产。
- 预期输出：候选角色或 Skill 列表，每项包含适用场景、证据路径、风险边界和是否需要安装后验证。

```text
请读取 role_skill_index，根据我的目标任务推荐 3-5 个最相关的角色或 Skill。每个推荐都要说明适用场景、可能输出、风险边界和 evidence_refs。
```

### 风险预检

- 目标：安装或引入前识别环境、权限、规则冲突和质量风险。
- 预期输出：环境、权限、依赖、许可、宿主冲突、质量风险和未知项的检查清单。

```text
请基于 risk_card、boundaries 和 quick_start_candidates，给我一份安装前风险预检清单。不要替我执行命令，只说明我应该检查什么、为什么检查、失败会有什么影响。
```

### 宿主 AI 开工指令

- 目标：把项目上下文转成一次对话开始前的宿主 AI 指令。
- 预期输出：一段边界明确、证据引用明确、适合复制给宿主 AI 的开工前指令。

```text
请基于 ragatouille 的 AI Context Pack，生成一段我可以粘贴给宿主 AI 的开工前指令。这段指令必须遵守 not_runtime=true，不能声称项目已经安装、运行或产生真实结果。
```

## 角色 / Skill 索引

- 共索引 4 个角色 / Skill / 项目文档条目。

- **Welcome to RAGatouille**（project_doc）：Easily use and train state of the art retrieval methods in any RAG pipeline. Designed for modularity and ease-of-use, backed by research. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`README.md`
- **RAGatouille**（project_doc）：State-of-the-art document retrieval methods, in just a few lines of code. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/index.md`
- **Roadmap**（project_doc）：This page is incorrectly named: RAGatouille doesn't have a set-in-stone roadmap, but rather, a set of objectives. 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/roadmap.md`
- **API Reference**（project_doc）： 激活提示：当用户需要理解项目结构、安装方式或边界时参考。 证据：`docs/api.md`

## 证据索引

- 共索引 34 条证据。

- **Welcome to RAGatouille**（documentation）：Easily use and train state of the art retrieval methods in any RAG pipeline. Designed for modularity and ease-of-use, backed by research. 证据：`README.md`
- **RAGatouille**（documentation）：State-of-the-art document retrieval methods, in just a few lines of code. 证据：`docs/index.md`
- **Roadmap**（documentation）：This page is incorrectly named: RAGatouille doesn't have a set-in-stone roadmap, but rather, a set of objectives. 证据：`docs/roadmap.md`
- **License**（source_file）：Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ 证据：`LICENSE`
- **API Reference**（documentation）：API Reference ::: ragatouille.RAGTrainer ::: ragatouille.RAGPretrainedModel 证据：`docs/api.md`
- **01 Basic Indexing And Search**（source_file）：{ "cells": { "cell type": "markdown", "metadata": {}, "source": " Basic indexing and searching with RAGatouille\n", "\n", "In this quick example, we'll use the RAGPretrainedModel magic class to demonstrate how to:\n", "\n", "- Build an index from raw documents \n", "- Search an index for relevant documents \n", "- Load an index and the associated pretrained model to update or query it. \n", "\n", "Please note: Indexing is currently not supported on Google Colab and Windows 10.\n", "\n", "First, let's load up a pre-trained ColBERT model:" }, { "cell type": "code", "execution count": 1, "metadata": { "tags": }, "outputs": { "name": "stderr", "output type": "stream", "text": "/Users/bclavie/mi… 证据：`examples/01-basic_indexing_and_search.ipynb`
- **05 Llama Hub**（source_file）：{ "cells": { "cell type": "markdown", "metadata": {}, "source": " Using RAGatouille with llama-hub loaders\n", "\n", "Use any loader from llama-hub with ragatouille!\n", "\n", "Basically we should be able to load anything from https://llamahub.ai/?tab=loaders which opens up a lot of avenues for RAGatouille!\n" }, { "cell type": "code", "execution count": 1, "metadata": {}, "outputs": , "source": " !pip install llama-hub\n", " !pip install arxiv\n", " !pip install semanticscholar" }, { "cell type": "code", "execution count": 2, "metadata": {}, "outputs": { "name": "stderr", "output type": "stream", "text": "/Users/shaurya/github/RAGatouille/.conda/lib/python3.10/site-packages/tqdm/auto.py:21… 证据：`examples/05-llama_hub.ipynb`
- **Pyproject**（source_file）：build-system requires = "setuptools" build-backend = "setuptools.build meta" 证据：`pyproject.toml`
- **Ragpretrainedmodel**（source_file）：class RAGPretrainedModel ⋮---- model name: Union str, None = None model: Union LateInteractionModel, None = None corpus processor: Optional CorpusProcessor = None ⋮---- instance = cls ⋮---- index path = Path index path ⋮---- document ids = str uuid4 for i in range collection len ⋮---- docid metadata map = { ⋮---- docid metadata map = None ⋮---- collection with ids = self.corpus processor.process corpus ⋮---- collection with ids = ⋮---- pid docid map = { collection = x "content" for x in collection with ids ⋮---- document splitter fn = None ⋮---- """Search through documents encoded in-memory. Parameters: query Union str, list str : The query or list of queries to search for. k int : The numb… 证据：`ragatouille/RAGPretrainedModel.py`
- **Ragtrainer**（source_file）：class RAGTrainer ⋮---- def add documents self, documents: list str ⋮---- def export training data self, path: Union str, Path ⋮---- def add to collection self, content: Union str, list, dict ⋮---- sample = raw data 0 ⋮---- data type = "pairs" ⋮---- data type = "labeled pairs" ⋮---- data type = "triplets" ⋮---- total triplets = sum ⋮---- total triplets = len self.training triplets ⋮---- training config = ColBERTConfig 证据：`ragatouille/RAGTrainer.py`
- **Init**（source_file）：FUTURE MIGRATION WARNING MESSAGE = ⋮---- version = "0.0.9post2" ⋮---- all = "RAGPretrainedModel", "RAGTrainer" 证据：`ragatouille/__init__.py`
- **Utils**（source_file）：def seeded shuffle collection: list, seed: int = 42 ⋮---- def get wikipedia page title: str ⋮---- URL = "https://en.wikipedia.org/w/api.php" ⋮---- params = { ⋮---- headers = {"User-Agent": "RAGatouille tutorial/0.0.1 ben@clavie.eu "} ⋮---- response = requests.get URL, params=params, headers=headers data = response.json ⋮---- page = next iter data "query" "pages" .values 证据：`ragatouille/utils.py`
- **Init**（source_file）：all = 证据：`ragatouille/data/__init__.py`
- **Corpus Processor**（source_file）：class CorpusProcessor ⋮---- document ids = ⋮---- documents = self.document splitter fn ⋮---- documents = fn documents, document ids 证据：`ragatouille/data/corpus_processor.py`
- **Preprocessors**（source_file）：chunk overlap = min chunk size / 4, min chunk size / 2, 64 chunks = node parser = SentenceSplitter chunk size=chunk size, chunk overlap=chunk overlap docs = Document text=doc for doc in documents 证据：`ragatouille/data/preprocessors.py`
- **Training Data Processor**（source_file）：class TrainingDataProcessor ⋮---- def make individual triplets self, query, positives, negatives ⋮---- triplets = q = self.query map query ⋮---- all pos texts = p for p in positives max triplets per query = 20 negs per positive = max 1, max triplets per query // len all pos texts initial triplets count = 0 ⋮---- p = self.passage map pos chosen negs = random.sample ⋮---- n = self.passage map neg ⋮---- extra triplets needed = max triplets per query - initial triplets count ⋮---- all combinations = list product all pos texts, negatives ⋮---- p = self.passage map positives 0 ⋮---- def get new negatives self, query, passages, mine hard negatives, n new negatives ⋮---- hard negatives = self.negat… 证据：`ragatouille/data/training_data_processor.py`
- **Init**（source_file）：all = "RAGatouilleLangChainRetriever", "RAGatouilleLangChainCompressor" 证据：`ragatouille/integrations/__init__.py`
- **Langchain**（source_file）：class RAGatouilleLangChainRetriever BaseRetriever ⋮---- model: Any kwargs: dict = {} ⋮---- docs = self.model.search query, self.kwargs ⋮---- class RAGatouilleLangChainCompressor BaseDocumentCompressor ⋮---- k: int = 5 ⋮---- class Config ⋮---- arbitrary types allowed = True ⋮---- doc list = list documents docs = d.page content for d in doc list results = self.model.rerank final results = ⋮---- doc = doc list r "result index" 证据：`ragatouille/integrations/_langchain.py`
- **Init**（source_file）：all = "LateInteractionModel", "ColBERT" 证据：`ragatouille/models/__init__.py`
- **Base**（source_file）：class LateInteractionModel ABC ⋮---- @abstractmethod def train ⋮---- @abstractmethod def index self, name: str, collection: list str ⋮---- @abstractmethod def add to index self ⋮---- @abstractmethod def search self, name: str, query: Union str, list str ⋮---- @abstractmethod def search self, name: str, query: str ⋮---- @abstractmethod def batch search self, name: str, queries: list str 证据：`ragatouille/models/base.py`
- **TODO We may want to load an existing index here instead;**（source_file）：class ColBERT LateInteractionModel ⋮---- n gpu = 1 if torch.cuda.device count == 0 else torch.cuda.device count ⋮---- ckpt config = ColBERTConfig.load from index ⋮---- split root = str pretrained model name or path .split "/" :-1 ⋮---- ckpt config = ColBERTConfig.load from checkpoint ⋮---- local config = ColBERTConfig kwargs ⋮---- def invert pid docid map self - Dict str, List int ⋮---- d = defaultdict list ⋮---- def get collection files from disk self, index path: str ⋮---- index root = self.config.root ⋮---- expected path segment = Path self.config.experiment / "indexes" ⋮---- index root = str Path self.config.root / expected path segment ⋮---- collection path = Path index root / self.ind… 证据：`ragatouille/models/colbert.py`
- **For smaller collections, we need a higher ncells value to ensure we return enough results**（source_file）：IndexType = Literal "FLAT", "HNSW", "PLAID" ⋮---- class ModelIndex ABC ⋮---- index type: IndexType ⋮---- @abstractmethod def search self, query: str, k: int, pids: Optional List int = None : ... ⋮---- @abstractmethod def batch search self, query: list str , k: int : ... ⋮---- @abstractmethod def export config self - dict str, Any : ... ⋮---- def export metadata self - dict str, Any ⋮---- config = self. export config ⋮---- class FLATModelIndex ModelIndex ⋮---- index type = "FLAT" ⋮---- class HNSWModelIndex ModelIndex ⋮---- index type = "HNSW" ⋮---- class PLAIDModelIndex ModelIndex ⋮---- DEFAULT INDEX BSIZE = 32 index type = "PLAID" faiss kmeans = staticmethod deepcopy CollectionIndexer. trai… 证据：`ragatouille/models/index.py`
- **Torch Kmeans**（source_file）：def train kmeans self, sample, shared lists ⋮---- centroids = compute pytorch kmeans centroids = torch.nn.functional.normalize centroids, dim=-1 ⋮---- centroids = centroids.half ⋮---- centroids = centroids.float ⋮---- device = torch.device "cuda" if use gpu else "cpu" sample = sample.to device total size = sample.shape 0 ⋮---- perm = torch.randperm total size, device=device sample = sample perm ⋮---- sample = sample.float minibatch = None ⋮---- minibatch = batch size ⋮---- minibatch = int batch size / 2 ⋮---- kmeans = KMeans 证据：`ragatouille/models/torch_kmeans.py`
- **Utils**（source_file）：def seeded shuffle collection: list, seed: int = 42 ⋮---- colbert config = ColBERTConfig.load from checkpoint colbert path ⋮---- export path = colbert path ⋮---- export path = ".tmp/hugging face export" ⋮---- colbert model = ColBERT ⋮---- save model = colbert model.save ⋮---- save model = colbert model.module.save ⋮---- rust tokenizer available = True ⋮---- rust tokenizer available = False ⋮---- rust tokenizer available = os.path.exists ⋮---- api = HfApi ⋮---- class VespaColBERT BertPreTrainedModel ⋮---- def init self, config, dim ⋮---- def forward self, input ids, attention mask ⋮---- Q = self.bert input ids, attention mask=attention mask 0 Q = self.linear Q ⋮---- out path = Path out path… 证据：`ragatouille/models/utils.py`
- **Init**（source_file）：all = "HardNegativeMiner", "SimpleMiner" 证据：`ragatouille/negative_miners/__init__.py`
- **Base**（source_file）：class HardNegativeMiner ABC ⋮---- @abstractmethod def export index self, path: Union str, Path - bool 证据：`ragatouille/negative_miners/base.py`
- **Simpleminer**（source_file）：class DenseModels Enum ⋮---- en small = "BAAI/bge-small-en-v1.5" zh small = "thenlper/gte-small-zh" fr small = "OrdalieTech/Solon-embeddings-base-0.1" other small = "intfloat/multilingual-e5-small" en base = "BAAI/bge-base-en-v1.5" zh base = "thenlper/gte-base-zh" fr base = "OrdalieTech/Solon-embeddings-base-0.1" other base = "intfloat/multilingual-e5-base" en large = "BAAI/bge-large-en-v1.5" zh large = "thenlper/gte-large-zh" fr large = "OrdalieTech/Solon-embeddings-large-0.1" other large = "intfloat/multilingual-e5-large" ⋮---- class SimpleMiner HardNegativeMiner ⋮---- language code = "other" ⋮---- hub model = DenseModels self.model name .value ⋮---- pool = self.model.start multi process… 证据：`ragatouille/negative_miners/simpleminer.py`
- **Byte-compiled / optimized / DLL files**（source_file）：.DS Store Byte-compiled / optimized / DLL files pycache / .py cod $py.class 证据：`.gitignore`
- **02 Basic Training**（source_file）：{ "cells": { "cell type": "markdown", "id": "c71ca3ef", "metadata": {}, "source": " Basic training and fine-tuning with RAGatouille\n", "\n", "In this quick example, we'll use the RAGTrainer magic class to demonstrate how to very easily fine-tune an existing ColBERT model, or train one from any BERT/RoBERTa-like model to train one for a previously unsupported language like Japanese https://huggingface.co/bclavie/jacolbert , for example! " }, { "cell type": "markdown", "id": "d6f69fca", "metadata": {}, "source": "First, we'll create an instance of RAGtrainer . We need to give it two arguments: the model name we want to give to the model we're training, and the pretrained model name of the ba… 证据：`examples/02-basic_training.ipynb`
- **03 Finetuning Without Annotations With Instructor And Ragatouille**（source_file）：{ "cells": { "cell type": "markdown", "metadata": {}, "source": " RAGatouille + Instructor: Finetuning ColBERT v2 with no annotated data" }, { "cell type": "markdown", "metadata": {}, "source": "In the previous example https://github.com/bclavie/RAGatouille/blob/main/examples/02-basic training.ipynb , we experimented with training our own ColBERT model. The process was straightforward, but our resulting model wasn't very useful: we didn't have any of the annotated data needed, so we created meaningless query, relevant passage pairs that the model couldn't learn anything from!\n", "\n", "Getting annotated data is expensive! Thankfully, the literature in retrieval has recently shown that synt… 证据：`examples/03-finetuning_without_annotations_with_instructor_and_RAGatouille.ipynb`
- **04 Reranking**（source_file）：{ "cells": { "cell type": "markdown", "metadata": {}, "source": " Reranking with RAGatouille\n", "\n", "In this quick example, we'll use the RAGPretrainedModel magic class to demonstrate how to re-rank documents retrieved by another retriever, such as your existing RAG pipeline .\n", "\n", "First, as usual, let's load up a pre-trained ColBERT model:" }, { "cell type": "code", "execution count": 1, "metadata": {}, "outputs": { "name": "stderr", "output type": "stream", "text": "/Users/bclavie/miniforge3/envs/ragatouille/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user ins… 证据：`examples/04-reranking.ipynb`
- **06 Index Free Use**（source_file）：{ "cells": { "cell type": "markdown", "metadata": {}, "source": " Using ColBERT in-memory: Index-Free Encodings & Search\n", "\n", "Sometimes, building an index doesn't make sense. Maybe you're working with a really small dataset, or one that is really fleeting nature, and will only be relevant to the lifetime of your current instance. In these cases, it can be more efficient to skip all the time-consuming index optimisation, and keep your encodings in-memory to perform ColBERT's magical MaxSim on-the-fly. This doesn't scale very well, but can be very useful in certain settings.\n", "\n", "In this quick example, we'll use the RAGPretrainedModel magic class to demonstrate how to encode docum… 证据：`examples/06-index_free_use.ipynb`
- **Mkdocs**（source_file）：site name: RAGatouille site author: Benjamin Clavié site description: Bridging the gap between state-of-the-art Retrieval research and RAG applications. repo name: RAGatouille repo url: https://github.com/bclavie/RAGatouille/ site url: https://ragatouille.clavie.eu edit uri: edit/main/docs/ copyright: Copyright &copy; 2024 Benjamin Clavié plugins: - search - mkdocstrings: handlers: python: options: members order: alphabetical allow inspection: true show bases: true theme: name: material features: - content.code.annotate - content.code.copy - content.code.select - content.tabs.link - content.tooltips - header.autohide - navigation.expand - navigation.footer - navigation.indexes - navigation.… 证据：`mkdocs.yml`
- **Requirements Doc**（source_file）：mkdocs mkdocs-material yarl cairosvg mkdocstrings mkdocstrings-python 证据：`requirements-doc.txt`

## 宿主 AI 必须遵守的规则

- **把本资产当作开工前上下文，而不是运行环境。**：AI Context Pack 只包含证据化项目理解，不包含目标项目的可执行状态。 证据：`README.md`, `docs/index.md`, `docs/roadmap.md`
- **回答用户时区分可预览内容与必须安装后才能验证的内容。**：安装前体验的消费者价值来自降低误装和误判，而不是伪装成真实运行。 证据：`README.md`, `docs/index.md`, `docs/roadmap.md`

## 用户开工前应该回答的问题

- 你准备在哪个宿主 AI 或本地环境中使用它？
- 你只是想先体验工作流，还是准备真实安装？
- 你最在意的是安装成本、输出质量、还是和现有规则的冲突？

## 验收标准

- 所有能力声明都能回指到 evidence_refs 中的文件路径。
- AI_CONTEXT_PACK.md 没有把预览包装成真实运行。
- 用户能在 3 分钟内看懂适合谁、能做什么、如何开始和风险边界。

---

## Doramagic Context Augmentation

下面内容用于强化 Repomix/AI Context Pack 主体。Human Manual 只提供阅读骨架；踩坑日志会被转成宿主 AI 必须遵守的工作约束。

## Human Manual 骨架

使用规则：这里只是项目阅读路线和显著性信号，不是事实权威。具体事实仍必须回到 repo evidence / Claim Graph。

宿主 AI 硬性规则：
- 不得把页标题、章节顺序、摘要或 importance 当作项目事实证据。
- 解释 Human Manual 骨架时，必须明确说它只是阅读路线/显著性信号。
- 能力、安装、兼容性、运行状态和风险判断必须引用 repo evidence、source path 或 Claim Graph。

- **项目概览、安装与快速上手**：importance `high`
  - source_paths: README.md, pyproject.toml, docs/index.md, examples/01-basic_indexing_and_search.ipynb
- **核心 API：RAGPretrainedModel、ColBERT 与索引管理**：importance `high`
  - source_paths: ragatouille/RAGPretrainedModel.py, ragatouille/models/colbert.py, ragatouille/models/index.py, ragatouille/models/base.py, ragatouille/models/torch_kmeans.py
- **训练、数据处理与负样本挖掘**：importance `high`
  - source_paths: ragatouille/RAGTrainer.py, ragatouille/data/corpus_processor.py, ragatouille/data/preprocessors.py, ragatouille/data/training_data_processor.py, ragatouille/negative_miners/base.py
- **集成生态、扩展性与已知兼容性问题**：importance `medium`
  - source_paths: ragatouille/integrations/_langchain.py, ragatouille/integrations/__init__.py, ragatouille/utils.py, ragatouille/__init__.py, examples/05-llama_hub.ipynb

## Repo Inspection Evidence / 源码检查证据

- repo_clone_verified: true
- repo_inspection_verified: true
- repo_commit: `e75b8a964a870dea886548f78da1900804749040`
- inspected_files: `README.md`, `pyproject.toml`, `docs/api.md`, `docs/index.md`, `docs/roadmap.md`

宿主 AI 硬性规则：
- 没有 repo_clone_verified=true 时，不得声称已经读过源码。
- 没有 repo_inspection_verified=true 时，不得把 README/docs/package 文件判断写成事实。
- 没有 quick_start_verified=true 时，不得声称 Quick Start 已跑通。

## Doramagic Pitfall Constraints / 踩坑约束

这些规则来自 Doramagic 发现、验证或编译过程中的项目专属坑点。宿主 AI 必须把它们当作工作约束，而不是普通说明文字。

### Constraint 1: 来源证据：faiss-cpu faiss-gpu issue

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：faiss-cpu faiss-gpu issue
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/184 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 2: 来源证据：Error AdamW RAGPretrainedModel

- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：Error AdamW RAGPretrainedModel
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/272 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 3: 来源证据：ModuleNotFoundError: No module named 'langchain.retrievers'

- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：ModuleNotFoundError: No module named 'langchain.retrievers'
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/275 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 4: 来源证据：Stuck at " Loading segmented_maxsim_cpp extension (set COLBERT_LOAD_TORCH_EXTENSION_VERBOSE=True for more info)..."

- Trigger: GitHub 社区证据显示该项目存在一个安全/权限相关的待验证问题：Stuck at " Loading segmented_maxsim_cpp extension (set COLBERT_LOAD_TORCH_EXTENSION_VERBOSE=True for more info)..."
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/213 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 5: 来源证据：ImportError: cannot import name 'AdamW' from 'transformers'

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：ImportError: cannot import name 'AdamW' from 'transformers'
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/269 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 6: 来源证据：Indexing failing: subcommand issues

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Indexing failing: subcommand issues
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/60 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 7: 来源证据：Is the RAGatouille supports multimodal document retrival like Colpali?

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Is the RAGatouille supports multimodal document retrival like Colpali?
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/277 | 来源类型 github_issue 暴露的待验证使用条件。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 8: 来源证据：Package Using outdated transformers dependency

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Package Using outdated transformers dependency
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/271 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 9: 来源证据：Updating to latest version download what it seems excessive dependencies....

- Trigger: GitHub 社区证据显示该项目存在一个安装相关的待验证问题：Updating to latest version download what it seems excessive dependencies....
- Host AI rule: 来源显示可能已有修复、规避或版本变化，说明书中必须标注适用版本。
- Why it matters: 可能增加新用户试用和生产接入成本。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/120 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。

### Constraint 10: 来源证据：LangChain & ColBERT API Mismatch

- Trigger: GitHub 社区证据显示该项目存在一个配置相关的待验证问题：LangChain & ColBERT API Mismatch
- Why it matters: 可能影响升级、迁移或版本选择。
- Evidence: community_evidence:github | https://github.com/AnswerDotAI/RAGatouille/issues/281 | 来源讨论提到 python 相关条件，需在安装/试用前复核。
- Hard boundary: 不要把这个坑点包装成已解决、已验证或可忽略，除非后续验证证据明确证明它已经关闭。
