# 지식 베이스 에이전트

Use [Knowledge Base Agent](https://app.myshell.ai/bot/n6jmQn/309) to manage knowledge bases with domain-specific data or to handle different opinions.

### Guide

#### Get Started

<figure><img src="/files/ai3X24pzBdO7EpPD5iQY" alt=""><figcaption><p>List knowledge bases</p></figcaption></figure>

#### Create New Knowledge Base

A meaningful name is helpful for your bases. After creation, the agent will display your current knowledge bases including their names and tokens.&#x20;

The token (for example, `myshell_f5ac9afa_5c1f_4ef6_ae80_2120e2b2671e` in the picture below) will be used in the [LLM Widget](/ko/create/pro-config-mode/api-reference/module/anywidget-module/llm-widget.md#config)' `knowledge_base_token` field.&#x20;

<figure><img src="/files/vnyxEaT6OUKxgawcoYnU" alt=""><figcaption><p>Create Base</p></figcaption></figure>

#### List Source and Add Source

To modify sources of the new knowledge base, `List Source` button will guide to a detailed operation panel. Currently we support:

* Add Gitbook links as sources
* Upload files as sources
* Re-sync link sources
* Delete sources

<figure><img src="/files/wOXP9Lb76hFBpTrKOQCR" alt=""><figcaption><p>List Source</p></figcaption></figure>

#### Upload File as Source

You can upload text files or PDF files as sources. Text files include md, txt, csv and json.

{% hint style="info" %}
Other text file types can be converted to supported types. Widgets like [MS Word to Markdown](https://app.myshell.ai/widget/jQBbEv) might be helpful.
{% endhint %}

<figure><img src="/files/lwvIkyTr5vK82x34OiGm" alt=""><figcaption><p>Upload text file</p></figcaption></figure>

#### Add Gitbook Link as Source

Currently we only support Gitbook web pages as knowledge base sources. For Gitbook links, we will fetch the target page and all its subpages.

{% hint style="info" %}
If the page is updated, you can click `Re-Sync Source` button to update the source.
{% endhint %}

<figure><img src="/files/hJkpwUPZQhGuiQMiDJjz" alt=""><figcaption><p>Gitbook Link</p></figcaption></figure>

#### Refresh after Processing

After adding a source, the agent will tell you that it is being processed.

<figure><img src="/files/lC7cbCH2uBjcEXzQPSWg" alt=""><figcaption><p>Processing</p></figcaption></figure>

You can refresh to see if it's ready to use.

<figure><img src="/files/uVZAcQFgE1330RSaTjBZ" alt=""><figcaption><p>Refresh</p></figcaption></figure>

#### Use in Widgets

When sources are ready, you can copy the knowledge base's token and configure the LLM widget. Note the `"knowledge_base_token"` field in the widget config.

```json
{
  "id": "llm_widget_template",
  "initial": "home_state",
  "states": {
    "home_state": {
      "inputs": {
        "input_message": {
          "type": "IM",
          "user_input": true
        }
      },
      "tasks": [
        {
          "name": "llm_widget_example_task",
          "module_type": "AnyWidgetModule",
          "module_config": {
            "widget_id": "1744214047475109888",
            "user_prompt": "{{input_message}}", // the text inputted into prompt widget, you can get it from user input or upper state
            "system_prompt": "Act as ...", // Optional field. You can input system prompt of agent.
            "top_p": 0.5, // Optional field. Default value is 0.5
            "temperature": 0.5, // Optional field. Default value is 0.5
            "frequency_penalty": 0, // Optional field. Default value is 0
            "presence_penalty": 0, // Optional field. Default value is 0
            "knowledge_base_token": "", // Your token here
            "output_name": "result"
          }
        }
      ],
      "render": {
        "text": "{{result}}", // it's a string produced by prompt widget.
        "buttons": [
          {
            "content": "Chat Again",
            "description": "",
            "on_click": "rerun"
          }
        ]
      },
      "transitions": {
        "rerun": "home_state",
        "CHAT": "home_state"
      }
    }
  }
}
```


---

# 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://docs.myshell.ai/ko/create/pro-config-mode/tools/knowledge-base-bot.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.
