Skip to content

RAG knowledge bases

A RAG knowledge base stores documents that an assistant uses to answer questions. Uploaded files are automatically split into chunks and indexed so the assistant can retrieve relevant passages.

Create knowledge bases in the GPTunneL interface. Use the API to list them and to add or delete files.

https://gptunnel.ru/v1/database
Method Endpoint Behavior
GET /v1/database/list API Key Owner Databases
GET /v1/database/file/list Files in a database or file information
POST /v1/database/file/add Upload File to Database
POST /v1/database/file/delete Remove File from Base

Start with the list of knowledge bases. It provides the databaseId required by the file endpoints.

After uploading a file, save its id and pass it as fileId when you check its status. The response is an array with one entry. Wait until its status is ready, then connect the knowledge base to the assistant and ask about a fact from the file. To verify retrieval after deleting the file, use a new chat. The old chat may still contain the answer in its history. See delete a file for the conditions under which deletion unlinks the knowledge base from assistants and bots.