Introduce the Clean Architecture folder structures (adapter, usecase, domain)
Add the SQL management template for potential rdb usage
Update pydantic and FastAPI versions for the future langchain support
Refactor the whole code to pass all the tests in CI (I used many casts and # type: ignores to avoid mypy errors. Please fix them if you know the better way.)
How to test
Boot up docker containers
# Run under Crux/environments/cpu on your host PC
$ docker compose up -d
# If you have the old containers
$ docker compose build --no-cache
$ docker compose up -d --force-recreate
Run the backend service
# Run in the cpu-crux-backwend container
# Install python packages using poetry
~$ poetry install
...
# Run the server
~$ make run-backend
poetry run gunicorn 'src.app:main' -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000 -t 6000 --log-level info
[2023-07-12 15:20:01 +0000] [10714] [INFO] Starting gunicorn 20.1.0
[2023-07-12 15:20:01 +0000] [10714] [INFO] Listening at: http://0.0.0.0:8000 (10714)
[2023-07-12 15:20:01 +0000] [10714] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2023-07-12 15:20:01 +0000] [10717] [INFO] Booting worker with pid: 10717
[2023-07-12 15:20:02 +0000] [10717] [WARNING] ASGI app factory detected. Using it, but please consider setting the --factory flag explicitly.
[2023-07-12 15:20:02 +0000] [10717] [INFO] Started server process [10717]
[2023-07-12 15:20:02 +0000] [10717] [INFO] Waiting for application startup.
[2023-07-12 15:20:02 +0000] [10717] [INFO] Application startup complete.
Specify at least one PDF file and fill in the other form parts as follows
Push the "Excute" button
The logic works without problems if the response from the endpoint is as follows
Note for reviewers
Since langchain does not yet support pydantic version 2.0, I reverted to the code using pydantic=1.10.10 in the last commit as a temporary measure; as soon as langchain supports pydantic=2.0, we can switch back again.
Issue URL
NA
Change overview
CVPR_2023_Survey
pydantic
andFastAPI
versions for the futurelangchain
support# type: ignore
s to avoid mypy errors. Please fix them if you know the better way.)How to test
Check the logic works properly from http://localhost:8000/docs
Note for reviewers
Since langchain does not yet support pydantic version 2.0, I reverted to the code using pydantic=1.10.10 in the last commit as a temporary measure; as soon as langchain supports pydantic=2.0, we can switch back again.