This example demonstrates how to create a simple chatbot with RAG using
quarkus-langchain4j
and specifically the Easy RAG extension.
For more information about Easy RAG, refer to the file
docs/modules/ROOT/pages/easy-rag.adoc
.
A prerequisite to running this example is to provide your OpenAI API key.
export QUARKUS_LANGCHAIN4J_OPENAI_API_KEY=<your-openai-api-key>
Then, simply run the project in Dev mode:
mvn quarkus:dev
Open your browser and navigate to http://localhost:8080. Click the red robot in the bottom right corner to open the chat window.
The chatbot is a conversational agent that uses information from the files
in src/main/resources/catalog
to answer your questions about banking
products. More information about how it works is shown on the webpage.
Add quarkus.langchain4j.openai.base-url=http://yourerver
to application.properties
.
In this case, quarkus.langchain4j.openai.api-key
is generally not needed.
Replace:
<dependency>
<groupId>io.quarkiverse.langchain4j</groupId>
<artifactId>quarkus-langchain4j-openai</artifactId>
<version>${quarkus-langchain4j.version}</version>
</dependency>
with
<dependency>
<groupId>io.quarkiverse.langchain4j</groupId>
<artifactId>quarkus-langchain4j-ollama</artifactId>
<version>${quarkus-langchain4j.version}</version>
</dependency>