# 第五章 上下文选择与检索

当信息存储在外部系统后，下一个关键问题是：如何从海量信息中精准获取当前任务所需的内容？**选择策略** 正是解决这一问题的核心方法，而[检索增强生成](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/5.1_rag_principles.md)（[RAG](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/5.1_rag_principles.md)）是其最重要的实现形式。

本章将深入探讨 RAG 的基本原理、文档分块策略、嵌入模型与语义搜索、重排序技术，以及混合检索等高级 RAG 技术。

## 本章内容

* [5.1 检索增强生成原理](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/5.1_rag_principles.md)
* [5.2 文档分块策略](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/5.2_chunking.md)
* [5.3 嵌入模型与语义搜索](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/5.3_embeddings.md)
* [5.4 重排序与相关性优化](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/5.4_reranking.md)
* [5.5 混合检索与高级检索增强生成](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/5.5_hybrid_search.md)
* [本章小结](/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select/summary.md)

***

> **📚 延伸阅读**：OpenClaw 的记忆搜索机制（BM25 + 向量混合检索）是 RAG 在智能体中的实战应用，参见 [《OpenClaw 从入门到精通》第 6.3 节](https://yeasy.gitbook.io/openclaw_guide)。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeasy.gitbook.io/context_engineering_guide/di-er-bu-fen-he-xin-ji-shu-yu-ce-le/05_select.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
