Skip to content

Add Examples for Helidon Integration #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions helidon-examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see https://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Gradle
.gradle/
build/

# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
66 changes: 66 additions & 0 deletions helidon-examples/coffee-shop-assistant-mp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# **Coffee Shop Assistant (Helidon MP Version)**

This is a **demo application** showcasing the **Helidon integration with LangChain4J**. It demonstrates how to build an **AI-powered coffee shop assistant** using **Helidon Inject**, OpenAI models, and embedding storage.

NOTE: LangChain4J integration is a preview feature. The APIs shown here are subject to change. These APIs will be finalized in a future release of Helidon.

## **Features**

- Integration with **OpenAI chat models**.
- Utilization of **embedding models**, **embedding store**, **ingestor**, and **content retriever**.
- **Helidon Inject** for dependency injection.
- **Embedding store initialization** from a JSON file.
- Support for **callback functions** to enhance interactions.

## **Build the Application**

To build the application, run:

```shell
mvn clean package
```

## **Run the Application**

Execute the following command to start the application:

```shell
java -jar target/helidon-examples-langchain4j-coffee-shop-assistant-mp.jar
```

Once running, you can interact with the assistant via your browser.

Example:

```
http://localhost:8080/chat?question="What can you offer today?"
```

## Sample Questions and Expected Responses

Here are some example queries you can try:

### Menu and Recommendations

- **"What hot drinks do you have?"**
- *Expected Response:* A list of **hot drinks** such as **Latte, Cappuccino, Espresso, and Hot Chocolate**.

- **"I'm looking for something sweet. What do you recommend?"**
- *Expected Response:* Suggestions like **Caramel Frappuccino, Blueberry Muffin, Chocolate Chip Cookie, and Hot Chocolate**.

- **"What drinks can I get with caramel?"**
- *Expected Response:* Options like **Caramel Frappuccino** and **Latte with caramel syrup add-on**.

### Dietary Preferences

- **"Do you have any vegan options?"**
- *Expected Response:* Items like **Avocado Toast, Iced Matcha Latte (with non-dairy milk), and Blueberry Muffin (if applicable)**.

### Orders and Availability

- **"Do you have any breakfast items?"**
- *Expected Response:* Options such as **Avocado Toast, Blueberry Muffin, and Bagel with Cream Cheese**.

- **"Can I order a latte and a cookie?"**
- *Expected Response:*
*"Your order for a coffee and a chocolate chip cookie has been saved. The total is $5.00. Would you like anything else?"*
153 changes: 153 additions & 0 deletions helidon-examples/coffee-shop-assistant-mp/data/menu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
[
{
"name": "Latte",
"description": "A rich espresso drink with steamed milk.",
"category": "Drink",
"price": 4.5,
"tags": [
"Hot",
"Customizable",
"Classic"
],
"addOns": [
"Oat milk",
"Soy milk",
"Extra shot",
"Caramel syrup"
]
},
{
"name": "Cappuccino",
"description": "Espresso topped with a thick layer of frothy milk.",
"category": "Drink",
"price": 4.0,
"tags": [
"Hot",
"Foamy",
"Classic"
],
"addOns": [
"Vanilla syrup",
"Extra shot"
]
},
{
"name": "Espresso",
"description": "A strong shot of coffee for a quick energy boost.",
"category": "Drink",
"price": 3.0,
"tags": [
"Hot",
"Classic",
"Bold"
],
"addOns": [
"Extra shot"
]
},
{
"name": "Iced Matcha Latte",
"description": "Chilled matcha green tea with milk.",
"category": "Drink",
"price": 5.0,
"tags": [
"Cold",
"Vegan",
"Trendy"
],
"addOns": [
"Oat milk",
"Almond milk",
"Extra matcha"
]
},
{
"name": "Avocado Toast",
"description": "Toasted bread topped with mashed avocado and seasonings.",
"category": "Food",
"price": 6.5,
"tags": [
"Healthy",
"Vegan",
"Breakfast"
],
"addOns": [
"Egg",
"Feta cheese",
"Hot sauce"
]
},
{
"name": "Blueberry Muffin",
"description": "A soft muffin bursting with blueberries.",
"category": "Food",
"price": 2.75,
"tags": [
"Breakfast",
"Sweet",
"Vegetarian"
],
"addOns": [
"Warm up"
]
},
{
"name": "Bagel with Cream Cheese",
"description": "A freshly baked bagel served with creamy cheese spread.",
"category": "Food",
"price": 3.5,
"tags": [
"Breakfast",
"Savory",
"Vegetarian"
],
"addOns": [
"Butter",
"Jam"
]
},
{
"name": "Caramel Frappuccino",
"description": "A blended coffee drink with caramel drizzle and whipped cream.",
"category": "Drink",
"price": 5.5,
"tags": [
"Cold",
"Sweet",
"Indulgent"
],
"addOns": [
"Extra caramel",
"Whipped cream"
]
},
{
"name": "Chocolate Chip Cookie",
"description": "A large, soft-baked cookie loaded with chocolate chips.",
"category": "Food",
"price": 2.0,
"tags": [
"Snack",
"Sweet",
"Vegetarian"
],
"addOns": [
"Warm up"
]
},
{
"name": "Hot Chocolate",
"description": "A creamy hot chocolate drink topped with whipped cream.",
"category": "Drink",
"price": 3.75,
"tags": [
"Hot",
"Sweet",
"Comforting"
],
"addOns": [
"Extra whipped cream",
"Caramel drizzle"
]
}
]
Loading