Creating Knowledge Base through API does not resul...
# support
a
I'm following a guide on how to create a custom knowledge base with API calls and while it creates a knowledge base with a file id and then creates an assistant with the knowledge base id and I see it got assigned through Network tab, there's still no file attached to the assistant like in the dashboard. Any suggestions how to attach the file to the assistant though API, just like in the dashboard?
v
@armandas It sounds like you've successfully created a knowledge base and an assistant, but the file isn't showing as attached to the assistant. Typically, attaching a file to an assistant via API involves a few steps: 1. **Upload the file**: You've mentioned that the file has an ID, so it seems you've already done this. 2. **Create the knowledge base**: You've created a knowledge base with the file ID, which is great. 3. **Create the assistant**: You've created an assistant and assigned the knowledge base ID to it. If the file isn't showing up, it's possible that there's an additional step or API call required to explicitly link the file to the assistant, even after creating the knowledge base. This step might be automatically handled in the dashboard but requires a manual API call when doing it programmatically. Here's what you can do: - **Check the API documentation**: Look for an endpoint related to attaching files to an assistant. There might be a specific call you need to make that wasn't covered in the guide. - **Review the guide**: Ensure that you haven't missed any steps that are required for the file to show up. - **Contact support**: If the documentation isn't clear or you're unable to find the necessary information, reaching out to the API support team would be the next best step. If you can provide me with the specific API you're using (e.g., the name of the service or platform), I might be able to give you more detailed instructions. Otherwise, please ask support for more info on this.
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
a
It's the same as in the documentation, the only difference is that I create an assistant with knowledge id instead of patching it.
The following is the discrepancy between the assistants created with knowledge id and an assistant that got file assigned in the dashboard. Response is from Network tab: - with knowledge id: > has
knowledgeBaseId
field in the
model
object. - with file assigned in the dashboard > has
knowledgeBase
field with fileIds, provider canonical and topK properties in the
model
object.
c
That is how it is supposed to be. A file is not a KB. Besides that did you test at all?
a
Yup! After I got through the steps, I have successfully uploaded the file, created KB with a file and an assistant with KB's id. Nonetheless, the assistant weren't able to retrieve the file its associated with.
c
What does your prompt say?
a
Simple prompt: "use the knowledge base as a content for conversation".
Ping
k
@armandas check out this video

https://youtu.be/sQIKNEwGJoE?si=PfT2ljB1SPgnwH5W

a
thanks! I'll test it out!
j
Hey did you end up figuring it out? Cause I did and I can help if need be
a
I checked what VAPI does with adding knowledge base files from their API calls that helped to solve the issue.
3 Views