Skip to content

Commit a4d2113

Browse files
fix: highlighting in code blocks (#22836)
## Description - Highlighted lines for code blocks in dark mode are not rendering correctly ## Related issues or tickets https://docker.atlassian.net/browse/ENGDOCS-2731 ## Reviews - [ ] Technical review - [ ] Editorial review - [ ] Product review
1 parent ae2a14a commit a4d2113

File tree

3 files changed

+32
-34
lines changed

3 files changed

+32
-34
lines changed

assets/css/syntax-dark.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/* LineHighlight */
1515
.hl {
1616
min-width: fit-content;
17-
background-color: var(--color-gray-800);
17+
background-color: var(--color-gray-700);
1818
}
1919
.lntd:first-child .hl,
2020
& > .chroma > code > .hl {

content/guides/genai-leveraging-rag/index.md

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ params:
1010
time: 35 minutes
1111
---
1212

13-
14-
1513
## Introduction
1614

1715
Retrieval-Augmented Generation (RAG) is a powerful framework that enhances large language models (LLMs) by integrating information retrieval from external knowledge sources. This guide focuses on a specialized RAG implementation using graph databases like Neo4j, which excel in managing highly connected, relational data. Unlike traditional RAG setups with vector databases, combining RAG with graph databases offers better context-awareness and relationship-driven insights.
@@ -22,25 +20,24 @@ In this guide, you will:
2220
* Configure a GenAI stack with Docker, incorporating Neo4j and an AI model.
2321
* Analyze a real-world case study that highlights the effectiveness of this approach for handling specialized queries.
2422

25-
## Understanding RAG
23+
## Understanding RAG
2624

27-
RAG is a hybrid framework that enhances the capabilities of large language models by integrating information retrieval. It combines three core components:
25+
RAG is a hybrid framework that enhances the capabilities of large language models by integrating information retrieval. It combines three core components:
2826

29-
- **Information retrieval** from an external knowledge base
30-
- **Large Language Model (LLM)** for generating responses
31-
- **Vector embeddings** to enable semantic search
27+
- **Information retrieval** from an external knowledge base
28+
- **Large Language Model (LLM)** for generating responses
29+
- **Vector embeddings** to enable semantic search
3230

3331
In a RAG system, vector embeddings are used to represent the semantic meaning of text in a way that a machine can understand and process. For instance, the words "dog" and "puppy" will have similar embeddings because they share similar meanings. By integrating these embeddings into the RAG framework, the system can combine the generative power of large language models with the ability to pull in highly relevant, contextually-aware data from external sources.
3432

35-
The system operates as follows:
36-
1. Questions get turned into mathematical patterns that capture their meaning
33+
The system operates as follows:
34+
1. Questions get turned into mathematical patterns that capture their meaning
3735
2. These patterns help find matching information in a database
38-
3. The found information gets added to the original question before passed to LLM
39-
4. The LLM generates responses that blend the model's inherent knowledge with the this extra information.
36+
3. The LLM generates responses that blend the model's inherent knowledge with the this extra information.
4037

4138
To hold this vector information in an efficient manner, we need a special type of database.
4239

43-
## Introduction to Graph databases
40+
## Introduction to Graph databases
4441

4542
Graph databases, such as Neo4j, are specifically designed for managing highly connected data. Unlike traditional relational databases, graph databases prioritize both the entities and the relationships between them, making them ideal for tasks where connections are as important as the data itself.
4643

@@ -65,7 +62,7 @@ RAG: Disabled
6562
I'm happy to help! Unfortunately, I'm a large language model, I don't have access to real-time information or events that occurred after my training data cutoff in 2024. Therefore, I cannot provide you with any important events that happened in 2024. My apologize for any inconvenience this may cause. Is there anything else I can help you with?
6663
```
6764

68-
## Setting up GenAI stack with GPU acceleration on Linux
65+
## Setting up GenAI stack with GPU acceleration on Linux
6966

7067
To set up and run the GenAI stack on a Linux host, execute one of the following commands, either for GPU or CPU powered:
7168

@@ -79,10 +76,12 @@ nano .env
7976
```
8077
In the `.env` file, make sure following lines are commented out. Set your own credentials for security
8178

79+
```txt
8280
NEO4J_URI=neo4j://database:7687
8381
NEO4J_USERNAME=neo4j
8482
NEO4J_PASSWORD=password
8583
OLLAMA_BASE_URL=http://llm-gpu:11434
84+
```
8685

8786
### CPU powered
8887

@@ -94,15 +93,16 @@ nano .env
9493
```
9594
In the `.env` file, make sure following lines are commented out. Set your own credentials for security
9695

96+
```txt
9797
NEO4J_URI=neo4j://database:7687
9898
NEO4J_USERNAME=neo4j
9999
NEO4J_PASSWORD=password
100100
OLLAMA_BASE_URL=http://llm:11434
101+
```
101102

102-
### Setting up on other platforms
103-
104-
For instructions on how to set up the stack on other platforms, refer to [this page](https://github.com/docker/genai-stack).
103+
### Setting up on other platforms
105104

105+
For instructions on how to set up the stack on other platforms, refer to [this page](https://github.com/docker/genai-stack).
106106

107107
### Initial startup
108108

@@ -118,42 +118,41 @@ docker compose logs
118118

119119
Wait for specific lines in the logs indicating that the download is complete and the stack is ready. These lines typically confirm successful setup and initialization.
120120

121+
```text
121122
pull-model-1 exited with code 0
122123
database-1 | 2024-12-29 09:35:53.269+0000 INFO Started.
123124
pdf_bot-1 | You can now view your Streamlit app in your browser.
124125
loader-1 | You can now view your Streamlit app in your browser.
125126
bot-1 | You can now view your Streamlit app in your browser.
127+
```
126128

127-
128-
You can now access the interface at [http://localhost:8501/](http://localhost:8501/) to ask questions. For example, you can try the sample question:
129+
You can now access the interface at [http://localhost:8501/](http://localhost:8501/) to ask questions. For example, you can try the sample question:
129130

130131
When we see those lines in the logs, web apps are ready to be used.
131132

132-
Since our goal is to teach AI about things it does not yet know, we begin by asking it a simple question about Nifi at
133+
Since our goal is to teach AI about things it does not yet know, we begin by asking it a simple question about Nifi at
133134
[http://localhost:8501/](http://localhost:8501/).
134135
![alt text](image.png)
135136

136137
```text
137-
Question: What is Apache Nifi?
138+
Question: What is Apache Nifi?
138139
RAG: Disabled
139140
Hello! I'm here to help you with your question about Apache NiFi. Unfortunately, I don't know the answer to that question. I'm just an AI and my knowledge cutoff is December 2022, so I may not be familiar with the latest technologies or software. Can you please provide more context or details about Apache NiFi? Maybe there's something I can help you with related to it.
140141
```
141142

142143
As we can see, AI does not know anything about this subject because it did not exist during the time of its training, also known as the information cutoff point.
143144

144-
Now it's time to teach the AI some new tricks. First, connect to [http://localhost:8502/](http://localhost:8502/). Instead of using the "neo4j" tag, change it to the "apache-nifi" tag, then select the **Import** button.
145-
145+
Now it's time to teach the AI some new tricks. First, connect to [http://localhost:8502/](http://localhost:8502/). Instead of using the "neo4j" tag, change it to the "apache-nifi" tag, then select the **Import** button.
146146

147147
![alt text](image-1.png)
148148

149-
150-
After the import is successful, we can access Neo4j to verify the data.
149+
After the import is successful, we can access Neo4j to verify the data.
151150

152151
After logging in to [http://localhost:7474/](http://localhost:7474/) using the credentials from the `.env` file, you can run queries on Neo4j. Using the Neo4j Cypher query language, you can check for the data stored in the database.
153152

154153
To count the data, run the following query:
155154

156-
```cypher
155+
```text
157156
MATCH (n)
158157
RETURN DISTINCT labels(n) AS NodeTypes, count(*) AS Count
159158
ORDER BY Count DESC;
@@ -167,25 +166,23 @@ Results will appear below. What we are seeing here is the information system dow
167166

168167
You can also run the following query to visualize the data:
169168

170-
```cypher
169+
```text
171170
CALL db.schema.visualization()
172171
```
173172

174173
To check the relationships in the database, run the following query:
175174

176-
```cypher
175+
```text
177176
CALL db.relationshipTypes()
178177
```
179178

180-
181-
182179
Now, we are ready to enable our LLM to use this information. Go back to [http://localhost:8501/](http://localhost:8501/), enable the **RAG** checkbox, and ask the same question again. The LLM will now provide a more detailed answer.
183180

184181
![alt text](image-3.png)
185182

186183
The system delivers comprehensive, accurate information by pulling from current technical documentation.
187184
```text
188-
Question: What is Apache Nifi?
185+
Question: What is Apache Nifi?
189186
RAG: Enabled
190187
191188
Answer:
@@ -203,15 +200,13 @@ Keep in mind that new questions will be added to Stack Overflow, and due to the
203200

204201
Feel free to start over with another [Stack Overflow tag](https://stackoverflow.com/tags). To drop all data in Neo4j, you can use the following command in the Neo4j Web UI:
205202

206-
207-
```cypher
203+
```txt
208204
MATCH (n)
209205
DETACH DELETE n;
210206
```
211207

212208
For optimal results, choose a tag that the LLM is not familiar with.
213209

214-
215210
### When to leverage RAG for optimal results
216211

217212
Retrieval-Augmented Generation (RAG) is particularly effective in scenarios where standard Large Language Models (LLMs) fall short. The three key areas where RAG excels are knowledge limitations, business requirements, and cost efficiency. Below, we explore these aspects in more detail.

hugo_stats.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
"Docker-subscription",
4444
"Download",
4545
"Entra-ID",
46+
"Entra-ID-OIDC",
4647
"Entra-ID-SAML-2.0",
48+
"Entra-ID/Azure-AD-OIDC-and-SAML-2.0",
49+
"Entra-ID/Azure-AD-SAML-2.0-and-OIDC",
4750
"External-cloud-storage",
4851
"Fedora",
4952
"For-Mac-with-Apple-silicon",

0 commit comments

Comments
 (0)