diff --git a/samples/chatbot-easy-rag/README.md b/samples/chatbot-easy-rag/README.md new file mode 100644 index 000000000..2c1438a14 --- /dev/null +++ b/samples/chatbot-easy-rag/README.md @@ -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= +``` + +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. \ No newline at end of file diff --git a/samples/chatbot-easy-rag/README.txt b/samples/chatbot-easy-rag/README.txt deleted file mode 100644 index d39e58840..000000000 --- a/samples/chatbot-easy-rag/README.txt +++ /dev/null @@ -1 +0,0 @@ -For instructions related to this sample, refer to docs/modules/ROOT/pages/easy-rag.adoc \ No newline at end of file diff --git a/samples/chatbot/README.md b/samples/chatbot/README.md new file mode 100644 index 000000000..118a5e6d8 --- /dev/null +++ b/samples/chatbot/README.md @@ -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= +``` + +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. \ No newline at end of file diff --git a/samples/cli-translator/README.md b/samples/cli-translator/README.md new file mode 100644 index 000000000..9c7ffe660 --- /dev/null +++ b/samples/cli-translator/README.md @@ -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= +``` + +## 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" +``` \ No newline at end of file diff --git a/samples/csv-chatbot/README.md b/samples/csv-chatbot/README.md index e2e4a1677..12efba748 100644 --- a/samples/csv-chatbot/README.md +++ b/samples/csv-chatbot/README.md @@ -2,9 +2,28 @@ ![Movie Muse](moviemuse.png) -Set your OpenAI API key into the `QUARKUS_LANGCHAIN4J_OPENAI_API_KEY` -environment variable. Then, run the example by executing `mvn quarkus:dev` -and open `localhost:8080` in your browser and start chatting. +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= +``` + +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 orange robot +in the bottom right corner to open the chat window. The chatbot uses a SQL database with information about movies with their basic metadata (the database is populated with data from @@ -13,4 +32,3 @@ LLM is used to generate SQL queries necessary for answering your question. Check the application's log, the SQL queries and the retrieved data will be printed there. - diff --git a/samples/email-a-poem/README.md b/samples/email-a-poem/README.md new file mode 100644 index 000000000..171221cf9 --- /dev/null +++ b/samples/email-a-poem/README.md @@ -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= +``` + +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 `sendMeALetter@quarkus.io` (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. + diff --git a/samples/email-a-poem/src/main/resources/application.properties b/samples/email-a-poem/src/main/resources/application.properties index 60825b7e7..728fbf267 100644 --- a/samples/email-a-poem/src/main/resources/application.properties +++ b/samples/email-a-poem/src/main/resources/application.properties @@ -2,3 +2,7 @@ quarkus.langchain4j.openai.timeout=60s quarkus.langchain4j.openai.log-requests=true quarkus.langchain4j.openai.log-responses=true +quarkus.mailer.from=acme@acme.org +quarkus.mailer.port=1025 +quarkus.mailer.host=localhost +%dev.quarkus.mailer.mock=false diff --git a/samples/review-triage/README.md b/samples/review-triage/README.md new file mode 100644 index 000000000..d4b1487b8 --- /dev/null +++ b/samples/review-triage/README.md @@ -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= +``` + +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. +