Repository navigation
en use knowledge base
A knowledge base lets AstrBot answer questions using material you provide. Upload product manuals, FAQs, course notes, or project documentation, and the Agent can retrieve relevant passages before composing an answer.
For example, upload a community onboarding guide so the bot can answer “How do I join the project?” or “Where do I report a problem?” without putting the entire document in its persona prompt.
This is retrieval-augmented generation (RAG). During upload, AstrBot extracts text, splits it into chunks, and builds an index. During chat, it retrieves relevant chunks and passes them to the chat model. Uploading documents does not train or fine-tune that model, and answers can still be incorrect.
| Model | Required? | Role |
|---|---|---|
| Chat model | Required to answer questions | Reads retrieved passages and generates the answer |
| Embedding model | Required to create a knowledge base | Converts documents and queries into vectors for semantic retrieval |
| Rerank model | Optional | Scores candidate passages again to put more relevant results first |
Embedding and chat models are configured separately. A model that only supports chat cannot be used as an embedding model. Start with one chat model and one embedding model; add reranking later if needed.
This page covers AstrBot's current built-in knowledge base, available since 4.5.0. It does not require a knowledge base plugin.
- Open
Providersin the sidebar. - Select the
Embeddingtab, clickAdd, and choose a provider. - Enter the service's API endpoint, API key, model name, vector dimensions, and other required settings.
- Save and make sure the provider is available.
Current integrations include OpenAI-compatible services, Google Gemini, Ollama, Alibaba Cloud Model Studio, and NVIDIA embedding services. For OpenAI Embedding, use the service's API base URL and an embedding model name, not a chat model name.
For local services such as Ollama, the endpoint must be reachable from the environment running AstrBot. In Docker, localhost points to the AstrBot container, not automatically to your host machine.
Vector dimensions must match the model's actual output. Vectors from different models are not interchangeable; consult the provider's model documentation if unsure.
To add reranking, create and save a corresponding provider under Providers → Rerank. You can create, upload to, and use a knowledge base without one.
::: tip Where is the content sent? With a remote embedding service, document text and retrieval queries are sent to that service. Retrieved passages are sent to the chat model when it answers. Choose model services appropriate for your material. :::
- Open
Knowledge Basein the sidebar and clickCreate Knowledge Base. - Enter a recognizable name, such as “Community Onboarding,” and a description.
- Select the provider you configured under
Embedding Model. - Optionally select a
Rerank Model; otherwise leave it empty. - Click
Create.

You can create several knowledge bases—for example, one for product manuals and another for community rules—and choose one or more for a conversation.
::: warning Changing embedding models requires a new knowledge base The embedding model selection is locked after creation. Do not change the model or vector dimensions of the provider used by an existing knowledge base: its index would become incompatible. To switch models, add a new provider, create a new knowledge base, and upload the original documents again. :::
- Open the knowledge base and select
Documents. - Click
Upload Documentand keep theFile Uploadtab selected. - Select or drag in files. You can select multiple files at once.
- Keep the default chunking and batch settings for your first attempt, then click
Upload. - Wait for parsing, chunking, and embedding to finish. Confirm that the document list shows the documents and their chunk counts.

Supported formats are .txt, .md, .markdown, .rst, .adoc, .pdf, .docx, .epub, .xls, and .xlsx. The upload interface lists a maximum of 128 MB per file. Split large collections by topic to make them easier to process and maintain.
PDFs should contain extractable text. Scanned, image-only PDFs are not automatically processed with OCR; convert them to text or searchable PDFs first. Complex document or spreadsheet layouts can also affect extraction. Inspect the chunks after uploading.
Chunking splits a long document into passages suitable for retrieval.
| Setting | Purpose | Starting recommendation |
|---|---|---|
| Chunk Size | Controls passage size in characters | Start with the default 512 and adjust based on results |
| Chunk Overlap | Retains context shared by adjacent passages | Start with 50; keep it smaller than the chunk size |
| Batch Size | Number of chunks submitted to the embedding service per batch | Keep the default 32 |
| Concurrent Tasks Limit | Limits concurrent processing tasks | Start with 3; lower it if the service rate-limits requests |
| Max Retries | Retries failed tasks | Keep the default 3 |
Changing a knowledge base's default chunk settings affects later uploads. It does not automatically split existing documents again. Re-upload documents when you need to change their chunking.
Switch the upload dialog to From URL and enter a public page URL. This feature is currently in beta and uses Tavily to extract HTML content. It reads the Tavily key from the default profile. Follow the interface prompt to configure that key; credentials for another search provider cannot replace it.
Enable Content Cleaning optionally uses the selected chat model to clean and organize extracted content, incurring additional model calls. Pages requiring login, blocking crawlers, or failing content extraction may not import. Imported content is a snapshot; later website changes are not synchronized automatically.
A successful upload does not enable the knowledge base in chat. First open the knowledge base's Retrieval tab:
- Enter a question whose answer is in a document, such as “How can a newcomer join the project?”
- Click
Searchand inspect the passages and their source documents. - Confirm that the passages contain the answer before connecting the knowledge base to chat.
This page tests retrieval, not a chat model's generated answer. If no relevant passage appears, check the documents and chunks first.
- Open
Configand choose the profile your bot or ChatUI actually uses. - Under
AI → Capabilities → Knowledge Base, select one or more entries inKnowledge Base List. - Keep the default retrieval counts for your first attempt.
- Click
Save Configurationat the bottom right. - Ask about the uploaded material in the corresponding conversation.
Using the community onboarding guide, explain how to join the project. If the material does not cover a detail, say so.
Documents do not become permanent model memory. The relevant knowledge base must be selected by the current profile or a session rule. Different profiles can use different knowledge bases; creating one does not enable it for every bot.
| Mode | When retrieval happens | Chat model requirement |
|---|---|---|
| Standard retrieval (default) | Retrieves using the current message and appends relevant passages to the model request | Does not require knowledge base tool calling |
Agentic Knowledge Base Retrieval |
Exposes retrieval as a tool; the model decides when and how to query it | The model and its API must support tool calling |
Keep the default mode if you want retrieval before each answer. With Agentic retrieval enabled, the model may answer without querying the knowledge base. For testing, explicitly ask it to query first.
Fusion Search Results Count controls the candidate count after results from multiple knowledge bases are fused. Final Results Count controls how many passages reach the model. Their defaults are 20 and 5.
Too few results can miss an answer; too many increase input length and noise. Start with the defaults and adjust based on the actual passages returned by the retrieval test.
Under Custom Rules, assign knowledge bases and a retrieval count to a specific message source. Session selections override the profile. Clearing the selection and saving removes the override and restores the profile's knowledge bases. See Custom Rules.
-
Inspect documents: Use a document's view action under
Documentsto check its parsed chunks. - Update material: Delete the outdated document and upload its replacement so contradictory versions are not retrieved together. Keep copies of the originals.
-
Tune retrieval: Under
Settings, adjust dense and sparse retrieval counts or select a rerank provider. Dense retrieval focuses on semantic similarity; sparse retrieval focuses on word matching. - Rename carefully: Profiles select knowledge bases by name, so update affected profiles after renaming one.
- Delete carefully: Deleting a document removes its chunks. Deleting a knowledge base removes its documents and index. These operations cannot be undone; keep backups first.
Check that the embedding provider is saved and available, its model name, endpoint, and dimensions are correct, and its key has quota. Inspect the error under Data & Logs → Logs. Lower the batch size or concurrency if the service rate-limits requests.
Inspect the chunks. Was the text extracted correctly? Does it contain the relevant keywords? Is the PDF only scanned images? Try a more specific question in Retrieval, then adjust chunking, result counts, or add a reranker if needed.
Check the conversation's profile selection and any session overrides. In Agentic mode, also check that the model and its API support tool calling. The model may still ignore retrieved material; a persona instruction such as “Prefer retrieved sources and do not invent details when they are insufficient” can help.
The existing index is incompatible with the new embedding model. Restore the original provider settings, or create a new knowledge base and re-upload with the new model. Changing a dimension field alone does not convert stored vectors.
With SiliconFlow, obtain a key from its console and add an OpenAI Embedding provider:
- API key: Your SiliconFlow key.
- API base URL:
https://api.siliconflow.cn/v1. - Model: An embedding model currently offered by the service, such as
BAAI/bge-m3; set dimensions according to its model documentation.
Available models, pricing, and free quotas may change. Check the platform's current information, then follow the creation, upload, and retrieval testing steps above.
You can also enable Web Search for current public information. A knowledge base is suited to material you maintain; the two capabilities complement each other.
- 首页
- 文档入口
- Top Level
- community events
- deploy
- dev
- others
- platform
- 接入 OneBot v11 协议实现
- 接入钉钉 DingTalk
- 接入 Discord
- 接入 Kook
- 接入飞书
- 接入 LINE
- 接入 Matrix
- 接入 Mattermost
- 接入 Misskey 平台
- 接入 QQ 官方机器人平台
- 通过 QQ官方机器人 接入 QQ (Webhook)
- 通过 QQ官方机器人 接入 QQ (Websockets)
- 接入 Satori 协议
- 接入 server-satori (基于 Koishi)
- 接入 Slack
- 接入消息平台
- 接入 Telegram
- 接入 VoceChat
- AstrBot 接入企业微信
- 接入企业微信智能机器人平台
- AstrBot 接入微信公众平台
- 接入个人微信
- providers
- use
- Home
- Docs Entry
- Top Level
- config
- deploy
- Deploy AstrBot on 1Panel
- Deploy AstrBot on BT Panel
- Deploy AstrBot on CasaOS
- Deploy AstrBot from Source Code
- Community-Provided Deployment Methods
- Deploy via Compshare
- Deploy with AstrBot Desktop Client
- Deploy AstrBot with Docker
- Deploy AstrBot with Kubernetes
- Deploy AstrBot with AstrBot Launcher
- Other Deployments
- Package Manager Deployment (uv)
- Installation via System Package Manager
- Preface
- dev
- AstrBot Configuration File
- API Scope–Endpoint Reference
- AstrBot HTTP API
- AstrBot Plugin Market JSON Specification
- Developing a Platform Adapter
- plugin
- AI
- Text to Image
- Handling Message Events
- Plugin Configuration
- Plugin Internationalization
- Plugin Views
- Sending Messages
- Session Control
- Minimal Example
- Plugin Storage
- AstrBot Plugin Development Guide 🌠
- Publishing Plugins to the Plugin Marketplace
- ospp
- others
- platform
- Connect OneBot v11 Protocol Implementations
- Connect to DingTalk
- Connecting to Discord
- Connect to KOOK
- Connecting to Lark
- Connecting to LINE
- Connecting to Matrix
- Connecting to Mattermost
- Connecting to Misskey Platform
- Connect QQ Official Bot
- Connect QQ via QQ Official Bot (Webhook)
- Connect QQ via QQ Official Bot (Websockets)
- Connect to Satori Protocol
- Connect server-satori (Koishi)
- Connecting to Slack
- Messaging Platforms
- Connecting to Telegram
- Connect to VoceChat
- Connect AstrBot to WeCom
- Connect to WeCom AI Bot Platform
- Connect AstrBot to WeChat Official Account Platform
- Connect Personal WeChat
- providers
- Connect 302.AI
- Agent Runners
- Built-in Agent Runner
- Connect to Coze
- Connect to Alibaba Cloud Bailian Application
- Connect to DeerFlow
- Connect to Dify
- Connect AIHubMix
- coze
- dashscope
- dify
- Model input images
- Large Language Model Providers
- Connect MiraRouter
- NewAPI
- Connect PPIO Cloud
- Connect LM Studio to Use DeepSeek-R1 and Other Models
- Integrating Ollama
- Connect ShengSuanYun
- Connecting to SiliconFlow
- Connecting Model Services
- Connecting to TokenPony
- use
- Agent Execution Mode {#agent-runner}
- Agent Sandbox Environment
- astrbot sandbox
- AstrBot CLI {#cli-commands}
- Docker-based Code Interpreter
- Built-in Commands
- computer
- Context Compression
- Custom Rules
- AstrBot Knowledge Base
- MCP
- AstrBot Plugins {#astrbot-star}
- Proactive Capabilities
- Skills {#anthropic-skills}
- SubAgent Orchestration {#agent-handoff-and-subagent}
- Unified Webhook Mode
- Web Search
- WebUI