Knowledge base (RAG)
Give a chatbot its own knowledge by uploading documents. The platform extracts, chunks, and embeds them into a vector index, then retrieves the most relevant passages at answer time — Retrieval Augmented Generation. Answers stay grounded in your content instead of the base model alone.
Uploading documents
POST a file as multipart/form-data to a chatbot. Supported types: PDF, Excel, Word, CSV, and text, up to 50 MB each. Document management is an admin operation — use an organization key and target the chatbot.
curl https://chat-api-dev.paicloud.ai//chatbot/CHATBOT_ID/document \
-H "x-api-key: $PAI_CHAT_API_KEY" \
-H "x-organization-id: YOUR_ORG_ID" \
-F "file=@handbook.pdf"The response returns the document id and its processing status:
{
"documentId": "…",
"filename": "handbook.pdf",
"fileSize": 248193,
"status": "processing",
"message": "Document uploaded"
}Processing status
A document is not retrievable until it reaches ready. Embedding runs asynchronously after upload.
Folders
Group documents into folders to keep a chatbot's sources organised. Folders are a management convenience — retrieval searches across the chatbot's indexed content regardless of folder.
How retrieval feeds answers
At answer time, the user's message is embedded and matched against the chatbot's document vectors using pgvector semantic search. The top passages are injected into the model prompt as context, so the reply cites your material rather than guessing. More relevant, well- chunked documents produce better grounding.
See Chatbots & organisations for key scoping and Error codes for upload failures.