> For the complete documentation index, see [llms.txt](https://docs.cherryai.com.cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cherryai.com.cn/docs/en-us/knowledge-base/chat.md).

# Use in Chat

After retrieval testing passes, you can select one or more knowledge bases in a normal conversation and have the model answer based on the retrieved snippets while showing sources.

{% hint style="info" %}
The conversation is responsible for organizing the answer, while the knowledge base is responsible for providing evidence. First confirm the correct snippets in \[Retrieval Test], then determine whether the prompt or chat model needs adjustment.
{% endhint %}

## Prerequisites

| Check item               | Qualified status                                               |
| ------------------------ | -------------------------------------------------------------- |
| Chat model               | Supports tool calls                                            |
| Knowledge base materials | At least one material is ready                                 |
| Current message          | No files attached at the same time                             |
| Retrieval quality        | Key questions can find the correct source and complete snippet |

{% hint style="warning" %}
When the current message has an attachment, knowledge base selection will be disabled. Remove the attachment first, then select a knowledge base from the input area.
{% endhint %}

## Complete a Q\&A with sources

{% stepper %}
{% step %}

### 1. Select a model that supports tool calls

Create or open a normal conversation, and confirm in the model selector that the current model supports tool calls. If the knowledge base entry says the capability is insufficient, switch models first.
{% endstep %}

{% step %}

### 2. Open knowledge base selection

Click the add button in the lower-left corner of the input area, select \[Knowledge Base], then check one or more target bases.
{% endstep %}

{% step %}

### 3. Confirm the selection status

The knowledge base name should appear in the input area. When the question concerns only one topic, prefer selecting only one base to reduce competition from irrelevant snippets.

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2FjswMmFNEOELu7kQBpjpI%2Fclipboard.png?alt=media&amp;token=62d6b0a6-baf0-4b58-b0bc-4ab02f528f78" alt="对话输入区已经选择员工差旅制度知识库并输入真实问题"><figcaption><p>Before sending, confirm that the selected knowledge base and the current question belong to the same information scope.</p></figcaption></figure>
{% endstep %}

{% step %}

### 4. Clearly define the task, scope, and format

For example:`Answer the accommodation cap for domestic first-tier cities only based on the selected knowledge bases; list different rank levels separately and mark the source after each item.`
{% endstep %}

{% step %}

### 5. Open source verification

Check the source name, snippet content, and applicable conditions. Content not specified in the materials should not be filled in as fact.
{% endstep %}

{% step %}

### 6. If it fails, go back to retrieval testing

Use the same question to check the snippets returned by the knowledge base. If retrieval is wrong, fix the materials, parsing, or search first; if retrieval is correct, then adjust the prompt and chat model.

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fr2mSvzxjXSvwuT0gGIf6%2Fclipboard.png?alt=media&amp;token=87900ecb-c890-4894-9891-905a4caad74c" alt="召回测试中展示相关度、来源名称和命中片段的结果列表"><figcaption><p>When the conversation answer is unsatisfactory, the retrieval result can help determine whether the problem is at the retrieval layer or the answering layer.</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## How the answer is formed

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2FlOKvTNoShRGrj0ErU2aK%2Fclipboard.png?alt=media&amp;token=d245723c-b825-4e3d-ab00-6e1d07a96fc9" alt="从资料解析、关键词和向量检索到合并重排并交给对话回答的知识库架构图"><figcaption><p>The chat model sees the final retrieved snippets, not all the materials in the knowledge base automatically.</p></figcaption></figure>

## Recommended question templates

### Query a clear rule

> Answer only based on the selected knowledge bases: What is the accommodation cap for domestic first-tier cities? If standards differ by rank level, please list them separately and mark the source after each item.

### Compare multiple materials

> Compare the approval differences between domestic business trips and overseas business trips. Present it in a table by "trigger conditions, approver, pre-departure materials"; mark anything not stated in the materials as "Not specified".

### Require distinguishing facts from suggestions

> First list the facts supported by the original policy text, then provide operational suggestions separately. Suggestions must not be written as policy requirements, and keep the source name for each fact.

{% hint style="success" %}
A good question includes four things at the same time: the task to be completed, the scope of materials allowed for use, the expected output format, and how to handle missing information.
{% endhint %}

## Choose one knowledge base or multiple knowledge bases

| Situation                                    | Recommendation                                        | Reason                                                               |
| -------------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------- |
| Single policy or product issue               | Select only one base                                  | Reduce competition from irrelevant snippets                          |
| Cross-department or cross-product comparison | Select multiple bases and explain the purpose of each | Help the model maintain source boundaries                            |
| Mixed results from multiple bases            | Split into multiple questions and verify separately   | First confirm that each base can retrieve independently              |
| Need long-term multi-step research           | Switch to an Agent bound to knowledge bases           | Better suited for continuous search, organization, and file delivery |

## Configuration notes

| Configuration item        | Recommended starting point                       | Function                                        | Notes                                                |
| ------------------------- | ------------------------------------------------ | ----------------------------------------------- | ---------------------------------------------------- |
| Number of knowledge bases | 1                                                | Control the scope of materials                  | Increase only when there is a real cross-base need   |
| Question scope            | Clearly write "only based on the knowledge base" | Reduce common-sense completion                  | Important conclusions still need source verification |
| Output format             | Table or itemized list                           | Easy to verify item by item                     | Require "Not specified" instead of guessing          |
| Regression issue          | Use the same question as in the retrieval test   | Distinguish between retrieval and answer issues | Change only one variable per round                   |

## Consolidate conversation content back into the knowledge base

Cherry Studio can save messages, topics, or notes to the knowledge base. Before saving, delete model guesses, duplicate content, and temporary discussions, and use a title that clearly indicates the topic and version.

After saving, it becomes a new material snapshot and will not sync in real time with the original conversation or note. When the content changes, it needs to be saved again or replaced.

## User case

Xiaolin asked about the accommodation cap in the \[Employee Business Travel Policy]. The first answer mixed in model common sense, so he changed the prompt to "write Not specified when the material does not state it" and required the source to be kept for each item. Then he opened the citations one by one to verify the city tier, rank level, and amount.

The completion standard is: every amount can be directly supported by the cited snippet, and exceptions not written in the policy will not be filled in by the model itself.

## FAQ

<details>

<summary>Why is the knowledge base entry grayed out?</summary>

First select a model that supports tool calls, and remove the current message attachment; then confirm that there is at least one knowledge base with ready materials.

</details>

<details>

<summary>Why is there no source in the answer?</summary>

Confirm that the input area still shows the selected knowledge base, then put the same question into retrieval testing. If there is no correct retrieval, fix the knowledge base first.

</details>

<details>

<summary>What if the source is correct but the conclusion is inaccurate?</summary>

Require the model to answer only based on the citations, break the task into smaller factual items, and manually verify important conclusions. At this point, it is usually a prompt, model capability, or context organization issue.

</details>

## Continue reading

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Check materials and recall</strong></td><td>First confirm that the correct snippet can be hit reliably.</td><td><a href="/docs/en-us/knowledge-base/recall-test.md">Check Materials and Retrieval</a></td></tr><tr><td><strong>Use with Agent</strong></td><td>Let the knowledge base participate in multi-step tasks and file delivery.</td><td><a href="/docs/en-us/knowledge-base/agent.md">Use with Agent</a></td></tr><tr><td><strong>Knowledge base application examples</strong></td><td>Reuse policies, after-sales, and research cases.</td><td><a href="/docs/en-us/knowledge-base/cases.md">Knowledge Base Use Cases</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cherryai.com.cn/docs/en-us/knowledge-base/chat.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
