Skip to content
databioPublic

Repository files navigation

bedhost

Code style: black Github badge

bedhost is a Python FastAPI module for the API that powers BEDbase. It needs a path to the bedbase configuration file, which can be provided either via -c/--config argument or read from $BEDBASE_CONFIG environment variable.


Links of interest

Developer quick-start

source environment/production.env
BEDBASE_CONFIG=deployment/config/api.bedbase.org.yaml uvicorn bedhost.main:app --reload

Embeddings

Search, /v1/bed/embed, and /v1/bed/umap need embedding models. By default bbconf loads them all in-process, which needs uv pip install -e ".[local]" --torch-backend cpu. The production configs instead set bbconf's embedding_server: block (see the bbconf README), so the two text models (dense and sparse) come from embedding servers and are not loaded by bedhost. The region model (path.region2vec) still runs in-process, so the Docker image keeps CPU-only torch. The servers come from these environment variables, which production reads from AWS SSM:

Variable Config key
EMBEDDING_DENSE_URL embedding_server.text_url
EMBEDDING_SPARSE_URL embedding_server.sparse_url
EMBEDDING_API_KEY embedding_server.api_key

To move the region model to a server too, add embedding_server.region_url. For local runs, source environment/production.env sets all three from the lab's pass store.

If a server is down, bedhost still starts and the routes that need it return 503.

UI development:

export VITE_API_HOST=http://localhost:8000

Testing

Black-box compliance tests (against any deployment):

pytest tests/api/ --api_root=https://api.bedbase.org

Integration tests (ephemeral Postgres + Qdrant + in-process TestClient, ~30s):

./tests/scripts/test-integration.sh

Manual service control:

./tests/scripts/services.sh start
RUN_INTEGRATION_TESTS=true pytest tests/integration/ tests/api/
./tests/scripts/services.sh stop

Integration tests require network access on first boot (bbconf downloads a licenses CSV from GitHub and may pull HuggingFace models unless BEDHOST_INIT_ML=false is set; test-integration.sh sets it). BEDHOST_LOG_LEVEL (default INFO) sets the log level for bedhost, bbconf, and geniml.

Releases

Packages

Used by

Contributors

Languages