Adding Knowledge (RAG)
Give you agent access to product documents, KBs, and more.
LLMs have tremendous knowledge about the world, but they don’t have all the up-to-date specifics about your organization, your products, or other relevant information you might want to provide to your AI voice agents.
RAG is a common technique for grounding agents in the relevant information for your use case.
Examples of Knowledge Sources
Let’s consider some of the content that might be useful to serve some popular use cases:
Adding RAG to Ultravox
As we saw in the Using Tools guide, tools provide power-ups for your agents. To use RAG with an Ultravox agent, it’s as simple as creating a tool and instructing the agent on how to use the tool.
The Easy Way
Ultravox provides the corpus service for RAG.
Create a Corpus
Use the Create Corpus endpoint. Give your new corpus a name and (optional) description. This returns a corpusId
.
Create a Source
Add a website to crawl using Create Corpus Source. Each source is given a unique sourceId
. We will crawl the URL(s) and ingest all the content.
Query the Corpus
After everything is loaded, try some queries using the Query Corpus endpoint.
Use the queryCorpus Tool
Give the built-in queryCorpus tool. to your agents and provide the corpusId
. For example, if we wanted to create a voice agent to answer questions about Seattle, we could provide the tool like this:
The Other Way
Let’s assume we have already stored our product documentation in a vector database and can search that content at https://foo.bar/lookupProductInfo
.
Here’s how we might create a tool for our Ultravox agent to use: