Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tzolov/playground-flight-booking
Spring AI powered expert system demo
https://github.com/tzolov/playground-flight-booking
artificial-intelligence expert-system generative-ai
Last synced: 4 days ago
JSON representation
Spring AI powered expert system demo
- Host: GitHub
- URL: https://github.com/tzolov/playground-flight-booking
- Owner: tzolov
- Created: 2024-03-11T07:09:01.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-09-12T17:25:55.000Z (2 months ago)
- Last Synced: 2024-09-13T06:41:17.572Z (2 months ago)
- Topics: artificial-intelligence, expert-system, generative-ai
- Language: Java
- Homepage: https://docs.spring.io/spring-ai/reference/1.0-SNAPSHOT/index.html
- Size: 646 KB
- Stars: 47
- Watchers: 3
- Forks: 21
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AI powered expert system demo
Spring AI re-implementation of https://github.com/marcushellberg/java-ai-playground
This app shows how you can use [Spring AI](https://github.com/spring-projects/spring-ai) to build an AI-powered system that:
- Has access to terms and conditions (retrieval augmented generation, RAG)
- Can access tools (Java methods) to perform actions (Function Calling)
- Uses an LLM to interact with the user![alt text](diagram.jpg)
## Requirements
- Java 17+
- OpenAI API key in `OPENAI_API_KEY` environment variable## Running
Run the app by running `Application.java` in your IDE or `mvn` in the command line.
### With OpenAI Chat
Add to the POM the Spring AI Open AI boot starter:
```xml
org.springframework.ai
spring-ai-openai-spring-boot-starter```
Add the OpenAI configuraiton to the `applicaiton.properties`:
```
spring.ai.openai.api-key=${OPENAI_API_KEY}
spring.ai.openai.chat.options.model=gpt-4o
```### WIth VertexAI Geminie Chat
Add to the POM the Spring AI VertexAI Gemeni and Onnx Transfomer Embedding boot starters:
```xml
org.springframework.ai
spring-ai-vertex-ai-gemini-spring-boot-starterorg.springframework.ai
spring-ai-transformers-spring-boot-starter```
Add the VertexAI Gemini configuraiton to the `applicaiton.properties`:
```
spring.ai.vertex.ai.gemini.project-id=${VERTEX_AI_GEMINI_PROJECT_ID}
spring.ai.vertex.ai.gemini.location=${VERTEX_AI_GEMINI_LOCATION}
spring.ai.vertex.ai.gemini.chat.options.model=gemini-1.5-pro-001
# spring.ai.vertex.ai.gemini.chat.options.model=gemini-1.5-flash-001
```### With Azure OpenAI Chat
Add to the POM the Spring AI Azure OpenAI boot starter:
```xml
org.springframework.ai
spring-ai-azure-openai-spring-boot-starter```
Add the Azure OpenAI configuraiton to the `applicaiton.properties`:
```
spring.ai.azure.openai.api-key=${AZURE_OPENAI_API_KEY}
spring.ai.azure.openai.endpoint=${AZURE_OPENAI_ENDPOINT}
spring.ai.azure.openai.chat.options.deployment-name=gpt-4o
```### With Groq Chat
It reuses the OpenAI Chat client but ponted to the Groq endpont
Add to the POM the Spring AI Open AI boot starter:
```xml
org.springframework.ai
spring-ai-openai-spring-boot-starterorg.springframework.ai
spring-ai-transformers-spring-boot-starter```
Add the Groq configuraiton to the `applicaiton.properties`:
```
spring.ai.openai.api-key=${GROQ_API_KEY}
spring.ai.openai.base-url=https://api.groq.com/openai
spring.ai.openai.chat.options.model=llama3-70b-8192
```### With Anthropic Claude 3 Chat
Add to the POM the Spring AI Anthropic Claude and Onnx Transfomer Embedding boot starters:
```xml
org.springframework.ai
spring-ai-anthropic-spring-boot-starterorg.springframework.ai
spring-ai-transformers-spring-boot-starter```
Add the Anthropic configuraiton to the `applicaiton.properties`:
```
spring.ai.anthropic.api-key=${ANTHROPIC_API_KEY}
spring.ai.openai.chat.options.model=llama3-70b-8192
spring.ai.anthropic.chat.options.model=claude-3-5-sonnet-20240620
```## Build Jar
```shell
./mvnw clean install -Pproduction
``````shell
java -jar ./target/playground-flight-booking-0.0.1-SNAPSHOT.jar
``````
docker run -it --rm --name postgres -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres ankane/pgvector
```