

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 利用查询和响应测试知识库
<a name="knowledge-base-test"></a>

设置知识库后，可以通过以下方式测试其行为：
+ 使用 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html) 操作发送查询并从数据来源中检索相关信息。
+ 使用 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html) 操作，发送查询并根据从数据来源中检索到的信息生成对查询的响应。
+ 在使用 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Retrieve.html) 或 [https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html) 时，使用一个重排模型（而非默认的 Amazon Bedrock 知识库重排模型）以检索更相关的来源。
+ 在 `Retrieve` 或 `RetrieveAndGenerate` API 中使用可选的元数据筛选条件，来指定可使用数据来源中的哪些文档。

对知识库的行为感到满意后，可通过执行[为人工智能应用程序部署知识库](knowledge-base-deploy.md)这一操作，设置应用程序来查询知识库或将知识库附加到代理。

选择一个主题以了解更多相关信息。

**Topics**
+ [查询知识库并检索数据](kb-test-retrieve.md)
+ [根据检索到的数据查询知识库并生成响应](kb-test-retrieve-generate.md)
+ [生成对结构化数据的查询](knowledge-base-generate-query.md)
+ [查询连接到 Amazon Kendra GenAI 索引的知识库](kb-test-kendra.md)
+ [查询连接到 Amazon Neptune Analytics 分析数据库引擎图表的知识库](kb-test-neptune.md)
+ [配置和自定义查询与响应生成](kb-test-config.md)
+ [使用知识库为推理模型配置响应生成](kb-test-configure-reasoning.md)