Use this repository as a template to implement your Brevia API project
Poetry is required to setup this API. It is also recommended to use virtualenv inside the project folder (you can simply do that with poetry config virtualenvs.in-project true
) we assume this configuration from now on, but you are free to use your usual virtualenv configuration.
- install the dependencies by running
poetry install
, a virtualenv will automatically be created in the.venv
folder - activate the virtualenv by running the
poetry shell
command. - copy
config/.env.sample
file toconfig/.env
where environment variables are stored - check these vars especially
OPENAI_API_KEY
with the secret key of OpenAI andPGVECTOR_*
see the Database section
You can run docker compose --profile admin up
to run postgres+pgvector and pgadmin docker images. With your browser, open pgadmin
at http://localhost:4000
The 4000
port is configurable with the PGADMIN_PORT
environment var in the .env
file.
Launch migrations to create the initial schema with Alembic by using this brevia command
db_upgrade
You are now ready to go, simply run
uvicorn --env-file .env main:app`
and your Brevia API project is ready to accept calls!