unable to create assistant with knowledgebaseid
# support
a
Using the @vapi-ai/server-sdk, when creating an assistant it will not accept knowledgeBaseId.
Copy code
const response = await vapiClient.assistants.create({
...
        model: {
          provider: "openai",
          model: "gpt-4o-mini",
          temperature: 0.7,
          messages: [{ role: "system", content: instructions }],
          //knowledgeBaseId: "my-kb-id" ERROR HERE
          //knowledgeBase: {knowledgeBaseId: "my-kb-id"} ALSO ERROR HERE
        },
...
});
The specific error I get is:
Copy code
Object literal may only specify known properties, but 'knowledgeBaseId' does not exist in type 'OpenAiModel'. Did you mean to write 'knowledgeBase'?
I am able to create assistants fine without it. But I would like to create assistants with access to my knowledge base too. I already have a knowledge base setup that is working. The knowledge base id I use is correct. Am I missing something?
v
message has been deleted
@Arvo It seems like you're on the right track, but there might be a slight discrepancy in the property name or structure expected by the
vapiClient.assistants.create
method. According to the error message, the
OpenAiModel
type does not recognize
knowledgeBaseId
as a valid property. Instead, it suggests that you might want to use
knowledgeBase
. Since the error message suggests using
knowledgeBase
, you should try passing the
knowledgeBaseId
within a
knowledgeBase
object. Here's how you can modify your code:
Copy code
javascript
const response = await vapiClient.assistants.create({
  ...
  model: {
    provider: "openai",
    model: "gpt-4o-mini",
    temperature: 0.7,
    messages: [{ role: "system", content: instructions }],
    knowledgeBase: { id: "my-kb-id" } // Adjusted property structure
  },
  ...
});
Make sure that the
knowledgeBase
object contains an
id
property with the value of your knowledge base ID. If this structure does not work, please refer to the SDK documentation or ask support for more info on this.
You can continue this conversation by mentioning me in the message.
a
Using knowledgeBase: { id: "my-kb-id" } as suggested does not work, the same problem remains. Additionally, if I try something like this:
Copy code
const openAiModel: OpenAIModel = {
        provider: "openai",
        model: "gpt-4o",
        temperature: 0.7,
        messages: [{ role: "system", content: instructions }],
        knowledgeBaseId: "my-kb-id"
      }
It does not work either. Looking at the github for typescript sdk shows this should be possible. Not sure why it doesn't recognize knowledgeBaseId
The "Ask for help" button interaction is failing, so pinging directly @Vapi
v
@Arvo I apologize for the inconvenience you're experiencing. It seems there might be a version mismatch or an issue with the SDK you are using. If the TypeScript definitions in the SDK indicate that
knowledgeBaseId
should be a valid property, but you're still encountering errors, here are a few steps you can take: 1. **Check SDK Version**: Ensure that you are using the latest version of the
@vapi-ai/server-sdk
. If not, consider updating to the latest version where the
knowledgeBaseId
might be supported. 2. **Review Documentation**: Double-check the official SDK documentation for any updates or changes in the way the
knowledgeBaseId
should be specified. 3. **TypeScript Definitions**: Look into the
node_modules/@vapi-ai/server-sdk
directory, specifically the TypeScript definition files (
.d.ts
), to confirm that
knowledgeBaseId
is indeed a valid property within the
OpenAIModel
interface. 4. **Contact Support**: Since the "Ask for help" button interaction is failing, you might want to reach out to the support team directly through their provided contact methods (e.g., email, support ticket system). 5. **GitHub Issues**: If you believe this to be a bug or an issue with the SDK, consider opening an issue on the GitHub repository where the SDK is maintained. Provide detailed information about the problem, including the version of the SDK you're using and the exact error message. In the meantime, if you have any other questions or need further assistance with a different aspect of the VAPI, feel free to ask.
a
Okay, I can confirm that I was on an older version, which is weird because I just added it very recently. Thank you
a
I have the same problem. Did you figured it out?
knowledgeBaseId works for inbound but not outbound.
Whenever I add knowledgeBaseId in outbound, the assistant call, but doesn't say anything.
s
@Aurora create a #1211483291191083018 ticket according to Post Guidelines.