Knowledge base: Assistant Retrieve only the last f...
# support
g
I have created an assistant through the API and uploaded 3 files. When I ask the assistant to give me info about its context, it says it can only access the latest file uploaded (i.e. it does not know about context other than the one in the last file uploaded). Is that a known issue , or is it just me. ? I am using GPT4-o
v
@GetInference It sounds like you might be encountering an issue with how the assistant is accessing the files you've uploaded. The assistant should be able to access the context from all the files that are specified in its configuration, not just the latest one. This could be due to a configuration issue or a misunderstanding of how the assistant is set up to handle multiple files. To better assist you, could you please provide more details about how you've configured the assistant's knowledge base? Specifically, it would be helpful to know if all three file IDs are included in the
assistant.model.knowledgeBase.fileIds
parameter. If they are not, that could explain why the assistant is only referencing the latest file. If they are included and you're still facing this issue, it might be a bug or a limitation that needs to be addressed by the support team. If you need further assistance with this, please let me know, and I can help guide you through the necessary steps or direct you to support for more detailed troubleshooting.
You can continue this conversation by mentioning me in the message.
g
@User I can provide more details about how the assistant's knowledge base is configured when creating an assistant and uploading files: File Upload: When a training file is provided during assistant creation, it's first uploaded to the Vapi API: const fileUploadResponse = await axios.post(
${process.env.VAPI_BASE_URL}/file
, formData, { headers: { 'Authorization':
Bearer ${process.env.VAPI_API_KEY}
, ...formData.getHeaders(), }, } ); trainingFileId = fileUploadResponse.data.id; Knowledge Base Configuration: If a training file is uploaded (i.e., trainingFileId is not null), the knowledge base is configured in the assistantRequestData: ...(trainingFileId ? { knowledgeBase: { provider: 'canonical', fileIds: [trainingFileId], }, } : {}), Assistant Creation: The assistantRequestData, including the knowledge base configuration, is then sent to the Vapi API to create the assistant: const assistantResponse = await axios.post(
${process.env.VAPI_BASE_URL}/assistant
, assistantRequestData, { headers: { 'Authorization':
Bearer ${process.env.VAPI_API_KEY}
, 'Content-Type': 'application/json', }, } ); To answer your specific question: Yes, all the file IDs (in this case, just one) are included in the assistant.model.knowledgeBase.fileIds parameter when creating the assistant. However, the knowledge base is only included in the assistant data if a training file is provided. If no file is uploaded, the knowledgeBase field is not included in the request to the Vapi API.
@Vapi I can provide more details about how the assistant's knowledge base is configured when creating an assistant and uploading files: File Upload: When a training file is provided during assistant creation, it's first uploaded to the Vapi API: const fileUploadResponse = await axios.post( ${process.env.VAPI_BASE_URL}/file, formData, { headers: { 'Authorization': Bearer ${process.env.VAPI_API_KEY}, ...formData.getHeaders(), }, } ); trainingFileId = fileUploadResponse.data.id; Knowledge Base Configuration: If a training file is uploaded (i.e., trainingFileId is not null), the knowledge base is configured in the assistantRequestData: ...(trainingFileId ? { knowledgeBase: { provider: 'canonical', fileIds: [trainingFileId], }, } : {}), Assistant Creation: The assistantRequestData, including the knowledge base configuration, is then sent to the Vapi API to create the assistant: const assistantResponse = await axios.post( ${process.env.VAPI_BASE_URL}/assistant, assistantRequestData, { headers: { 'Authorization': Bearer ${process.env.VAPI_API_KEY}, 'Content-Type': 'application/json', }, } ); To answer your specific question: Yes, all the file IDs (in this case, just one) are included in the assistant.model.knowledgeBase.fileIds parameter when creating the assistant. However, the knowledge base is only included in the assistant data if a training file is provided. If no file is uploaded, the knowledgeBase field is not included in the request to the Vapi API.
v
@GetInference Thank you for providing the detailed process of how you're configuring the assistant's knowledge base. From your description, it seems that you are aware of how to upload a file and include it in the assistant's configuration. However, if you have uploaded three files and want all of them to be part of the assistant's knowledge base, you need to ensure that all three file IDs are included in the
fileIds
array within the
knowledgeBase
configuration. Here's how you can modify the
assistantRequestData
to include multiple file IDs:
Copy code
javascript
const fileIds = [trainingFileId1, trainingFileId2, trainingFileId3]; // Replace with your actual file IDs

const assistantRequestData = {
  // ... other configuration data
  knowledgeBase: {
    provider: 'canonical',
    fileIds: fileIds, // Include all file IDs here
  },
  // ... other configuration data
};
Make sure that the
fileIds
array contains all the IDs of the files you've uploaded and want to include in the assistant's knowledge base. If you've done this and the assistant is still only accessing the latest file, then it might be a bug or a limitation with the API. If you're still experiencing issues after ensuring that all file IDs are correctly included in the
fileIds
array, it would be best to reach out to the support team for further assistance. They can provide more detailed help and potentially identify any bugs or issues with the API.
g
yes i have done that @Vapi so why the assistant only tales on
v
@GetInference If you have included all the file IDs in the
fileIds
array and the assistant is still only referencing the latest file, it could be due to a few reasons: 1. **Caching Issue**: The assistant might be caching the context from the last file and not refreshing to include the new files. This can sometimes happen if the update to the assistant's configuration isn't properly propagated. 2. **API Limitation**: There might be a limitation or a bug in the API that's preventing it from accessing all the files, despite them being listed in the configuration. 3. **Configuration Overwrite**: If you're updating the assistant's configuration with each new file upload, ensure that you're not overwriting the previous
fileIds
array with a new one containing only the latest file ID. 4. **File Processing**: The files might not be processed correctly, or there could be an error in how they're being interpreted by the assistant. To troubleshoot this issue, you can: - Double-check the assistant's configuration to ensure that all file IDs are present and correctly formatted in the
fileIds
array. - Review the API documentation to confirm there are no limitations on the number of files or the size of the files that can be referenced. - Check for any error messages or logs that might indicate what's going wrong. - If possible, test with a smaller number of files to see if the issue persists. If after these steps the problem is still not resolved, it would be advisable to contact the support team with specific details about the issue, including the steps you've taken, the file IDs, and any error messages you've received. They should be able to provide more targeted assistance. Would you like me to guide you on how to contact the support team for further assistance?
g
yes i have done that @Vapi the problem is that the 3 files are listed AND i am using vapi webui and despite that , it only takes into account one file, the latest one
v
@GetInference It seems like you've done everything correctly by including all three file IDs in the assistant's knowledge base configuration. Since the issue persists despite proper configuration, it's likely that this is a more complex problem that may require direct support intervention to resolve. Given that the VAPI WebUI is only taking into account the latest file, despite multiple files being listed, this could be indicative of a bug or a system limitation that isn't immediately apparent. Here's what I recommend: 1. **Documentation Review**: Double-check the VAPI documentation to ensure there are no specific steps or configurations you might have missed regarding multiple file handling. 2. **Clear Cache**: If the WebUI has any caching mechanisms, try clearing the cache to ensure it's not a caching issue. 3. **Support Contact**: Since this seems to be an issue with the VAPI itself, reaching out to the support team with detailed information about your configuration, the steps you've taken, and the behavior you're observing would be the next best step. 4. **Provide Feedback**: When contacting support, provide them with the file IDs, any relevant configuration details, and describe the expected versus actual behavior. This will help them understand the issue more quickly. Would you like assistance in reaching out to the support team or guidance on how to provide them with the necessary information to address this issue?
g
@User any idea ? "Given that the VAPI WebUI is only taking into account the latest file, despite multiple files being listed, this could be indicative of a bug or a system limitation that isn't immediately apparent. Here's what I recommend:"
s
@GetInference can you share call id.
g
sure 8b5b5534-efc3-4a6f-a712-061ce35e6085 in general, will it access all the files selected or just the last one ? because now it feels like it is only the last one. please advise
@Shubham Bajaj @Sahil ?
s
Copy code
json
      "knowledgeBase": {
        "fileIds": [
          "85360c59-f292-4cc1-83f2-87f7d6e6afd3"
        ],
        "provider": "canonical"
      }
@GetInference your passing only a single file, try passing all of your files and then it will work.
g
just to confirm, i deleted the additional files but originially, they were 3 of them
s
see it depends upon user query and context and top P parmeter how many files to invoke.
i suggest try again and create a new support ticket.
7 Views