For env setup, follow the instructions
in the langroid-examples repo, which
means roughly the following. First ensure you have the latest poetry and
you are using python 3.11+.
python3 -m venv .venv
. .venv/bin/activate
poetry env use 3.11
poetry installCopy the .env-template to .env and fill in the values of the
OPENAI_API_KEY, QDRANT_API_KEY and QDRANT_API_URL variables.
(The latter two are needed to use the Qdrant Cloud vector-store;
consult their docs to see how to get these values.)
Various files, dirs:
fastapi_server/: FastAPI server code, defines the routes/endpoints. Contains:Dockerfile: to build the docker containerapp.py: defines the endpointsrequirements.txt: python dependencies
tests/: tests for the FastAPI serverMakefile: to build and run the docker containerserver/: auxiliary code modules that can be imported intoapp.py
make buildNote that this will run on localhost:90 -- caution it's 90 not 80
make upSee docker container logs in tail -f mode:
make tailThis tests the server using both the test client provided by FastAPI (which lets you step into the code while it's running), and also the endpoint served via uvicorn from the docker container.
pytest -xs tests/test_fastapi.py