Skip to content

Commit 1062026

Browse files
authored
Merge branch 'aws-samples:main' into main
2 parents 0fbbcb6 + fa94daf commit 1062026

136 files changed

Lines changed: 13820 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

infrastructure/scripts/spring-ai/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM public.ecr.aws/docker/library/nginx:1.28.0
1+
FROM public.ecr.aws/docker/library/nginx:1.29.0
22

33
# Create a HTML page with timestamp using shell command directly in RUN
44
RUN echo '<html><body><h1>Hello World!</h1><p>Build timestamp: '$(date)'</p></body></html>' > /usr/share/nginx/html/index.html

samples/spring-ai/README.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Spring AI Microservices Ecosystem
2+
3+
This repository contains a comprehensive ecosystem of Spring AI-powered microservices that demonstrate how to build modern AI applications using the Spring AI framework.
4+
5+
## Overview
6+
7+
The ecosystem consists of three main applications and a shared database infrastructure:
8+
9+
1. **AI Assistant** - The central application that provides a chat interface with AI capabilities
10+
2. **Travel Service** - A specialized service for travel booking and management
11+
3. **Backoffice Service** - A specialized service for expense management and currency conversion
12+
4. **Database Infrastructure** - Shared PostgreSQL database with pgvector extension
13+
14+
These applications work together through the Model Context Protocol (MCP), allowing the AI Assistant to leverage specialized capabilities from the Travel and Backoffice services.
15+
16+
## Architecture
17+
18+
The overall architecture follows a microservices pattern with the AI Assistant as the central component:
19+
20+
![Assistant Architecture](assistant/docs/architecture.png)
21+
22+
The AI Assistant connects to the Travel and Backoffice services through the MCP protocol, allowing it to:
23+
- Search for and book hotels and flights (via Travel service)
24+
- Create and manage expenses (via Backoffice service)
25+
- Convert currencies (via Backoffice service)
26+
27+
## Projects
28+
29+
### [AI Assistant](assistant/README.md)
30+
31+
The AI Assistant is the central application in the ecosystem, providing:
32+
33+
- Text-based conversations with persistent memory
34+
- Document analysis (PDF, JPG, JPEG, PNG)
35+
- Retrieval-Augmented Generation (RAG) for knowledge base integration
36+
- Tool integration for enhanced capabilities
37+
- Model Context Protocol (MCP) client for connecting to external services
38+
39+
**Key Technologies:**
40+
- Spring AI with Amazon Bedrock (Claude Sonnet 4)
41+
- PostgreSQL with pgvector for vector embeddings
42+
- Thymeleaf web interface
43+
44+
![assistant-ui](assistant/docs/assistant-ui.png)
45+
46+
### [Travel Service](travel/README.md)
47+
48+
The Travel service provides specialized functionality for travel management:
49+
50+
- Hotel search and booking
51+
- Flight search and booking
52+
- Airport information
53+
- Weather forecasts for destinations
54+
- MCP server for AI integration
55+
56+
**Key Technologies:**
57+
- Spring Boot with Spring Data JPA
58+
- PostgreSQL for data storage
59+
- Spring AI MCP Server for AI integration
60+
61+
### [Backoffice Service](backoffice/README.md)
62+
63+
The Backoffice service provides specialized functionality for business operations:
64+
65+
- Expense management (create, track, update, approve)
66+
- Currency conversion with real-time exchange rates
67+
- MCP server for AI integration
68+
69+
**Key Technologies:**
70+
- Spring Boot with Spring Data JPA
71+
- PostgreSQL for data storage
72+
- Spring AI MCP Server for AI integration
73+
74+
### [Database Infrastructure](database/README.md)
75+
76+
The shared database infrastructure provides:
77+
78+
- PostgreSQL 16 with pgvector extension for vector embeddings
79+
- Multiple databases for different application domains
80+
- pgAdmin web interface for database management
81+
82+
## Getting Started
83+
84+
1. Start the database infrastructure:
85+
```bash
86+
cd database/
87+
./start-postgres.sh
88+
```
89+
90+
2. Start the Travel service:
91+
```bash
92+
cd travel/
93+
mvn spring-boot:run
94+
```
95+
96+
3. Start the Backoffice service:
97+
```bash
98+
cd backoffice/
99+
mvn spring-boot:run
100+
```
101+
102+
4. Start the AI Assistant:
103+
```bash
104+
cd assistant/
105+
mvn spring-boot:run
106+
```
107+
108+
5. Access the AI Assistant web interface:
109+
```
110+
http://localhost:8080
111+
```
112+
113+
## Key Spring AI Features
114+
115+
This ecosystem demonstrates several key features of the [Spring AI framework](https://docs.spring.io/spring-ai/reference/index.html):
116+
117+
1. **AI Integration** - Using Spring AI to integrate with AI models (Amazon Bedrock)
118+
2. **System Prompts** - Configuring AI behavior with system prompts
119+
3. **Chat Memory** - Implementing persistent conversation memory
120+
4. **RAG** - Implementing Retrieval-Augmented Generation for knowledge base integration
121+
5. **Tool Integration** - Extending AI capabilities with custom tools
122+
6. **MCP** - Using the Model Context Protocol for microservices integration
123+
124+
For more details on each feature, refer to the [AI Assistant documentation](assistant/README.md).
125+
126+
## Prerequisites
127+
128+
- Java 21 or higher
129+
- Maven 3.8 or higher
130+
- Docker and Docker Compose
131+
- AWS account with Amazon Bedrock access
132+
133+
## License
134+
135+
This project is licensed under the MIT License - see the LICENSE file for details.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.10/apache-maven-3.9.10-bin.zip

0 commit comments

Comments
 (0)