Skip to content

Commit 1b9f54b

Browse files
authored
Merge pull request #13 from AET-DevOps25/1-setup-rag-repo
Setup genai project structe alogn with github actions and docker file / docker compose
2 parents e958f9c + 59ca99f commit 1b9f54b

24 files changed

+383
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: GenAI linters
2+
3+
on: ["pull_request", "workflow_dispatch"]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout sources
10+
uses: actions/checkout@v4
11+
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v5
14+
15+
- name: "Set up Python"
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version-file: "./genai/.python-version"
19+
20+
- name: Install dependencies
21+
run: |
22+
uv pip install -r ./genai/requirements.txt --system
23+
24+
- name: GenAI lint
25+
run: |
26+
cd genai
27+
ruff check .
28+
29+
- name: GenAI formatting
30+
run: |
31+
cd genai
32+
ruff format --check .

.github/workflows/genai-tests.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: GenAI tests
2+
3+
on: ["pull_request", "workflow_dispatch"]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout sources
10+
uses: actions/checkout@v4
11+
12+
- name: Install uv
13+
uses: astral-sh/setup-uv@v5
14+
15+
- name: "Set up Python"
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version-file: "./genai/.python-version"
19+
20+
- name: Install dependencies
21+
run: |
22+
uv pip install -r ./genai/requirements.txt --system
23+
24+
- name: GenAI tests
25+
run: |
26+
cd genai
27+
pytest

docker-compose.yml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ services:
5959
test: "curl -f http://localhost:3000 || exit 1"
6060
interval: 5s
6161
ports:
62-
- "3000:3000"
62+
- "3000:3000"
6363
networks:
6464
- server
6565

@@ -83,9 +83,71 @@ services:
8383
networks:
8484
- server
8585

86+
genai:
87+
restart: always
88+
build:
89+
context: ./genai
90+
dockerfile: Dockerfile
91+
ports:
92+
- "8000:8000"
93+
environment:
94+
DB_HOST: ${DB_HOST:-weaviate}
95+
DB_PORT: ${DB_PORT:-9090}
96+
DB_GRPC_PORT: ${DB_GRPC_PORT:-50051}
97+
depends_on:
98+
- weaviate
99+
volumes:
100+
- ./genai:/app
101+
networks:
102+
- server
103+
- rag
104+
105+
weaviate:
106+
command: [ "--host", "0.0.0.0", "--port", "9090", "--scheme", "http"]
107+
image: cr.weaviate.io/semitechnologies/weaviate:1.30.0
108+
ports:
109+
- "9090:9090"
110+
- "50051:50051"
111+
volumes:
112+
- weaviate-data:/var/lib/weaviate
113+
restart: on-failure:0
114+
environment:
115+
TRANSFORMERS_INFERENCE_API: 'http://t2v-transformers:8080'
116+
IMAGE_INFERENCE_API: 'http://i2v-neural:8080'
117+
SPELLCHECK_INFERENCE_API: 'http://text-spellcheck:8080'
118+
QUERY_DEFAULTS_LIMIT: 25
119+
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
120+
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
121+
DEFAULT_VECTORIZER_MODULE: 'text2vec-transformers'
122+
ENABLE_MODULES: 'text2vec-transformers,text-spellcheck,img2vec-neural'
123+
CLUSTER_HOSTNAME: 'node1'
124+
networks:
125+
- rag
126+
127+
t2v-transformers:
128+
image: cr.weaviate.io/semitechnologies/transformers-inference:sentence-transformers-multi-qa-MiniLM-L6-cos-v1
129+
environment:
130+
ENABLE_CUDA: '0'
131+
networks:
132+
- rag
133+
134+
text-spellcheck:
135+
image: cr.weaviate.io/semitechnologies/text-spellcheck-model:pyspellchecker-en
136+
networks:
137+
- rag
138+
139+
i2v-neural:
140+
image: cr.weaviate.io/semitechnologies/img2vec-pytorch:resnet50
141+
environment:
142+
ENABLE_CUDA: '0'
143+
networks:
144+
- rag
145+
86146
networks:
87147
server:
148+
rag:
88149

89150
volumes:
90151
db-data:
91152
node-modules-client:
153+
weaviate-data:

genai/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.venv

genai/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

genai/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
2+
3+
WORKDIR /app
4+
5+
COPY requirements.txt requirements.txt
6+
7+
RUN uv pip install --no-cache-dir -r requirements.txt --system
8+
9+
COPY . .
10+
11+
EXPOSE 8000
12+
13+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
File renamed without changes.

genai/app/__init__.py

Whitespace-only changes.

genai/app/config.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
from pydantic_settings import BaseSettings
3+
from dotenv import load_dotenv
4+
5+
6+
class Settings(BaseSettings):
7+
load_dotenv()
8+
9+
db_host: str = os.getenv("DB_HOST") or ""
10+
db_port: int = int(os.getenv("DB_PORT") or 0)
11+
db_grpc_port: int = int(os.getenv("DB_GRPC_PORT") or 0)
12+
13+
14+
settings = Settings()

genai/app/core/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)