> For the complete documentation index, see [llms.txt](https://docs.maiagent.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maiagent.ai/maiagent-user-guide/maiagent-user-guide-en/build/setup.md).

# Create an AI Assistant

## 1. **Create an AI Assistant** <a href="#create-ai-agent" id="create-ai-agent"></a>

Go to <mark style="color:blue;">AI Features</mark> in the left sidebar, then select <mark style="color:blue;">AI Assistant</mark>, and click <mark style="color:blue;">+ Create AI Assistant</mark> in the upper right corner.

<figure><img src="/files/7xtUJTNAJ4pJhgKk8V30" alt=""><figcaption></figcaption></figure>

## **2. Name Your AI Assistant** <a href="#name-your-ai-agent" id="name-your-ai-agent"></a>

Select the "Basic Settings" tab, and enter the name of your AI Assistant in the <mark style="color:blue;">AI Assistant Name</mark> field. You can name it based on its primary task, such as XX AI Customer Service, XX Regulation Inquiry Helper, or XX Project Smart Assistant.

A single account can create multiple AI Assistants (subject to quantity limits based on your subscription plan).

<figure><img src="/files/xnRehIlOTocWBbQhH5RY" alt=""><figcaption></figcaption></figure>

## 3. Select RAG to Make Your AI Assistant Smarter and More Accurate <a href="#select-rag-for-smarter-responses" id="select-rag-for-smarter-responses"></a>

### What Is RAG <a href="#what-is-rag" id="what-is-rag"></a>

Think of RAG as a combination of "a conversational assistant + a skilled librarian who excels at finding information."

A standard AI Assistant is like a person with excellent memory who is great at storytelling, but can only share knowledge they have previously learned. However, when an AI Assistant is equipped with RAG technology, it is like this assistant **goes to the library to find the latest information** before answering a question, then organizes the findings into its own words and delivers a clear response.

In the MaiAgent platform, this "library" is our **Knowledge Base**. The AI Assistant uses RAG technology to retrieve relevant information from the Knowledge Base, making responses more accurate, timely, and tailored to your needs.

The Knowledge Base setup will be explained in detail in the next section.

{% hint style="info" %}
MaiAgent RAG not only incorporates the RAG technology mentioned at the OpenAI Developer Conference but also combines various classic NLP algorithms with proprietary retrieval techniques. Based on internal datasets compared with OpenAI RAG response accuracy, both achieve 95% response precision.
{% endhint %}

### RAG Settings <a href="#rag-settings" id="rag-settings"></a>

Select the <mark style="color:blue;">RAG Settings</mark> tab, and choose a different RAG (Retrieval-Augmented Generation) from the <mark style="color:blue;">RAG</mark> dropdown menu. If you have no special requirements, <mark style="color:green;">the default is MaiAgent RAG</mark>.

<figure><img src="/files/q7Mr4iyERzjpALwLDrSS" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
Compared to OpenAI RAG, MaiAgent RAG offers more additional features, can be flexibly applied to different deployment needs, handles more diverse data processing formats, and provides a more powerful retrieval and generation experience.

For a detailed comparison, see [**What Is RAG? Comparison Between MaiAgent RAG and OpenAI RAG**](/tech/quickstart/rag.md)
{% endhint %}

### Configure FAQ Priority Response <a href="#configure-faq-priority" id="configure-faq-priority"></a>

To ensure the accuracy and consistency of your AI Assistant's responses, you can enable the "FAQ Priority Response" feature. When this feature is enabled, if both FAQ content and other document content exist in the Knowledge Base, the LLM will prioritize using FAQ content to answer questions, ensuring responses align with your established standard answers.

**Feature Benefits:**

* **Improved response accuracy**: When both FAQ and other documents exist in the Knowledge Base, verified FAQ content is used first, reducing potentially inaccurate AI-generated answers
* **Ensured response consistency**: All users receive the same standard FAQ answers, maintaining service quality
* **Reduced hallucination risk**: FAQ standard answers are referenced first, preventing the AI from generating fabricated or incorrect information

**Setup Steps:**

1. Select the <mark style="color:blue;">Response Mode Settings</mark> tab
2. In the <mark style="color:blue;">System Prompt</mark> field, enter the following instruction:

   ```
   Please prioritize using FAQ content to answer user questions
   ```

<figure><img src="/files/V0vQcISt7wofBkFpdD4B" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
After enabling this feature, when both FAQ content and other document content exist in the Knowledge Base, the AI Assistant will prioritize using FAQ content to answer questions. If no relevant FAQ content is found, the AI Assistant will still respond based on other Knowledge Base documents or general knowledge.
{% endhint %}

## **4.** Select a Model to Give Your AI Assistant a Smart Brain! <a href="#select-model-for-ai-agent" id="select-model-for-ai-agent"></a>

### Purpose of Language Model Selection <a href="#language-model-selection-purpose" id="language-model-selection-purpose"></a>

The performance of each AI Assistant largely depends on its brain -- the language model (LLM) it uses. In this step, you can choose different types of models based on your needs, which will affect response speed, comprehension ability, and the depth and naturalness of answers.

Choosing the right model is like enabling high-performance mode for your AI Assistant, providing the best experience tailored to your use case!

{% hint style="info" %}
[**Key Factors When Choosing a Large Language Model**](https://docs.maiagent.ai/tech/quickstart/llm)
{% endhint %}

### Language Model Settings <a href="#language-model-settings" id="language-model-settings"></a>

Select the <mark style="color:blue;">Basic Settings</mark> tab, and choose a different large language model from the <mark style="color:blue;">LLM Model</mark> dropdown menu. If you have no special requirements, <mark style="color:green;">the default is Claude 4.5 Haiku</mark>.

## 5. Create a System Prompt for Your Use Case <a href="#create-system-prompt-for-use-case" id="create-system-prompt-for-use-case"></a>

To make your AI Assistant better suited to different application needs, you can set up a "System Prompt" to make the AI's response style and content more aligned with the scenario.

{% hint style="info" %}
[What Is a System Prompt? System Prompt Example Templates?](https://docs.maiagent.ai/tech/ai-agents/system-prompt)

[AI Tool for Generating Role Assistants](https://chat.maiagent.ai/web-chats/eb2c95ef-f022-4716-92aa-ec0d3ffbc80b/conversations/bc7ed5e6-b3cb-4c91-a465-a4e439c06db4)
{% endhint %}

### Hallucination-Free Generative AI Response Mechanism <a href="#hallucination-free-generative-ai-response" id="hallucination-free-generative-ai-response"></a>

MaiAgent's "Hallucination-Free Generative AI Response Mechanism" ensures high accuracy when the AI answers questions. When facing uncertain or out-of-scope questions, it honestly expresses its limitations rather than generating fabricated answers, providing users with a more reliable and trustworthy AI interaction experience. The importance for various industries and public sector applications is described below:

{% tabs %}
{% tab title="Industry Applications" %}
**Financial Industry:**

When handling investment advice and risk assessments, the AI must provide analysis based on verified data, avoiding false information that could lead to incorrect investment decisions. When information is insufficient or uncertain, the system clearly states so, ensuring the reliability of investment decisions.

**Healthcare Industry:**

When assisting with medical diagnosis and drug consultation, the AI system must strictly follow established medical knowledge and must not generate suggestions that could mislead patients. For novel or unverified medical information, the system clearly indicates that further professional consultation is needed.

**Manufacturing Industry:**

In applications such as production process optimization and quality control, the AI must provide recommendations based on actual production data and verified methods, avoiding production losses due to inaccurate predictions.

**Education Industry:**

When assisting with teaching and answering student questions, the AI needs to provide accurate knowledge rather than incorrect information that could mislead learning. For complex or ambiguous concepts, the system honestly acknowledges its understanding limitations.

**Legal Industry:**

When providing legal information and advice, the AI must be based on existing regulations and case law, rather than offering speculative advice that may carry legal risks. The system clearly identifies matters that require further confirmation by a professional lawyer.

**Customer Service:**

When handling customer inquiries, the AI must provide accurate product information and service descriptions. For questions that cannot be confirmed, it immediately refers them to relevant professionals, avoiding customer misdirection.
{% endtab %}

{% tab title="Public Sector Applications" %}
**Government Policy Consultation:**

When providing citizens with policy information and service guidelines, the AI must answer based on the latest and correct regulations and administrative procedures, avoiding outdated or incorrect information. When encountering complex questions requiring professional judgment, the system clearly advises citizens to seek assistance from the relevant department.

**Public Service Decision-Making:**

When assisting government in evaluating public infrastructure and social welfare decisions, the AI must analyze based on real data and research. Uncertain predictions must be clearly stated to ensure the reliability of policy-making.

**Emergency Response Management:**

When handling natural disasters, public health, and other emergencies, the AI system must provide accurate information and guidance. It must not generate false information that could mislead the public and affect disaster response effectiveness.
{% endtab %}
{% endtabs %}

### Select the Appropriate Response Mode to Build Prompts <a href="#select-answer-mode-to-build-prompt" id="select-answer-mode-to-build-prompt"></a>

Select the <mark style="color:blue;">"Response Mode"</mark> tab. From free-form conversation to highly structured responses, it meets various business needs. Each mode has its own features and applicable scope, and you can flexibly choose based on your actual use case.

<figure><img src="/files/9QLuyPmPksyZc557FIGy" alt=""><figcaption></figcaption></figure>

{% tabs %}
{% tab title="Response Mode: General" %}
**Applicable Scenarios**

The AI answers freely based on the question, generating the most suitable response according to context and Knowledge Base content. Suitable for most Q\&A scenarios.

**Operation Steps**

Select the <mark style="color:blue;">Response Mode Settings</mark> tab, choose <mark style="color:blue;">"General (Default)"</mark> as the response mode, and enter the System Prompt you have defined for this AI Assistant in the <mark style="color:blue;">System Prompt</mark> field. For the output format, you can choose to output plain text or JSON format.

<figure><img src="/files/GSSPOT2GJYZD2DaccpSf" alt=""><figcaption></figcaption></figure>

**Use Case: Website Customer Service Assistant**

To create a website customer service assistant for "MaiAgent - AI Assistant Development Platform," you can enter the AI's response settings in the "System Prompt" field, clearly defining its response style and scope of responsibilities.

<figure><img src="/files/6Fa8vW4u7Bs0L4Gx8Ree" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Response Mode: Template" %}
When you select <mark style="color:blue;">**Response Mode: Template**</mark>, the probability of hallucinated responses from your AI Assistant is reduced to zero, because the AI Assistant will strictly reply based on the Knowledge Base and FAQ content you have created, using a classification-based approach to answer questions rather than having the LLM generate content. It uses a template system to generate answers, guaranteeing 100% hallucination-free responses.

**Applicable Scenarios**

Scenarios requiring unified response formats, such as standard consultation processes and reports.

**Case Study**

Suppose you want to create a "Tainan City Government 1999" Customer Service AI Assistant to respond to citizens' municipal-related questions in real time.

**1. Select the** <mark style="color:blue;">**Response Mode Settings**</mark> **tab, and choose** <mark style="color:blue;">**"Template"**</mark> **as the response mode**

<figure><img src="/files/oTgLZ8tVtyQZo0VkkJm2" alt=""><figcaption></figcaption></figure>

**2. Fill in the Response Template (using the template system to generate answers)**

If you have not yet created a Knowledge Base and FAQ, the default response template instructions are as follows.

It is recommended to first create a Knowledge Base or FAQ to use the response template, and the format **must be tabular files such as Excel, CSV, json, or jsonl.**

<figure><img src="/files/ETOmmN6AmNlkVkB5HX8x" alt=""><figcaption></figcaption></figure>

In this example, I have an AI Assistant called "Tainan 1999," and I have added "Tainan 1999 FAQ" to the Knowledge Base.

The FAQ fields include Question, Answer, Agency, Category, and Publish Date.

It is recommended to upload tabular files such as **Excel, CSV, json, or jsonl**, and the fields must have **headers and corresponding content**.

![](/files/tWljHJPQ7GAOEqZq0DWz)

Now return to editing the response template, and click <mark style="color:blue;">**Initialize Response Template**</mark> in the upper right corner. You will see that the system has generated response examples based on the documents you just uploaded to the Knowledge Base.

<figure><img src="/files/VgkrUmz2Y45WndCH0gFU" alt=""><figcaption></figcaption></figure>

Now you can edit and format the response text.

The \[] {} portions are system instructions, so you only need to handle the text portions.

📍 **Loop: Enter the corresponding document filename (specify which document to use for response generation)**

I modified the following parts:

* [x] **"Opening statement" content**
* [x] **"Question" content**
* [x] **"Category" content**
* [x] **Removed "Agency"**
* [x] **Closing statement content**
* [x] **Line break formatting**

<figure><img src="/files/f0veTRyDt7FYolzNQyxy" alt=""><figcaption></figcaption></figure>

When you return to the AI Assistant Q\&A interface and ask a related question, the AI Assistant's response will completely follow the **template format** and **FAQ document content** you just edited.

<figure><img src="/files/6pUoSTlr6TgWPTBPY7i4" alt=""><figcaption></figcaption></figure>

**3. Fill in the Unable to Reply Template**

If the AI Assistant determines there is no relevant data, it will respond based on the <mark style="color:blue;">**Unable to Reply Template**</mark>.

Finally, click the <mark style="color:blue;">**Save**</mark> button to complete.

<figure><img src="/files/PtIq6DXaifXGRe1CYwPV" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Response Mode: Hybrid" %}
**Applicable Scenarios**

Combines general responses with templates, using template format for some content while freely answering the rest. Suitable for scenarios requiring partially structured responses.

**Operation Suggestions**

The System Prompt content may conflict with "Response Mode: Template" at this point, so when selecting "Response Mode: Hybrid," it is recommended to write the System Prompt content with general principles and guidelines.

For example, the task of the System Prompt, interaction principles, communication attitude, etc.

<figure><img src="/files/sD2o9dU9auPyuWPXWWix" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Response Mode: Workflow" %}
**Applicable Scenarios**

Suitable for specific task-oriented scenarios, such as knowledge management, data summarization, and brainstorming.

**Operation Steps**

Go to the "Response Mode Settings" tab and select <mark style="color:blue;">**"Workflow"**</mark> as the response mode.\
This mode is suitable for task-oriented application scenarios, such as:

* **Knowledge Management**: Assist in compiling, retrieving, or maintaining internal knowledge data
* **Information Summarization**: Quickly organize document highlights or meeting notes
* **Planning and Writing**: Assist in brainstorming ideas, drafting proposals, etc.

Select the corresponding workflow module based on your actual business needs to maximize the effectiveness of your AI Assistant for specific tasks.

<figure><img src="/files/Taf5N6MdQoe82k8Mvwg3" alt=""><figcaption></figcaption></figure>

**Use Case: Copywriting Assistant**

Suppose you are a marketing professional at a food company, writing promotional copy for a newly launched healthy snack.

First, select "Writing Assistant" under "Workflow."

<figure><img src="/files/SMJ0EPYrpdMjXmEhaLqB" alt=""><figcaption></figcaption></figure>

Next, go to the AI Assistant Q\&A interface and submit your writing request. The AI Assistant will guide you through filling in the key information needed for the copy, such as:

* Copy topic
* Writing style
* Target audience
* Word count

The AI will generate copy options that match your scenario and communication needs based on your settings, helping you brainstorm quickly and improve writing efficiency.

<figure><img src="/files/AyD49nI4phsJv2AfdZbo" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/jjIL2poHboLwCEEVunHd" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Response Mode: Agent" %}
**Applicable Scenarios**

In daily business operations, employees frequently need to compile data, perform data analysis, and create reports and analytical summaries in response to routine business needs or tasks assigned by managers. Common query questions include:

* "Which product had the highest sales last month?"
* "List all customers with sales exceeding 100,000"
* "What is the revenue trend over the past three months?"

If non-technical personnel handle these questions, they often need to rely on data teams to write SQL queries, making the process time-consuming and inefficient.

Now, through MaiAgent's Agent mode, the system can use the Text to SQL tool to automatically convert natural language questions into corresponding SQL syntax and query the database in real time, quickly delivering analysis results.

{% hint style="info" %}
For Text to SQL feature details, see: [Text to SQL Feature](https://github.com/Playma-Co-Ltd/maiagent-user-guide-gitbook/tree/main/en/tools/text2sql.md)
{% endhint %}

This feature is particularly suitable for scenarios requiring <mark style="color:blue;">**real-time queries and data insights**</mark>, such as report analysis, operational metric tracking, and data queries. It enables non-technical users to easily access data and achieve a more intuitive and efficient data-driven decision-making process.

**Text to SQL Operation Steps**

1. Go to the "Response Mode Settings" tab and select <mark style="color:blue;">**"Agent"**</mark> as the response mode

<figure><img src="/files/2JSXE9uktXGm78LzwFdK" alt=""><figcaption></figcaption></figure>

2. Upload database content or select a database URL

   {% hint style="info" %}

   * MaiAgent supports:
     * **MySQL**
     * **PostgreSQL**
     * **Oracle DB**
     * **Microsoft SQL Server (MSSQL)**
   * The maiagent option applies Excel files you have already uploaded to the MaiAgent Knowledge Base {% endhint %}

**Use Case: E-commerce Product Sales Data Query**

Suppose you are a marketing professional at an e-commerce platform and want to quickly query product sales data.

First, select <mark style="color:blue;">**"Agent"**</mark> as the response mode in the "Response Mode Settings" tab.

<figure><img src="/files/9Hk3k9PxuU0zvx5dc8ip" alt=""><figcaption></figcaption></figure>

Next, you can upload an Excel file to the Knowledge Base, and the system will automatically convert it into a queryable database format.

{% hint style="info" %}
For detailed instructions on using MaiAgent Knowledge Base for Text to SQL, see: [Using MaiAgent Knowledge Base for Text to SQL](https://github.com/Playma-Co-Ltd/maiagent-user-guide-gitbook/tree/main/en/tools/text-to-sql-maiagent.md)
{% endhint %}

<figure><img src="/files/jx8VxMUwTDpVsw92v3WL" alt=""><figcaption></figcaption></figure>

You can also directly ask your company's technical staff to provide a MySQL or PostgreSQL connection string.

Assuming you have obtained a PostgreSQL connection string, select PostgreSQL from the database URL dropdown menu, paste the connection string, and click Save.

<figure><img src="/files/dDXHgnq1BEmmHMxR2ks3" alt=""><figcaption></figcaption></figure>

Once the setup is complete, go to the AI Assistant Q\&A interface and enter a question, such as:

"What are the top three items by sales on the website, excluding shipping fees?"

<figure><img src="/files/eUX1jCOt1Zf5gKI6DdxW" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## 6. Pre-assign Assistant Permissions <a href="#pre-assign-agent-permissions" id="pre-assign-agent-permissions"></a>

{% hint style="info" %}
[RBAC-Based Permission Management Architecture and Description](/maiagent-user-guide/maiagent-user-guide-en/org/role-permission.md)
{% endhint %}

Select the <mark style="color:blue;">Permission Settings</mark> tab to configure which members the assistant should be pre-assigned to for access. By default, all roles are selected. You can modify the settings based on your use case.

<figure><img src="/files/EPmnTU3IfCfrWz7IV2Ar" alt=""><figcaption></figcaption></figure>

## 7. Complete Your AI Assistant Setup <a href="#complete-ai-agent-setup" id="complete-ai-agent-setup"></a>

After completing the above steps, click the blue <mark style="color:blue;">Confirm</mark> button at the bottom right of the dialog to finish the setup.


---

# 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.maiagent.ai/maiagent-user-guide/maiagent-user-guide-en/build/setup.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.
