AI Workflows

Build a RAG Knowledge Assistant

Connect documents with embeddings to build an intelligent search assistant.

Learn how to build a Retrieval-Augmented Generation (RAG) assistant that answers questions using your own documents. In this guide, you'll index content with embeddings, perform semantic search, and generate accurate, context-aware responses.

Overview

A RAG (Retrieval-Augmented Generation) application combines a language model with a knowledge base. Instead of relying only on the model's training data, relevant documents are retrieved first and then provided as context for generating an answer.

This approach improves accuracy and enables AI applications to answer questions using your own data.

Estimated time: 20–30 minutes

Prerequisites

Before starting, ensure you have:

  • A NovaAI project

  • API authentication configured

  • Documents to index

  • Access to the Embeddings and Vector Store APIs

Tip: RAG works best with clean, well-structured documents rather than large unprocessed files.

Tip: RAG works best with clean, well-structured documents rather than large unprocessed files.

RAG Architecture

Rendering diagram…
1

Upload Your Documents

Start by uploading the documents you want your assistant to search.

1

Upload Your Documents

Start by uploading the documents you want your assistant to search.

Supported examples include:

  • Product documentation

  • Knowledge bases

  • User manuals

  • Internal company documents

  • FAQs

2

Generate Embeddings

Convert your documents into vector embeddings.

const embedding = await client.embeddings.create({
model: "nova-embed-1",
input: documentText
});

Each document is transformed into a numerical representation that enables semantic search.

2

Generate Embeddings

Convert your documents into vector embeddings.

const embedding = await client.embeddings.create({
model: "nova-embed-1",
input: documentText
});

Each document is transformed into a numerical representation that enables semantic search.

3

Store the Embeddings

Save the generated vectors in your Vector Store.

Knowledge Base
├── Product Docs
├── API Reference
├── FAQs
├── Tutorials
└── Release Notes

Organizing documents into logical collections makes retrieval more efficient.

3

Store the Embeddings

Save the generated vectors in your Vector Store.

Knowledge Base
├── Product Docs
├── API Reference
├── FAQs
├── Tutorials
└── Release Notes

Organizing documents into logical collections makes retrieval more efficient.

4

Search for Relevant Content

When a user asks a question, convert the query into an embedding and search for the most relevant documents.

const results = await client.vectorStore.search({
query: userQuestion,
top_k: 5
});

The search returns the documents most closely related to the user's question.

4

Search for Relevant Content

When a user asks a question, convert the query into an embedding and search for the most relevant documents.

const results = await client.vectorStore.search({
query: userQuestion,
top_k: 5
});

The search returns the documents most closely related to the user's question.

5

Generate the Answer

Pass the retrieved documents to the chat model as context.

const response = await client.chat.create({
model: "nova-chat-4",
messages: [
{
role: "system",
content: "Answer only using the provided documentation."
},
{
role: "user",
content: userQuestion
}
]
});

The model combines the retrieved information with the user's question to generate a relevant response.

5

Generate the Answer

Pass the retrieved documents to the chat model as context.

const response = await client.chat.create({
model: "nova-chat-4",
messages: [
{
role: "system",
content: "Answer only using the provided documentation."
},
{
role: "user",
content: userQuestion
}
]
});

The model combines the retrieved information with the user's question to generate a relevant response.

Best Practices

Recommendation

Benefit

Split large documents into smaller chunks

Improves retrieval accuracy.

Update embeddings when content changes

Keeps results current.

Retrieve only the most relevant documents

Reduces token usage.

Include source references

Makes answers easier to verify.

Note: RAG does not retrain the model. Instead, it provides relevant information at request time, allowing responses to stay up to date without fine-tuning.

Note: RAG does not retrain the model. Instead, it provides relevant information at request time, allowing responses to stay up to date without fine-tuning.

Completed

Congratulations!

You've built a Retrieval-Augmented Generation assistant capable of answering questions using your own knowledge base.

Was this helpful?

Was this helpful?

Create a free website with Framer, the website builder loved by startups, designers and agencies.