Lettuce Quickstart

Quickstart

The fastest way to get started with Lettuce is to use the command-line interface (CLI).

Prerequisites

  • Python 3.12
  • uv for dependency management
  • Access to an OMOP-CDM database with a pgvector table for concept embeddings

Clone the lettuce repository

git clone https://github.com/Health-Informatics-UoN/lettuce.git
cd lettuce

Set Up Your Environment

Lettuce uses a .env file to manage database credentials.

Create a .env file with the following contents:

DB_HOST="your-db-host"
DB_USER="your-db-username"
DB_PASSWORD="your-db-password" 
DB_NAME="your-db-name"
DB_PORT="5432" # or your custom port
DB_SCHEMA="cdm"
DB_VECTABLE="embeddings"  # or your custom vector table
DB_VECSIZE="384" # or 768, depending on the embedding model

If you’re using a containerised version, these values will differ—see the Database Setup guide.

Install dependencies

Dependencies are handled with uv, and first have to be installed from the pyproject.toml via:

uv sync

Run the CLI

Once this is complete, you can run lettuce-cli

uv run --env-file .env lettuce-cli --informal_names "acetaminophen" --no-use_llm --no-vector_search

The flags in this command disable the vector search and LLM, just querying the database for “acetaminophen”. Running the LLM will download a model, and vector search use the embeddings table to perform and semantic search on the search term, so these flags can be omitted when you’re ready to take these steps.

🥬

Congratulations on your first Lettuce query!