Skip to content

Commit 7faf369

Browse files
author
Baransel SAGINDA
committed
small fixes and rewrited last chapter
1 parent 504fa33 commit 7faf369

File tree

1 file changed

+52
-41
lines changed
  • content/guides/genai-leveraging-rag

1 file changed

+52
-41
lines changed

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

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ To illustrate the power of RAG systems in practice, let's examine a real-world i
5959
Apache NiFi serves as an excellent example of the limitations of traditional LLMs and how RAG can overcome them. As a relatively recent technology, many LLMs have limited or outdated knowledge about it, making it a perfect candidate for demonstrating RAG's capabilities.
6060

6161
Without RAG, the LLM may provide broad responses or acknowledge its limited knowledge when asked about information that is beyond its cutoff date. The following example demonstrates this.
62-
63-
Question: What important events happened in 2024?
64-
RAG: Disabled
65-
66-
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?
62+
```
63+
Question: What important events happened in 2024?
64+
RAG: Disabled
65+
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?
66+
```
6767

6868
## Setting up GenAI stack with GPU acceleration on Linux
6969

@@ -133,12 +133,11 @@ Since our goal is to teach AI about things it does not yet know, we begin by ask
133133
[http://localhost:8501/](http://localhost:8501/).
134134
![alt text](image.png)
135135

136-
137-
Question: What is Apache Nifi?
138-
RAG: Disabled
139-
140-
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.
141-
136+
```
137+
Question: What is Apache Nifi?
138+
RAG: Disabled
139+
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.
140+
```
142141

143142
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.
144143

@@ -185,52 +184,64 @@ Now, we are ready to enable our LLM to use this information. Go back to [http://
185184
![alt text](image-3.png)
186185

187186
The system delivers comprehensive, accurate information by pulling from current technical documentation.
187+
```
188+
Question: What is Apache Nifi?
189+
RAG: Enabled
190+
191+
Answer:
192+
Apache NiFi is an open-source, distributed data processing system that allows you to collect, transform, and transport data across various sources and sinks. It provides a graphical user interface for designing and managing data flows, as well as a set of APIs for integrating with other systems.
193+
According to this Stack Overflow question, the free Neo4J JDBC driver doesn't understand SQL, only Cypher, so you would need to use a non-free BI Connector to connect to Neo4j from Apache Drill.
194+
Additionally, this Stack Overflow question suggests that Apache POI does work in a Neo4j User Defined Function. However, there may be an unknown glitch in the standalone UDF mentioned in the initial question.
195+
To export data from Neo4j to Excel using APOC Extended procedures, you can use apoc.export.xls.query which takes a Cypher query and exports the results to an Excel file.
196+
197+
References:
198+
How to connect and query Neo4j Database on Apache Drill?
199+
Is a Neo4j UDF compatible with Apache POI?
200+
```
201+
202+
Keep in mind that new questions will be added to Stack Overflow, and due to the inherent randomness in most AI models, the answers may vary and won't be identical to those in this example.
188203

189-
Question: What is Apache Nifi?
190-
RAG: Enabled
204+
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:
191205

192-
Answer:
193206

194-
Apache NiFi is an open-source, distributed data processing system that allows you to collect, transform, and transport data across various sources and sinks. It provides a graphical user interface for designing and managing data flows, as well as a set of APIs for integrating with other systems.
207+
```cypher
208+
MATCH (n)
209+
DETACH DELETE n;
210+
```
195211

196-
According to this Stack Overflow question, the free Neo4J JDBC driver doesn't understand SQL, only Cypher, so you would need to use a non-free BI Connector to connect to Neo4j from Apache Drill.
212+
For optimal results, choose a tag that the LLM is not familiar with.
197213

198-
Additionally, this Stack Overflow question suggests that Apache POI does work in a Neo4j User Defined Function. However, there may be an unknown glitch in the standalone UDF mentioned in the initial question.
199214

200-
To export data from Neo4j to Excel using APOC Extended procedures, you can use apoc.export.xls.query which takes a Cypher query and exports the results to an Excel file.
215+
### When to leverage RAG for optimal results
201216

202-
References:
217+
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.
203218

204-
How to connect and query Neo4j Database on Apache Drill?
205-
Is a Neo4j UDF compatible with Apache POI?
219+
1. Overcoming Knowledge Limitations
206220

207-
Keep in mind that new questions will be added to Stack Overflow, and due to the inherent randomness in most AI models, the answers may vary and won't be identical to those in this example.
221+
LLMs are trained on a fixed dataset up until a certain point in time. This means they lack access to:
208222

209-
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:
223+
* Real-time information: LLMs do not continuously update their knowledge, so they may not be aware of recent events, newly released research, or emerging technologies.
224+
* Specialized knowledge: Many niche subjects, proprietary frameworks, or industry-specific best practices may not be well-documented in the model’s training corpus.
225+
* Accurate contextual understanding: LLMs can struggle with nuances or evolving terminologies that frequently change within dynamic fields like finance, cybersecurity, or medical research.
210226

227+
By incorporating RAG with a graph database such as Neo4j, AI models can access and retrieve the latest, relevant, and highly connected data before generating a response. This ensures that answers are up-to-date and grounded in factual information rather than inferred approximations.
211228

212-
```cypher
213-
MATCH (n)
214-
DETACH DELETE n;
215-
```
229+
2. Addressing Business and Compliance Needs
216230

217-
For optimal results, choose a tag that the LLM is not familiar with.
231+
Organizations in industries like healthcare, legal services, and financial analysis require their AI-driven solutions to be:
218232

233+
* Accurate: Businesses need AI-generated content that is factual and relevant to their specific domain.
234+
* Compliant: Many industries must adhere to strict regulations regarding data usage and security.
235+
* Traceable: Enterprises often require AI responses to be auditable, meaning they need to reference source material.
219236

220-
### When RAG is Effective
237+
By using RAG, AI-generated answers can be sourced from trusted databases, ensuring higher accuracy and compliance with industry standards. This mitigates risks such as misinformation or regulatory violations.
221238

222-
1. Knowledge Limitations:
223-
- LLMs have fixed knowledge cutoffs
224-
- Cannot access real-time or specialized information
225-
- May hallucinate or provide outdated information
239+
3. Enhancing Cost Efficiency and Performance
226240

227-
2. Business Requirements:
228-
- Need for accurate, up-to-date information
229-
- Compliance and auditability
230-
- Domain-specific knowledge integration
241+
Training and fine-tuning large AI models can be computationally expensive and time-consuming. However, integrating RAG provides:
231242

232-
3. Cost Efficiency:
233-
- Reduced need for model fine-tuning
234-
- Smaller models can perform well with good context
235-
- Lower computational requirements
243+
* Reduced fine-tuning needs: Instead of retraining an AI model every time new data emerges, RAG allows the model to fetch and incorporate updated information dynamically.
244+
* Better performance with smaller models: With the right retrieval techniques, even compact AI models can perform well by leveraging external knowledge efficiently.
245+
* Lower operational costs: Instead of investing in expensive infrastructure to support large-scale retraining, businesses can optimize resources by utilizing RAG’s real-time retrieval capabilities.
236246

247+
By following this guide, you now have the foundational knowledge to implement RAG with Neo4j, enabling your AI system to deliver more accurate, relevant, and insightful responses. The next step is experimentation—choose a dataset, configure your stack, and start enhancing your AI with the power of retrieval-augmented generation.

0 commit comments

Comments
 (0)