# Knowledge Base Tutorial

In version 0.9.1, CherryStudio introduced the long-awaited knowledge base feature.

Below, we will present CherryStudio’s detailed usage instructions step by step.

## Add embedding model

1. Find the model in the model management service, and you can quickly filter by clicking "Embedding Model";
2. Find the model you need and add it to My Models.

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-3566134edc9d0d37b5172c4c4cb4ef84c17da2b9%2Fimage.webp?alt=media" alt=""><figcaption></figcaption></figure>

## Create knowledge base

1. Knowledge base entry: In the left toolbar of CherryStudio, click the knowledge base icon to enter the management page;
2. Add knowledge base: Click Add to start creating a knowledge base;
3. Naming: Enter the knowledge base name and add an embedding model. Using bge-m3 as an example, you can complete the creation.

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-8d577f77483c59e2a35fa9a79823c88852b16845%2Fimage-1.webp?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-26bde7cb42570d0192ad0d55990304bd3a10c485%2Fimage-2.webp?alt=media" alt=""><figcaption></figcaption></figure>

## Add files and vectorize

1. Add files: Click the Add File button to open file selection;
2. Select files: Choose supported file formats such as pdf, docx, pptx, xlsx, txt, md, mdx, etc., and open them;
3. Vectorization: The system will automatically perform vectorization. When it shows completed (green ✓), it means vectorization is finished.

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-5673213f6cd35c9d3ca6972e390b3f04c3d53492%2Fimage-3.webp?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-56f66212a7c8695f3daaa8c968dc13c7ea6141a8%2Fimage-4.webp?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-2908c341f28d0bd07d65e42fc1eedb435f7e53a2%2Fimage-5.webp?alt=media" alt=""><figcaption></figcaption></figure>

## Add data from multiple sources

CherryStudio supports multiple ways to add data:

1. Folder directory: You can add an entire folder directory, and supported files in that directory will be automatically vectorized;
2. Website link: Supports website URLs, such as<https://docs.siliconflow.cn/introduction>;
3. Sitemap: Supports XML-format sitemaps, such as<https://docs.siliconflow.cn/sitemap.xml>;
4. Plain text notes: Supports entering custom plain-text content.

{% hint style="info" %}
Tip:

1. Images in documents imported into the knowledge base are not yet supported for conversion into vectors and need to be manually converted into text;
2. Using a website as a knowledge base source may not always succeed. Some websites have relatively strict anti-scraping mechanisms (or require login, authorization, etc.), so this method may not be able to obtain accurate content. After creation, it is recommended to search and test first.
3. In general, websites provide a sitemap, such as CherryStudio’s[sitemap](https://docs.cherry-ai.com/sitemap-pages.xml), which can usually be obtained by adding /sitemap.xml after the website’s root address (i.e., the URL). For example,`aaa.com/sitemap.xml` .
4. If the website does not provide a sitemap or the URLs are relatively scattered, you can manually combine an XML file for the sitemap. For now, the file needs to be filled in using a directly accessible public direct link; local file links will not be recognized.

> 1) You can let AI generate a sitemap file or have AI write an HTML sitemap generator tool;
> 2) Direct links can be generated using OSS direct links or cloud-drive direct links, etc. If you don’t have an existing tool, you can also go to[ocoolAI](https://one.ocoolai.com/login)official website and, after logging in, use the free file upload tool in the website’s top bar to generate a direct link.
>    {% endhint %}

## Search the knowledge base

Once files and other materials have been vectorized, you can query them:

1. Click the Search Knowledge Base button at the bottom of the page;
2. Enter the content to search for;
3. Display the search results;
4. And show the matching score for that result.

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-cf2b0591ac60272a645284f1cdc41c82e66df320%2Fimage-7.webp?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-86458b980ce132df81d52cdee3040030e8b4ea54%2Fimage-8.webp?alt=media" alt=""><figcaption></figcaption></figure>

## Cite the knowledge base in the conversation to generate a reply

1. Create a new topic. In the conversation toolbar, click Knowledge Base to expand the list of knowledge bases that have been created, and select the knowledge base you want to cite;
2. Enter and send the question, and the model will return an answer generated from the retrieval results;
3. At the same time, the cited data sources will be attached below the answer for quick access to the source files.

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-8097c7c77d5a37ac1a9d7279b2cfa6c200c4bca2%2Fimage-9.webp?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1658303467-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Ut5BptC3t8CtSU1UWpM%2Fuploads%2Fgit-blob-d74289fd35eecc143d2938b75a34defbdbe108bf%2Fimage-10.webp?alt=media" alt=""><figcaption></figcaption></figure>
