> For the complete documentation index, see [llms.txt](https://docs.clickai.vn/clickai-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clickai.vn/clickai-docs/co-so-du-lieu/tich-hop-knowledge-vao-ung-dung.md).

# Tích hợp Knowledge vào Ứng dụng

## Mục lục

·       \[Tạo ứng dụng tích hợp Knowledge]\(#tạo-ứng-dụng-tích-hợp-knowledge)

·       \[Retrieval Setting]\(#retrieval-setting)

·       \[Metadata Filtering]\(#metadata-filtering)

·       \[Tích hợp trong Chatflow/Workflow]\(#tích-hợp-trong-chatflowworkflow)

·       \[Tích hợp trong Chatbot]\(#tích-hợp-trong-chatbot)

·       \[Xem ứng dụng liên kết]\(#xem-ứng-dụng-liên-kết)

·       \[FAQ]\(#faq)

&#x20;

## Tạo ứng dụng tích hợp Knowledge

Quy trình nhanh:

1\.     Vào Knowledge — Tạo Knowledge — Upload file

2\.     Vào Studio — Tạo Application — Chọn Chatbot

3\.     Mở Context, nhấn Add, chọn Knowledge Base đã tạo

4\.     Sử dụng Metadata Filtering để tinh lọc tìm kiếm

5\.     Trong Context Settings > Retrieval Setting, cấu hình phương pháp retrieval

6\.     Bật Citation and Attribution trong Add Features

7\.     Test trong Debug and Preview

8\.     Nhấn Publish để phát hành ứng dụng

&#x20;

## Retrieval Setting

Cấu hình cách ứng dụng truy xuất thông tin từ Knowledge Base:

### Weight Settings

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Mode</td><td valign="top">Mô tả</td></tr><tr><td valign="top">Semantic = 1</td><td valign="top">Chỉ semantic search. Tìm theo ý nghĩa ngữ cảnh, hỗ trợ đa ngôn ngữ</td></tr><tr><td valign="top">Keyword = 1</td><td valign="top">Chỉ keyword search. Match chính xác từ khóa, tiết kiệm tài nguyên</td></tr><tr><td valign="top">Custom Weights</td><td valign="top">Kết hợp semantic + keyword theo tỷ lệ tùy chỉnh</td></tr></tbody></table>

&#x20;

### Tham số Retrieval

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Tham số</td><td valign="top">Mô tả</td><td valign="top">Mặc định</td></tr><tr><td valign="top">Top K</td><td valign="top">Số chunks tối đa trả về</td><td valign="top">3</td></tr><tr><td valign="top">Score Threshold</td><td valign="top">Điểm similarity tối thiểu</td><td valign="top">0.5</td></tr></tbody></table>

&#x20;

&#x20;

## Metadata Filtering

### Trong Chatflow/Workflow

Sử dụng node Knowledge Retrieval với Metadata Filter:

Chọn Filter Mode:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Mode</td><td valign="top">Mô tả</td></tr><tr><td valign="top">Disabled (Mặc định)</td><td valign="top">Không lọc metadata</td></tr><tr><td valign="top">Automatic</td><td valign="top">Filters tự cấu hình từ query variables</td></tr><tr><td valign="top">Manual</td><td valign="top">Cấu hình filters thủ công</td></tr></tbody></table>

&#x20;

Cấu hình Manual Mode:

9\.     Nhấn Conditions để mở panel cấu hình

10\.  Nhấn +Add Condition — chọn metadata fields

11\.  Cấu hình filter conditions:

<table data-header-hidden><thead><tr><th valign="top"></th><th valign="top"></th></tr></thead><tbody><tr><td valign="top">Kiểu dữ liệu</td><td valign="top">Operators hỗ trợ</td></tr><tr><td valign="top">String</td><td valign="top">is, is not, is empty, is not empty, contains, not contains, starts with, ends with</td></tr><tr><td valign="top">Number</td><td valign="top">=, ≠, >, &#x3C;, ≥, ≤, is empty, is not empty</td></tr><tr><td valign="top">Date</td><td valign="top">is, before, after, is empty, is not empty</td></tr></tbody></table>

&#x20;

12\.  Thêm filter values:

·       Variable: Chọn từ variables trong Chatflow/Workflow

·       Constant: Nhập giá trị cố định

13\.  Set logic operators: AND (match tất cả) hoặc OR (match bất kỳ)

📝 NOTE: Automatic Mode yêu cầu chọn model cho document retrieval. Khi chọn nhiều Knowledge Base, chỉ metadata fields chung mới hiển thị.

### Trong Chatbot

Chatbot sử dụng metadata filtering đơn giản hơn thông qua Context Settings.

&#x20;

## Tích hợp trong Chatflow/Workflow

14\.  Kéo node Knowledge Retrieval vào canvas

15\.  Chọn Knowledge Base cần kết nối

16\.  Cấu hình query variable (thường là {{sys.query}})

17\.  (Tùy chọn) Cấu hình Metadata Filter

18\.  Kết nối output đến node LLM làm context

&#x20;

## Tích hợp trong Chatbot

19\.  Mở ứng dụng Chatbot trong Studio

20\.  Trong phần Context, nhấn + Add

21\.  Chọn Knowledge Base

22\.  Cấu hình Retrieval Settings

23\.  Bật Citation and Attribution nếu cần

&#x20;

## Xem ứng dụng liên kết

Trong Knowledge Base, bạn có thể xem danh sách tất cả ứng dụng đang sử dụng knowledge base đó. Giúp đánh giá tác động khi thay đổi nội dung.

&#x20;

## FAQ

Làm sao chọn Rerank settings trong multi-recall mode?

Khi sử dụng multiple knowledge bases, bật Rerank model để sắp xếp kết quả từ tất cả sources.

Không tìm thấy "Weight Score"?

Weight Score chỉ khả dụng khi sử dụng High Quality index method. Kiểm tra index method trong Knowledge Base Settings.

Lỗi khi điều chỉnh Weight Score với nhiều Knowledge Base?

Khi referencing nhiều knowledge bases, Weight Score có thể bị giới hạn. Cấu hình Rerank model thay thế.

&#x20;

*📖 Trước: \[Test Retrieval]\(./11-test-retrieval.md)*


---

# 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.clickai.vn/clickai-docs/co-so-du-lieu/tich-hop-knowledge-vao-ung-dung.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.
