Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 761af3d

Browse files
spellcheck
1 parent 449c6c2 commit 761af3d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/guides/python/llama-rag.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ updated_at: 2024-11-16
1111

1212
# Using Retrieval Augmented Generation to enhance your LLMs
1313

14-
This guide shows how to use Retrieval Augmented Generation (RAG) to enhance a large language model (LLM). RAG is the process of enabling an LLM to reference context outside of its intial training data before generating its response. It can be extremely expensive in both time and computing power to train a model that is useful for your own domain-specific purposes. Therefore, using RAG is a cost-effective alternative to extending the capabilities of an existing LLM.
14+
This guide shows how to use Retrieval Augmented Generation (RAG) to enhance a large language model (LLM). RAG is the process of enabling an LLM to reference context outside of its initial training data before generating its response. It can be extremely expensive in both time and computing power to train a model that is useful for your own domain-specific purposes. Therefore, using RAG is a cost-effective alternative to extending the capabilities of an existing LLM.
1515

1616
## Prerequisites
1717

@@ -64,7 +64,7 @@ We'll organize our project structure like so:
6464

6565
## Setting up our LLM
6666

67-
Before we even start writing code for our LLM we'll want to download the model into our project. For this project we'll be using Llama 3.2 with a Q4_K_M quant.
67+
Before we even start writing code for our LLM we'll want to download the model into our project. For this project we'll be using Llama 3.2 with the Q4_K_M quantization.
6868

6969
```bash
7070
mkdir model
@@ -73,7 +73,7 @@ curl -OL https://huggingface.co/bartowski/Llama-3.2-1B-Instruct-GGUF/resolve/mai
7373
cd ..
7474
```
7575

76-
Now that we have our model we can load it into our code. We'll also define our [embed model](https://docs.llamaindex.ai/en/stable/module_guides/models/embeddings/) - for vectorising our documentation - using a recommend [embed model](https://huggingface.co/BAAI/bge-large-en-v1.5) from Hugging Face. At this point we can also create a prompt template for prompts with our query engine. It will just sanitise some of the hallucinations so that if the model does not know an answer it won't pretend like it does.
76+
Now that we have our model we can load it into our code. We'll also define our [embed model](https://docs.llamaindex.ai/en/stable/module_guides/models/embeddings/) using a recommend [model](https://huggingface.co/BAAI/bge-large-en-v1.5) from Hugging Face. At this point we can also create a prompt template for prompts with our query engine. It will just sanitize some of the hallucinations so that if the model does not know an answer it won't pretend like it does.
7777

7878
```python title:common/model_paramters.py
7979
from llama_index.core import ChatPromptTemplate
@@ -117,7 +117,7 @@ text_qa_template = ChatPromptTemplate.from_messages([
117117

118118
## Building a Query Engine
119119

120-
The next step is where we embed our context into the LLM. For this example we can embed the Nitric documentation to allow searchability using the LLM. It's open-source on [GitHub](https://github.com/nitrictech/docs), so we can clone it into our project.
120+
The next step is where we embed our context into the LLM. For this example we will embed the Nitric documentation. It's open-source on [GitHub](https://github.com/nitrictech/docs), so we can clone it into our project.
121121

122122
```bash
123123
git clone https://github.com/nitrictech/docs.git nitric-docs

0 commit comments

Comments
 (0)