Programmatically mark / select files in Knowledge ...
# support
m
Hi Vapi team, I need to implement the similar functionality for updating file contents and found this message https://discord.com/channels/1211482211119796234/1262543833921753099 I do see that we cannot update file contents so deleting and recreating is the only option for now. But another related question I have - is there a way to auto-select or automatically mark the latest created file to be included in the knowledge base for the assistant? In the dashboard, we can select files manually but my use case involves sending new files to the assistant's knowledge base. But in the dashboard the new file stays unselected. Any way to trigger the selection programmatically so that the assistant is able to use the latest file?
v
@MukuFlash03 Hello! Currently, VAPI does not provide a direct feature to automatically select the latest uploaded file for inclusion in the assistant's knowledge base through the dashboard interface. However, you can achieve this programmatically by using VAPI's API, if available. To programmatically select the latest file for your assistant's knowledge base, you would typically need to: 1. Use an API endpoint to list all files in the knowledge base. 2. Identify the most recently uploaded file from the list. 3. Use another API endpoint to update the assistant's configuration, setting the identified file as the selected knowledge base document. If VAPI offers such API endpoints, you would need to write a script or a program that makes these API calls in sequence. This script could be triggered after each file upload to ensure the assistant always uses the latest file. If you need assistance with the specific API calls or if you have any further questions, please let me know, and I'd be happy to help! If this functionality is not yet available, I would recommend reaching out to the VAPI support team for more information on potential workarounds or upcoming features that might meet your needs.
You can continue this conversation by mentioning me in the message.
s
update the assistant with file ids you want to use using the api or use transient assistant with latest file ids.
2 Views