Custom LLM and Knowledge Base
# support
l
I am looking for VAPI to use my custom LLM tied to my knowledge base so that the questions are answered based on my knowledge base. For this, I need VAPI to provide the transcripts to my web Method that interacts with my vector store. Has anyone does this before? I cannot see any docs that explain how this could be done, is this possible?
v
Hi @LearningAI, I'm an AI assistant for Vapi. While a team member reviews this question, I'll look through relevant sources and see if I can provide suggestions.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Frequently Asked Questions]() * [Introduction]() * [Custom LLMs]() * [Create Assistant]() -----------------------------
### Answer Yes, it's possible to integrate your custom LLM and knowledge base with Vapi. You can utilize Vapi's support for Custom LLMs, allowing you to use any OpenAI-compatible endpoint, including your own server. Here’s how you can set it up: 1. Using an LLM Provider: If your custom LLM is hosted with an LLM provider compatible with OpenAI's API, you can POST your API key via the
/credential
endpoint and specify your custom model in your API requests [(1)]() . 2. Using Your Server: For LLMs hosted on your server, you can create an endpoint compatible with the OpenAI Client. Your server can then interact with your knowledge base and vector store as needed. To implement this, post your server’s API key and URL via the
/credential
endpoint and specify these in your assistant creation with the
custom-llm
model provider. This setup allows Vapi to provide transcripts to your specified endpoint, which can then utilize your knowledge base for responses. For more detailed instructions on setting up your custom LLM with Vapi, refer to the Custom LLMs documentation.
s
I've attached the pinecone as my vector database and deployed it on Vercel, achieving a lightning-fast response time of 1.2 seconds. However, I haven't tested the vector database with a custom LLM yet. I'm willing to give it a try. Could you please share the specific issue you're facing?
l
@Sahil - thanks that is impressive timing - would be good to know how you went about connecting your vector db to VAPI.
s
Check out this video

https://www.youtube.com/watch?v=9MD1VM7038Q

to learn how it works. If you have coding knowledge, I recommend using a personal server along with a reliable pinecode db plan. This combination will significantly reduce latency.
a
any chance you could share your js (?) code you deployed to Vercel in order to achieve this? I'm assuming that code on Vercel implements something similar as shown on the screenshot, right?
s
Sorry. I can't cause I have written that code for some other client. But, I guide you!
a
appreciated but giving it a miss then for now, as that repo doesn't contain any Vector Store connection code, nor any OpenAI Embeddings code. I'll stick with my n8n solution above for now even though it might be slightly slower than a Vercel implementation...
s
You can use pipedream higher version subscription and you can stop the cold-start feature which will significantly increase your performance.
a
I'm not using Pipedream but a self-hosted n8n.io installation on a well equipped VPS so there's no cold starting issue at all 😉
s
Awesome. ✨ If you need any help feel free to ping me
a
s
This project seems interesting will take a look at it.
a
it defo is 🙂 👍