> 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 Conversations

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

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

## Prerequisites for use

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

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

## Complete a Q\&A session with sources

{% stepper %}
{% step %}

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

Create or open a regular 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 at the lower left of the input area, choose \[Knowledge Base], then check one or more target libraries.
{% endstep %}

{% step %}

### 3. Confirm the selection status

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

<figure><img src="/files/c82d5dd4e34ec073131323e0e8414dfa10bf8438" alt="对话输入区已经选择员工差旅制度知识库并输入真实问题"><figcaption><p>Before sending, confirm that the selected knowledge base and the current question belong to the same scope of materials.</p></figcaption></figure>
{% endstep %}

{% step %}

### 4. State the task, scope, and format clearly

For example:`Answer only based on the selected knowledge base: what is the accommodation cap for first-tier cities in China? If standards differ by rank, list them item by item and mark the source after each item.`
{% endstep %}

{% step %}

### 5. Open source verification

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

{% step %}

### 6. If it fails, go back to the retrieval test

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="/files/c6f3bfaf5deb56fb89e9a46bf9e60343a52ba0e2" alt="召回测试中展示相关度、来源名称和命中片段的结果列表"><figcaption><p>When the conversation answer is unsatisfactory, the retrieval results can help determine whether the problem is in the retrieval layer or the answer layer.</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## How the answer is formed

<figure><img src="/files/6e98934885eff518d13a4942ff027d90687e8866" alt="从资料解析、关键词和向量检索到合并重排并交给对话回答的知识库架构图"><figcaption><p>The chat model sees the final retrieved snippets, not the entire knowledge base automatically.</p></figcaption></figure>

## Recommended question templates

### Ask about a clear rule

> Answer only based on the selected knowledge base: what is the accommodation cap for first-tier cities in China? If standards differ by rank, please list them item by item, and mark the source after each item.

### Compare multiple materials

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

### Require distinguishing facts from suggestions

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

{% hint style="success" %}
A good question contains four things at the same time: the task to be completed, the permissible scope of materials, the expected output format, and what to do when the materials are missing.
{% endhint %}

## Choose one knowledge base or multiple

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

## Configuration notes

| Configuration item        | Recommended starting point                          | Effect                                              | Notes                                                 |
| ------------------------- | --------------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------- |
| Number of knowledge bases | 1                                                   | Control the scope of materials                      | Increase only when there is a real cross-library need |
| Question scope            | Explicitly write 'only based on the knowledge base' | Reduce common-sense filling-in                      | Important conclusions still need source verification  |
| Output format             | Table or itemized list                              | Convenient for item-by-item acceptance              | Ask for 'Not stated' instead of guessing              |
| Regression issue          | Use the same question as in the retrieval test      | Distinguish retrieval problems from answer problems | 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 discussion, and use a title that clearly indicates the topic and version.

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

## User case

Xiaolin asked about the accommodation cap in \[Employee Business Travel Policy]. The first answer mixed in model common sense, so he changed the prompt to 'write Not stated when it is not specified in the materials' and required the source to be retained for each item. He then opened the citations one by one to verify the city tier, rank, and amount.

The acceptance criterion 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 on its own.

## Common questions

<details>

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

First select a model that supports tool calls and remove the current message attachments; 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 the retrieval test. If there is no correct retrieval, fix the knowledge base first.

</details>

<details>

<summary>What should I do 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. This 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 snippets can be hit consistently.</td><td><a href="/pages/7c7a6d04d1e906eb7a89261dabeedb48874a9b8e">/pages/7c7a6d04d1e906eb7a89261dabeedb48874a9b8e</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="/pages/828bb5b1083ccd9a5f192ca3835ea0fb0f1e6a21">/pages/828bb5b1083ccd9a5f192ca3835ea0fb0f1e6a21</a></td></tr><tr><td><strong>Knowledge base application cases</strong></td><td>Reuse policies, after-sales, and research cases.</td><td><a href="/pages/f5585710b91e24d4206ea9a29da14da13f79dbe1">/pages/f5585710b91e24d4206ea9a29da14da13f79dbe1</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 dynamically by asking a question.

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

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
