• cmake (>=3.3)
  • gcc
  • g++ (>=11)
  • PostgreSQL 11, 12, 13, 14, 15 or 16
  • Rust >= 1.70.0
  • Corresponding development package for PostgreSQL (postgresql-server-dev-$version)

Supported platforms

  • Linux
  • Mac

Clone repository from GitHub

git clone

Install PGRX

  # install pgrx prerequisites
  sudo apt install pkg-config libssl-dev zlib1g-dev libreadline-dev
  sudo apt-get install clang
  cargo install --locked cargo-pgrx --version 0.9.7
  cargo pgrx init --pg$PG_VERSION pg_config

Install the extension

cargo pgrx install --package lantern_extras --pg-config $(which pg_config)

Install ONNX Runtime

Refer to Installing ONNX Runtime guide

You should add the onnx library path to ld.conf, as environment variables may not be accessible from Postgres Server


Test Installation

CREATE EXTENSION lantern_extras;
SELECT get_available_models(); -- get available models
SELECT clip_text('Hello world!'); -- generate embeddings using openai clip model (textual)
SELECT clip_image(''); -- generate embeddings using openai clip model (visual)
-- using any model from the list
SELECT text_embedding('BAAI/bge-small-en', 'Hello world!');