SuperAPI AI Directory

byted-bytehouse-knowledge-base-management

General & other

View repository

Updated 10-15 17:30

About this skill

byted-bytehouse-knowledge-base-management

Description

ByteHouse Knowledge Base Management, providing the management capabilities of the ByteHouse knowledge base, including creating a knowledge base, adding knowledge base content, and querying the knowledge base

📁 File Description

  • SKILL.md - This file, the main skill document
  • create_knowledge_base.py - Script for creating a knowledge base
  • recall_knowledge_base.py - Script for recalling knowledge base files
  • upload_file_to_kb.py - Script for uploading files to the knowledge base (pdf/md/docx/xlsx)
  • delete_file_from_kb.py - Script for deleting knowledge base content
  • delete_knowledge_base.py - Script for deleting a knowledge base
  • list_files_in_kb.py - Script for querying the knowledge base file list
  • list_knowledge_base.py - Script for querying the knowledge base list
  • knowledge_base_chat.py - Script for streaming Q&A on the knowledge base

Configuration Description

The configuration is saved in ~/.bytehouse_config.json . If this file exists and is non-empty, the configuration in the file is used directly. If it does not exist, ask the user to provide the ByteHouse connection information (also send this document to the user; the document explains how to obtain the host address and password:https://www.volcengine.com/docs/6517/1121919?lang=zh ). After the user provides the information, save it to the json file to avoid repeatedly asking the user for connection information. When the user switches ByteHouse clusters, modify this file as well.

{
   "BYTEHOUSE_HOST": "<ByteHouse-host>",
   "BYTEHOUSE_PASSWORD": "<ByteHouse-password>"
}

BYTEHOUSE_HOST (host address) and BYTEHOUSE_PASSWORD (password)must beprovided by the user

Execute scripts/export_config.sh to import the configuration information into environment variables

source scripts/export_config.sh

Risk Warning

When the user wants to delete a file in the knowledge base, or delete the entire knowledge base,mustprompt the user that the data cannot be recovered, and execute only after confirming with the user again.

Prerequisites

  • Python 3.8+
  • uv (already installed at /root/.local/bin/uv)

🚀 Usage

The following are specific usage instruction examples for each script. Before executing these scripts, please ensure that the configuration has been imported:

# 导入配置
source scripts/export_config.sh

1. Create a knowledge base (create_knowledge_base.py)

python3 scripts/create_knowledge_base.py "我的知识库"
# 可选参数:--description "这是我的知识库描述"

2. Query the knowledge base list (list_knowledge_base.py)

python3 scripts/list_knowledge_base.py

3. Upload files to the knowledge base (upload_file_to_kb.py)

python3 scripts/upload_file_to_kb.py --kb-id 123 --file ./document.pdf
# 可选参数:--chunk-size 512 --delimiters "#,##" --enable-image-ocr --enable-chunk-auto-merge

4. Query the knowledge base file list (list_files_in_kb.py)

python3 scripts/list_files_in_kb.py --kb-id 123

5. Knowledge base file recall (recall_knowledge_base.py)

python3 scripts/recall_knowledge_base.py --kb-id 123 --query "你的搜索问题"

6. Streaming Q&A on the knowledge base (knowledge_base_chat.py)

python3 scripts/knowledge_base_chat.py --kb-ids 123 --input "你的提问"

7. Delete knowledge base content (delete_file_from_kb.py)

python3 scripts/delete_file_from_kb.py --file-id 456

8. Delete the knowledge base (delete_knowledge_base.py)

python3 scripts/delete_knowledge_base.py --kb-id 123