Skip to content

Commit

Permalink
Merge pull request #21 from meddhiaka/langchain-based-module
Browse files Browse the repository at this point in the history
llm-service-boilerplate-fastapi-docker-compose
  • Loading branch information
meddhiaka authored Jul 27, 2024
2 parents aeb4536 + 739a030 commit ea5e1bb
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 1 deletion.
3 changes: 3 additions & 0 deletions llm-service/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__pycache__
llm
.env
4 changes: 4 additions & 0 deletions llm-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
llm
__pycache__
.vscode
.env
15 changes: 15 additions & 0 deletions llm-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.9.19-slim-bullseye

WORKDIR /app

COPY requirements.txt .

RUN pip install -r requirements.txt

COPY models/ /app/models/
COPY routes/ /app/routes/
COPY main.py /app/

EXPOSE 80

CMD [ "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "1337" ]
14 changes: 14 additions & 0 deletions llm-service/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'

services:
service-llm:
image: service-llm
container_name: service-llm
ports:
- "1337:1337"
networks:
- llm-network

networks:
llm-network:
driver: bridge
7 changes: 7 additions & 0 deletions llm-service/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from fastapi import FastAPI
from routes import testRoute

app = FastAPI()

app.include_router(testRoute.router)

Empty file added llm-service/models/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions llm-service/models/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from pydantic import BaseModel

class Test(BaseModel):
name: str
v: int
33 changes: 33 additions & 0 deletions llm-service/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
annotated-types==0.7.0
anyio==4.4.0
certifi==2024.7.4
click==8.1.7
colorama==0.4.6
dnspython==2.6.1
email_validator==2.2.0
fastapi==0.111.1
fastapi-cli==0.0.4
h11==0.14.0
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.0
idna==3.7
Jinja2==3.1.4
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
pydantic==2.8.2
pydantic_core==2.20.1
Pygments==2.18.0
python-dotenv==1.0.1
python-multipart==0.0.9
PyYAML==6.0.1
rich==13.7.1
shellingham==1.5.4
sniffio==1.3.1
starlette==0.37.2
typer==0.12.3
typing_extensions==4.12.2
uvicorn==0.30.3
watchfiles==0.22.0
websockets==12.0
Empty file added llm-service/routes/__init__.py
Empty file.
12 changes: 12 additions & 0 deletions llm-service/routes/testRoute.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from fastapi import APIRouter
from models.test import Test

router = APIRouter()

@router.get("/", status_code=200)
async def read_test():
return {"message": "you're in the est root"}

@router.post("/posttest", status_code=201)
async def post_test(test: Test):
return test
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", "llm-service"]
}

0 comments on commit ea5e1bb

Please sign in to comment.