Skip to content

Commit

Permalink
Add dockerfile and requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
tabris2015 committed Nov 26, 2023
1 parent 4bee89f commit ffbe674
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 2 deletions.
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.11-slim

ENV PORT 8000

COPY requirements.txt /
RUN pip install -r requirements.txt

COPY ./src /src
#COPY .env /.env

CMD uvicorn src.main:app --host 0.0.0.0 --port ${PORT}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# project-template-generator
template generator for final projects

## run with docker

build: `docker build -t llm_service .`
run: `docker run --rm -p 8000:8000 --env-file .env llm_service`

## run with docker compose

build and run: `docker compose up`
8 changes: 8 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.9"
services:
llm-backend:
build: .
ports:
- "8000:8000"
env_file:
- .env
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fastapi
uvicorn
pydantic-settings
openai
langchain
python-dotenv
ruff
2 changes: 1 addition & 1 deletion src/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import Enum
from functools import lru_cache
from pydantic import BaseSettings, BaseModel
from pydantic_settings import BaseSettings


class GPTModel(str, Enum):
Expand Down
10 changes: 10 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
from fastapi import FastAPI, Depends
from starlette.middleware.cors import CORSMiddleware
from src.llm_service import TemplateLLM
from src.prompts import ProjectParams
from src.parsers import ProjectIdeas


app = FastAPI()

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)


def get_llm_service():
return TemplateLLM()
Expand Down
1 change: 0 additions & 1 deletion src/prompts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from enum import Enum
from pydantic import BaseModel
from langchain import PromptTemplate

PROJECT_TEMPLATE = """You are an {major} senior student looking for a final project.
In order to classify for your dissertation you need to present a project proposal with the following
Expand Down

0 comments on commit ffbe674

Please sign in to comment.