https://discord.gg/botpress logo
Linking upload files via the API to a KB
# 🤝help
r
Hello, is it possible to upload files to a bot and link the file to a knowledge base? If not, what's the point of uploading a file? https://docs.botpress.cloud/docs/developers/api-handbook/files-api/ Thank you
b
The purpose is for your bot to perform RAG to produce a response based on the text of the pdf.

https://www.youtube.com/watch?v=lWihOWJRMaM▾

Watch this video for more info!
r
Thanks for your help, I have no problem using the knowledge bases via the studio interface. The problem is that when I upload files via the API. The files don't appear in the studio interface (or I can't find them). I'd like to upload files directly to a defined knowledge base to be able to update knowledge base files dynamically. Is this possible?
b
like when you upload a file via the File API but the file would not be shown in the UI interface or it cannot be appended to an existing KB?
just to confirm
r
The file does not appear in the UI interface. The file status is “upload_pending”, is this normal?
Copy code
{
            "id": "file_01J3083PHB9R4EZJKKN12702R4",
            "botId": "3ff6ea8e-6193-4665-8b16-afbe569287a3",
            "key": "info_bot.txt",
            "url": "https://s3.us-east-1.amazonaws.com/cloud-filesapi-bu...",
            "size": null,
            "contentType": "text/plain; charset=utf-8",
            "tags": {},
            "createdAt": "2024-07-17T11:44:13.856Z",
            "updatedAt": "2024-07-17T11:44:13.856Z",
            "accessPolicies": [],
            "index": true,
            "status": "upload_pending"
        },
b
how long has this been upload_pending>
?*
The file it will initially have a status of "indexing_pending" and will be indexed asynchronously. The time it takes to index the file will depend on the file size and the current load on the system. You can check the status of the file by calling the Get File endpoint and checking that the file.status property has changed to "indexing_completed". https://botpress.com/docs/files-api#notes-on-indexing
r
The file launched the request several hours ago. :
Copy code
https://api.botpress.cloud/v1/files
{
    “key": ‘info_bot.txt’,
    “content": ‘This is a test file’,
    “size": 1024,
    “index": true
}
I used the REST API directly, I'll try using npm botpress/client to see if I have the same problem.
@big-market-58184 I can't get botpress/client v0.23.2 to work via an edge function supabase (Deno). Do you know if this is possible? I manage to create the client and then I get this error when I try to create a bot, retrieve a bot or any other: Error:
Cannot read properties of undefined (reading 'write')
b
I don't think I can further assist you. Will you have time from 10:30 to 11:00? There'll be a livestream for developer office hour.
9 Views