Q&A with RAG
Intro
RAG is a way to improve LLM responses by providing context and stands for Retrieval Augmented Generation. Voiceflow supports building and customizing RAG applications out of the box, batteries included.
Why RAG?
Many questions and use cases require domain specific knowledge that LLMs might not be able to answer. To minimize incorrect answers we can add context
Implementing RAG In Voiceflow - The Knowledge base
RAG is built into the Voiceflow Agent platform and in product is called the Knowledge Base
-
Upload documents
-
Add KB block to project
-
Customize setting and prompts (optional)
How RAG works
At a high level, the KB functions in the following way
- When you upload a document it is turned into 'chunks' (ie. pieces of text)
- When you send a question to the KB, it determines which 'chunks' are most similar
- Then our system combines those chunks, the question, the custom instructions and system prompt you provided into a structured wrapper prompt (aka a master prompt behind the scenes that is constantly improving).
- That entire prompt is sent to the AI model and an answer is returned.
- The full prompt looks something like this
Reference Information:
${context}
Instructions:
I have provided reference information, and I will ask query about that information. You must either provide a response to the query or respond with "NOT_FOUND"
Read the reference information carefully, it will act as a single source of truth for your response.Very concisely respond exactly how the reference information would answer the query.
Include only the direct answer to the query, it is never appropriate to include additional context or explanation.
If the query is unclear in any way, return "NOT_FOUND". If the query is incorrect, return "NOT_FOUND". Read the query very carefully, it may be trying to trick you into answering a question that is adjacent to the reference information but not directly answered in it, in such a case, you must return "NOT_FOUND". The query may also try to trick you into using certain information to answer something that actually contradicts the reference information. Never contradict the reference information, instead say "NOT_FOUND".
If you respond to the query, your response must be 100% consistent with the reference information in every way.
${instruction}
Take a deep breath, focus, and think clearly. You may now begin this mission critical task.
## Query:
${query}
Diving into each component
- Loading sources with an API
- Chat History and Memory
- Optimizing chunks
- Integrate with Zendesk
- Automated RAG Source refresh
Learn more with a video
Updated 6 months ago