ai-lc4j-demos/demo-05/README.md

24 lines
No EOL
1.3 KiB
Markdown

Demo 05 - RAG Part 1
===============================================
Retrieval Augmented Generation (RAG) is a way to extend the knowledge of the LLM used in the AI service.
The RAG pattern is composed of two parts:
* Ingestion: This is the part that stores data in the knowledge base.
* Augmentation: This is the part that adds the retrieved information to the input of the LLM.
# Configuring EasyRag
To configure EasyRag: In the src/main/resources/application.properties file, we have the following configuration:
```
quarkus.langchain4j.easy-rag.path=src/main/resources/rag
quarkus.langchain4j.easy-rag.max-segment-size=100
quarkus.langchain4j.easy-rag.max-overlap-size=25
quarkus.langchain4j.easy-rag.max-results=3
```
* `quarkus.langchain4j.easy-rag.path`: The path to the directory containing the data files.
* `quarkus.langchain4j.easy-rag.max-segment-size`: The maximum number of tokens in a segment. Each document is
split into segments (chunks) to be ingested by the LLM. This parameter defines the maximum number of tokens in a segment.
* `quarkus.langchain4j.easy-rag.max-overlap-size`: The maximum number of tokens to overlap between two segments.
That allows the LLM to have a context between two segments.
* `quarkus.langchain4j.easy-rag.max-results`: The maximum number of results to return when querying the knowledge base.