Skip to content

Commit 24a6b6a

Browse files
authored
Merge pull request #19 from AET-DevOps25/feat/genai-svc-basic-api
Feat: Implement RAG pipeline for advanced conversational AI
2 parents 7516c29 + 94ac8d8 commit 24a6b6a

Some content is hidden

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

69 files changed

+4930
-67
lines changed

.github/workflows/build_docker.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,13 @@ jobs:
152152
run: |
153153
cd genai-svc
154154
pip install -r requirements.txt
155+
pip install -r requirements-dev.txt
155156
156-
- name: Run Python tests (if any)
157+
- name: Run Python tests
157158
run: |
159+
export SKIP_WEAVIATE=true
158160
cd genai-svc
159-
# Add test commands here when tests are available
160-
python -m py_compile app.py
161+
python -m pytest tests/ -v
161162
162163
build:
163164
name: Build Docker Images

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ sketch
383383
/gateway/src/main/java/de/tum/aet/devops25/api/generated/
384384
/concept-svc/src/main/java/de/tum/aet/devops25/api/generated/
385385
/user-svc/src/main/java/de/tum/aet/devops25/api/generated/
386-
/genai-svc/client/
386+
/genai-svc/genai_models/
387387

388388
# OpenAPI Generator CLI configuration
389389
openapitools.json

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ This will start all services:
222222
- User Service at [http://localhost:8081](http://localhost:8081)
223223
- Concept Service at [http://localhost:8082](http://localhost:8082)
224224
- GenAI Service at [http://localhost:8083](http://localhost:8083)
225+
- Weaviate Vector Database at [http://localhost:8087](http://localhost:8087)
226+
- MinIO Object Storage at [http://localhost:9000](http://localhost:9000) (API) and [http://localhost:9001](http://localhost:9001) (Console)
225227

226228
### Option 2: Manual Startup
227229

api/genai-service.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ paths:
3131
description: Check if the GenAI Service is running
3232
tags:
3333
- Health
34+
x-openapi-router-controller: controllers.health_controller
3435
security: []
3536
responses:
3637
'200':
@@ -74,6 +75,7 @@ paths:
7475
description: Create the first welcome message when a user creates a new concept, personalized with user and concept details
7576
tags:
7677
- Chat Interface
78+
x-openapi-router-controller: controllers.chat_controller
7779
security:
7880
- bearerAuth: []
7981
requestBody:
@@ -136,6 +138,7 @@ paths:
136138
description: Send a message to the AI assistant for concept development and receive intelligent responses with optional concept suggestions
137139
tags:
138140
- Chat Interface
141+
x-openapi-router-controller: controllers.chat_controller
139142
security:
140143
- bearerAuth: []
141144
requestBody:
@@ -177,6 +180,7 @@ paths:
177180
description: Upload documents for AI analysis and RAG processing
178181
tags:
179182
- Document Processing
183+
x-openapi-router-controller: controllers.document_controller
180184
security:
181185
- bearerAuth: []
182186
parameters:
@@ -234,6 +238,7 @@ paths:
234238
description: Retrieve all processed documents associated with a concept
235239
tags:
236240
- Document Processing
241+
x-openapi-router-controller: controllers.document_controller
237242
security:
238243
- bearerAuth: []
239244
parameters:
@@ -278,6 +283,7 @@ paths:
278283
description: Delete a specific document from a concept and remove it from the knowledge base
279284
tags:
280285
- Document Processing
286+
x-openapi-router-controller: controllers.document_controller
281287
security:
282288
- bearerAuth: []
283289
parameters:

api/scripts/gen-all.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ generate_java() {
2828
echo "Generating Java code..."
2929
check_command openapi-generator-cli
3030

31-
openapi-generator-cli generate \
31+
# Generate for API Gateway
32+
openapi-generator-cli generate \
3233
-i api/gateway.yaml \
3334
-g spring \
3435
-o gateway \
@@ -61,21 +62,23 @@ openapi-generator-cli generate \
6162
echo "Java code generation complete!"
6263
}
6364

64-
# Python client generation
65+
# Python server generation
6566
generate_python() {
66-
echo "Generating Python client..."
67-
check_command openapi-python-client
67+
echo "Generating Python client and server..."
68+
check_command openapi-generator-cli
6869

6970
# Create output directories
70-
create_dir "genai-svc/client"
71+
create_dir "genai-svc"
7172

72-
# Generate client for GenAI service
73-
openapi-python-client generate \
74-
--path api/genai-service.yaml \
75-
--output-path genai-svc/client \
76-
--overwrite
73+
# Generate server stubs for GenAI service
74+
openapi-generator-cli generate \
75+
-i api/genai-service.yaml \
76+
-g python-flask \
77+
-o genai-svc \
78+
--skip-validate-spec \
79+
--additional-properties=packageName=genai_models,serverPort=8083
7780

78-
echo "Python client generation complete!"
81+
echo "Python server generation complete!"
7982
}
8083

8184
# TypeScript SDK generation

concept-svc/.openapi-generator-ignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
# Then explicitly reverse the ignore rule for a single file:
2323
#!docs/README.md
2424

25-
README.md
25+
README.md

docker-compose.yml

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ services:
99
- gateway
1010
networks:
1111
- frontend-network
12-
- backend-network
1312

1413
# API Gateway (Spring Boot)
1514
gateway:
@@ -28,7 +27,8 @@ services:
2827
- concept-svc
2928
- genai-svc
3029
networks:
31-
- backend-network
30+
- frontend-network
31+
- service-network
3232

3333
# User Service (Spring Boot)
3434
user-svc:
@@ -45,7 +45,8 @@ services:
4545
- SPRING_JPA_SHOW_SQL=true
4646
- SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL=true
4747
networks:
48-
- backend-network
48+
- service-network
49+
- user-db-network
4950
depends_on:
5051
- user-svc-db
5152

@@ -58,7 +59,7 @@ services:
5859
- POSTGRES_USER=postgres
5960
- POSTGRES_DB=eventdb
6061
networks:
61-
- backend-network
62+
- user-db-network
6263
#volumes:
6364
#- eventdb_data:/var/lib/postgresql/data
6465

@@ -77,7 +78,8 @@ services:
7778
- SPRING_JPA_SHOW_SQL=true
7879
- SPRING_JPA_PROPERTIES_HIBERNATE_FORMAT_SQL=true
7980
networks:
80-
- backend-network
81+
- service-network
82+
- concept-db-network
8183
depends_on:
8284
- concept-svc-db
8385

@@ -90,7 +92,7 @@ services:
9092
- POSTGRES_USER=postgres
9193
- POSTGRES_DB=conceptdb
9294
networks:
93-
- backend-network
95+
- concept-db-network
9496
#volumes:
9597
#- conceptdb_data:/var/lib/postgresql/data
9698

@@ -102,11 +104,83 @@ services:
102104
- "8083:8083"
103105
environment:
104106
- FLASK_ENV=production
107+
- WEAVIATE_URL=http://genai-svc-weaviate:8080 # Updated for new service name
108+
- WEAVIATE_GRPC_PORT=50051 # Explicitly set gRPC port
109+
- WEAVIATE_API_KEY=${WEAVIATE_API_KEY:-}
110+
- MINIO_URL=http://genai-svc-minio:9000 # Updated for new service name
111+
- MINIO_ACCESS_KEY=minioadmin
112+
- MINIO_SECRET_KEY=minioadmin
113+
- MINIO_BUCKET=concepts
114+
- CONCEPT_SERVICE_URL=http://concept-svc:8080
115+
- OPENWEBUI_MODEL=llama3.3:latest
116+
depends_on:
117+
- genai-svc-weaviate
118+
- genai-svc-minio
119+
- concept-svc
120+
networks:
121+
- service-network
122+
- genai-network
123+
env_file:
124+
- genai-svc/prod/.env
125+
126+
# Weaviate Vector Database for GenAI Service
127+
genai-svc-weaviate:
128+
image: semitechnologies/weaviate:1.30.5
129+
ports:
130+
- "8087:8080" # HTTP port
131+
- "50051:50051" # gRPC port
132+
environment:
133+
- QUERY_DEFAULTS_LIMIT=20
134+
- AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true
135+
- PERSISTENCE_DATA_PATH=/var/lib/weaviate
136+
- DEFAULT_VECTORIZER_MODULE=none
137+
- ENABLE_MODULES=text2vec-transformers
138+
- TRANSFORMERS_INFERENCE_API=http://genai-svc-t2v-transformers:8080
139+
# Minimal single-node configuration
140+
- CLUSTER_HOSTNAME=genai-svc-weaviate
141+
- RAFT_BOOTSTRAP_EXPECT=1
142+
volumes:
143+
- weaviate_data:/var/lib/weaviate
105144
networks:
106-
- backend-network
145+
- genai-network
146+
147+
# Text2Vec Transformers for Weaviate
148+
genai-svc-t2v-transformers:
149+
image: semitechnologies/transformers-inference:sentence-transformers-all-MiniLM-L6-v2
150+
environment:
151+
- ENABLE_CUDA=0
152+
networks:
153+
- genai-network
154+
155+
# MinIO Object Storage for GenAI Service
156+
genai-svc-minio:
157+
image: minio/minio:latest
158+
ports:
159+
- "9000:9000"
160+
- "9001:9001"
161+
environment:
162+
- MINIO_ROOT_USER=minioadmin
163+
- MINIO_ROOT_PASSWORD=minioadmin
164+
command: server /data --console-address ":9001"
165+
volumes:
166+
- minio_data:/data
167+
networks:
168+
- genai-network
107169

108170
networks:
109171
frontend-network:
110172
driver: bridge
111-
backend-network:
173+
service-network:
112174
driver: bridge
175+
user-db-network:
176+
driver: bridge
177+
concept-db-network:
178+
driver: bridge
179+
genai-network:
180+
driver: bridge
181+
182+
volumes:
183+
weaviate_data:
184+
driver: local
185+
minio_data:
186+
driver: local

genai-svc/.dockerignore

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.travis.yaml
2+
.openapi-generator-ignore
3+
README.md
4+
tox.ini
5+
git_push.sh
6+
test-requirements.txt
7+
setup.py
8+
9+
# Byte-compiled / optimized / DLL files
10+
__pycache__/
11+
*.py[cod]
12+
*$py.class
13+
14+
# C extensions
15+
*.so
16+
17+
# Distribution / packaging
18+
.Python
19+
env/
20+
build/
21+
develop-eggs/
22+
dist/
23+
downloads/
24+
eggs/
25+
.eggs/
26+
lib/
27+
lib64/
28+
parts/
29+
sdist/
30+
var/
31+
*.egg-info/
32+
.installed.cfg
33+
*.egg
34+
35+
# PyInstaller
36+
# Usually these files are written by a python script from a template
37+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
38+
*.manifest
39+
*.spec
40+
41+
# Installer logs
42+
pip-log.txt
43+
pip-delete-this-directory.txt
44+
45+
# Unit test / coverage reports
46+
htmlcov/
47+
.tox/
48+
.coverage
49+
.coverage.*
50+
.cache
51+
nosetests.xml
52+
coverage.xml
53+
*,cover
54+
.hypothesis/
55+
venv/
56+
.python-version
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
65+
# Sphinx documentation
66+
docs/_build/
67+
68+
# PyBuilder
69+
target/
70+
71+
#Ipython Notebook
72+
.ipynb_checkpoints

genai-svc/.env.example

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# GenAI Service Environment Variables
2+
3+
# Weaviate Configuration
4+
WEAVIATE_URL=http://weaviate:8080
5+
WEAVIATE_API_KEY=
6+
7+
# OpenWebUI Configuration
8+
OPENWEBUI_API_URL=https://gpu.aet.cit.tum.de/api
9+
OPENWEBUI_API_TOKEN=your_token_here
10+
OPENWEBUI_MODEL=llama3.3:latest
11+
12+
# AWS S3 Configuration (Optional, for document storage)
13+
AWS_ACCESS_KEY_ID=
14+
AWS_SECRET_ACCESS_KEY=
15+
AWS_REGION=us-east-1
16+
S3_BUCKET=concepter-documents
17+
18+
# Flask Configuration
19+
FLASK_ENV=production

0 commit comments

Comments
 (0)