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 install
Copy 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 build
Note that this will run on localhost:90
-- caution it's 90 not 80
make up
See docker container logs in tail -f
mode:
make tail
This 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