Skip to content

Commit 681402b

Browse files
committed
Add finalized architectures
1 parent 786a0a4 commit 681402b

File tree

8 files changed

+69
-8
lines changed

8 files changed

+69
-8
lines changed

README.md

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ The application is designed for home cooks, culinary enthusiasts, individuals wi
1919

2020
### Integration of Generative AI
2121

22-
Generative AI is integrated meaningfully through a dedicated LLM microservice developed in Python. This service processes user inputs in natural language, generates recipes based on the provided ingredients, modifies existing recipes according to user needs, and provides meal suggestions. The use of GenAI enhances the user experience by offering creative, context-aware, and highly adaptable culinary solutions.
22+
Generative AI is integrated meaningfully through a dedicated LLM microservice developed in Python. This service processes user inputs in natural language, generates recipes based on the provided ingredients, modifies existing recipes according to user needs, and provides meal suggestions based on the user dietary preferences. The use of GenAI enhances the user experience by offering a personalized RAG system that emphasizes user-specific recipe collections. Through the use of a conversational AI system, we provide to the users with a multi-turn chat with context preservation.
2323

2424
### Functional Scenarios
2525

2626
1. **Ingredient-Based Recipe Generation**: A user inputs, "Suggest a quick dinner recipe with chicken and broccoli." The system uses the LLM to generate a relevant recipe, which is presented to the user through the user interface.
2727

2828
2. **Recipe Modification**: A user submits a traditional recipe and requests, "Make this vegan." The LLM identifies non-vegan ingredients and substitutes them with plant-based alternatives, returning a modified version of the recipe.
2929

30-
3. **Meal Planning**: A user asks for a weekly meal plan. The LLM generates a diverse and nutritionally balanced plan, optionally based on dietary restrictions or cuisine preferences.
30+
3. **Meal Planning with User Preferences**: A user defines his/her dietary preferences in the web application and asks for a weekly meal plan in the chat. The LLM generates a diverse and nutritionally balanced plan, based on dietary restrictions or cuisine preferences.
3131

3232
4. **Ingredient-Limited Cooking**: A user specifies available ingredients, such as "eggs, spinach, and cheese," and the system suggests recipes that can be prepared using those ingredients, optimizing for simplicity and flavor.
3333

@@ -52,6 +52,7 @@ Generative AI is integrated meaningfully through a dedicated LLM microservice de
5252
- Login with GitLab LRZ SSO
5353
- Chat interface (user prompt + LLM response)
5454
- Preference settings (gluten-free, diabetic, vegan, etc.)
55+
- Recipe document upload
5556
- Recipe history viewer
5657

5758
### 2. Backend (Spring Boot REST API)
@@ -77,9 +78,9 @@ Generative AI is integrated meaningfully through a dedicated LLM microservice de
7778
**Responsibilities:**
7879

7980
- Process incoming prompts and preferences.
80-
- Use LLM (e.g., GPT via LangChain) to generate, modify, and plan recipes.
81+
- Use LLM (e.g., GPT via LangChain or Llama3) to generate, modify, and plan recipes.
82+
- Fetch additional data from a well known recipe source stored in the vector database Qdrant to enable document retrieval for answering recipe document based questions.
8183
- Structure outputs into JSON responses and provide endpoints via FastAPI for server module.
82-
- Fetch additional data from a well known recipe source stored in the vector database Qdrant.
8384

8485
**Design:**
8586

@@ -102,7 +103,7 @@ Generative AI is integrated meaningfully through a dedicated LLM microservice de
102103

103104
**Collections:**
104105

105-
- `recipes` – Stores embedded recipe documents which are uploaded by the user
106+
- `recipes` – Stores user specific embedded recipe documents which are uploaded by the user
106107

107108
### 6. DevOps
108109

@@ -130,7 +131,8 @@ Generative AI is integrated meaningfully through a dedicated LLM microservice de
130131
### Communication Flow Example
131132

132133
1. User logs in via GitLab LRZ → token returned.
133-
2. User types: _"Suggest a vegan dinner with lentils."_
134+
2. User select his/her didtary preferences.
135+
2. User types: _"Suggest a dinner with lentils."_
134136
3. React sends prompt + preferences to Spring Boot API.
135137
4. API calls GenAI microservice with combined data.
136138
5. GenAI returns structured recipe.
@@ -180,6 +182,48 @@ cd team-continuous-disappointment
180182

181183
### Server Setup
182184

185+
**Note**: Please be aware that you need to manually add the GITLAB_CLIENT_SECRET from the `.env` file (see [.env.template](.env.template)) to the [application.yaml](server/api-gw/src/main/resources/application.yaml) file for the field `client-secret` for local development.
186+
```bash
187+
spring:
188+
profiles:
189+
active: dev
190+
application:
191+
name: api-gw
192+
cloud:
193+
gateway:
194+
mvc:
195+
routes:
196+
- id: user
197+
uri: http://user-service:8081
198+
predicates:
199+
- Path=/user/**
200+
- id: chat
201+
uri: http://chat-service:8082
202+
predicates:
203+
- Path=/chat/**
204+
security:
205+
oauth2:
206+
resourceserver:
207+
opaquetoken:
208+
client-id: ${GITLAB_CLIENT_ID:60a9e442420a386f2ddff0f60ed0801dd7e826f0710507e982d5afe6aa054334}
209+
client-secret: -> PUT HERE <-
210+
introspection-uri: https://gitlab.lrz.de/oauth/introspect
211+
212+
213+
server:
214+
port: 8080
215+
216+
management:
217+
endpoints:
218+
web:
219+
exposure:
220+
include:
221+
- health
222+
- info
223+
- metrics
224+
- prometheus
225+
```
226+
183227
1. Navigate to the `server` directory:
184228
```bash
185229
cd server
@@ -281,7 +325,7 @@ The LLM service will be available at [http://localhost:8000](http://localhost:80
281325

282326
- Built with FastAPI for AI-powered recipe recommendations.
283327
- Integrates with local and cloud LLMs for generating suggestions based on the given ingredients.
284-
- Stores embedded documents in a vector database to be able to make similarity search.
328+
- Stores embedded documents in a vector database to be able to make similarity search and document retrieval.
285329
- Source code is in the `genai` directory.
286330
- Tests are in the `genai/tests` directory.
287331

@@ -505,7 +549,24 @@ API documentation is available in the [`genai/openapi.yaml`](genai/openapi.yaml)
505549
- Usability: The chat interface must be responsive and intuitive.
506550
- Observability & Monitoring: The system must expose Prometheus metrics for all critical services. Dashboards must be created in Grafana to visualize response latency, error rates, and user request volume. Besides that, at least one alert must be defined.
507551

508-
## Architecture Overview - TODO
552+
## Architecture Overview
553+
554+
### UML Component Diagram
555+
556+
The following UML component diagram shows the details of the RecipAI application architecture and provides a comprehensive overview of the interfaces offered by the genai, chat, user, and API gateway services.
557+
![Component Diagram](docs/architecture_diagrams/component_diagram.png)
558+
559+
### UML Class Diagram - Server
560+
The following UML class diagram shows the details of the RecipAI application server’s repository layer, service layer, and controller layer.
561+
![Server Class Diagram](docs/architecture_diagrams/server_class_diagram.png)
562+
563+
### UML Class Diagram - GenAI
564+
The following UML class diagram shows the details of the RecipAI GenAI module's repository layer, service layer, and controller layer.
565+
![GenAI Class Diagram](docs/architecture_diagrams/genai_class_diagram.png)
566+
567+
### UML Use Case Diagram
568+
The following UML use case diagram shows the use cases and the participating actors of the RecipAI web application.
569+
![Use Case Diagram](docs/architecture_diagrams/use_case_diagram.png)
509570
510571
## Monitoring and Observability
511572
-30 KB
Binary file not shown.
620 KB
Loading
-13.6 KB
Binary file not shown.
523 KB
Loading
790 KB
Loading
228 KB
Loading
-12.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)