-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #499 from jmartisk/readmes
Add READMEs to all samples
- Loading branch information
Showing
8 changed files
with
193 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Chatbot example with Easy RAG | ||
|
||
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`. | ||
|
||
## Running the example | ||
|
||
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 | ||
``` | ||
|
||
## Using the example | ||
|
||
|
||
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. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Chatbot example | ||
|
||
This example demonstrates how to create a simple chatbot with RAG using `quarkus-langchain4j`. | ||
|
||
## Running the example | ||
|
||
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 | ||
``` | ||
|
||
## Using the example | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# CLI Translator example | ||
|
||
This example demonstrates how to create a CLI-based translator application | ||
powered by an LLM. | ||
|
||
## Preparing to run the example | ||
|
||
A prerequisite to running this example is to provide your OpenAI API key. | ||
|
||
``` | ||
export QUARKUS_LANGCHAIN4J_OPENAI_API_KEY=<your-openai-api-key> | ||
``` | ||
|
||
## Using the example in interactive mode | ||
|
||
Compile the project and run it: | ||
|
||
``` | ||
mvn package | ||
java -jar target/quarkus-app/quarkus-run.jar | ||
``` | ||
|
||
Optionally, specify a target language for the translation using `-l`, this | ||
defaults to English. Then, simply write something in your language and | ||
always leave an empty line to get the translation. | ||
|
||
## Using the example in command mode | ||
|
||
You can also specify a file to translate by appending it as the program's argument, | ||
for example: | ||
|
||
``` | ||
mvn package | ||
java -jar target/quarkus-app/quarkus-run.jar examples/french.txt | ||
``` | ||
|
||
This also works with Dev mode: | ||
``` | ||
mvn quarkus:dev -Dquarkus.args="examples/french.txt" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# AI Service example with Tools that can write a poem and send it by email | ||
|
||
This example demonstrates how to create a chatbot with RAG using | ||
`quarkus-langchain4j`. This chatbot internally uses LLM-generated SQL | ||
queries to retrieve the relevant information from a PostgreSQL database. | ||
|
||
## Running the example | ||
|
||
A prerequisite to running this example is to provide your OpenAI API key. | ||
|
||
``` | ||
export QUARKUS_LANGCHAIN4J_OPENAI_API_KEY=<your-openai-api-key> | ||
``` | ||
|
||
To allow the application to send emails, start a mock SMTP server (replace | ||
Podman with your own container runtime): | ||
|
||
``` | ||
podman run -p 8025:8025 -p 1025:1025 docker.io/mailhog/mailhog | ||
``` | ||
|
||
Then, simply run the project in Dev mode: | ||
|
||
``` | ||
mvn quarkus:dev | ||
``` | ||
|
||
## Using the example | ||
|
||
Open the UI of the mock SMTP server at http://localhost:8025. This is where any | ||
emails sent by the robot will appear. | ||
|
||
To have the robot write a poem and send it to `[email protected]` (the | ||
actual address doesn't matter, for any address it will simply appear in the | ||
SMTP server's UI), execute: | ||
|
||
``` | ||
curl http://localhost:8080/email-me-a-poem | ||
``` | ||
|
||
If you don't have curl or a similar tool, simply opening the URL in your web | ||
browser will work too. After this is done, open the SMTP server's UI and you | ||
will see the email with a poem about Quarkus. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ quarkus.langchain4j.openai.timeout=60s | |
quarkus.langchain4j.openai.log-requests=true | ||
quarkus.langchain4j.openai.log-responses=true | ||
|
||
quarkus.mailer.from[email protected] | ||
quarkus.mailer.port=1025 | ||
quarkus.mailer.host=localhost | ||
%dev.quarkus.mailer.mock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Review triage example | ||
|
||
This example demonstrates how to a sentiment-analyzing AI service | ||
with `quarkus-langchain4j`. | ||
|
||
## Running the example | ||
|
||
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 | ||
``` | ||
|
||
## Using the example | ||
|
||
Open your browser and navigate to http://localhost:8080. The application | ||
acts as a bank's robot that accepts new reviews written by clients, analyzes | ||
their sentiment and thinks up an appropriate response to the client. Simply | ||
write something positive (`Your services are great.`) or negative (`You are | ||
thieves!`) into the form and click Submit. | ||
|