diff --git a/.dockerignore b/.dockerignore index 1de5659..53f7426 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1 @@ -target \ No newline at end of file +**/target/ \ No newline at end of file diff --git a/README.md b/README.md index f10d33a..de6f9e8 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ pg_vectorize powers the [VectorDB Stack](https://tembo.io/docs/product/stacks/ai - [Vector Search Example](#vector-search-example) - [RAG Example](#rag-example) - [Updating Embeddings](#updating-embeddings) +- [Directly Interact with LLMs](#directly-interact-with-llms) ## Installation diff --git a/extension/Makefile b/extension/Makefile index 6ed4acb..fb3888c 100644 --- a/extension/Makefile +++ b/extension/Makefile @@ -3,13 +3,12 @@ DISTNAME = $(shell grep -m 1 '^name' Trunk.toml | sed -e 's/[^"]*"\([^"]*\)",\{0 DISTVERSION = $(shell grep -m 1 '^version' Trunk.toml | sed -e 's/[^"]*"\([^"]*\)",\{0,1\}/\1/') PG_VERSION:=16 DATABASE_URL:=postgres://${USER}:${USER}@localhost:288${PG_VERSION}/postgres -PGRX_PG_CONFIG =$(shell cargo pgrx info pg-config pg${PG_VERSION}) +PGRX_PG_CONFIG:=$(shell cargo pgrx info pg-config pg${PG_VERSION}) UPGRADE_FROM_VER:=0.16.0 BRANCH:=$(git rev-parse --abbrev-ref HEAD) RUST_LOG:=debug ARCH := $(shell uname -m) - .PHONY: install-pg_cron install-pg_vector install-pgmq run setup test-integration test-unit test-version test-branch test-upgrade cat-logs docs sqlx-cache: @@ -58,13 +57,12 @@ install-pg_cron: git clone https://github.com/citusdata/pg_cron.git && \ cd pg_cron && \ sed -i.bak 's/-Werror//g' Makefile && \ - PG_CONFIG=${PGRX_PG_CONFIG} make clean && \ PG_CONFIG=${PGRX_PG_CONFIG} make && \ PG_CONFIG=${PGRX_PG_CONFIG} make install && \ cd .. && rm -rf pg_cron install-pgvector: - git clone --branch v0.6.0 https://github.com/pgvector/pgvector.git && \ + git clone https://github.com/pgvector/pgvector.git && \ cd pgvector && \ PG_CONFIG=${PGRX_PG_CONFIG} make clean && \ PG_CONFIG=${PGRX_PG_CONFIG} make && \ @@ -75,6 +73,7 @@ install-pgmq: git clone https://github.com/tembo-io/pgmq.git && \ cd pgmq/pgmq-extension && \ PG_CONFIG=${PGRX_PG_CONFIG} make && \ + PG_CONFIG=${PGRX_PG_CONFIG} make clean && \ PG_CONFIG=${PGRX_PG_CONFIG} make install && \ cd .. && rm -rf pgmq diff --git a/images/vectorize-pg/Dockerfile b/images/vectorize-pg/Dockerfile index 9d09621..43d373f 100644 --- a/images/vectorize-pg/Dockerfile +++ b/images/vectorize-pg/Dockerfile @@ -1,9 +1,9 @@ ARG PG_MAJ=16 FROM postgres:$PG_MAJ-bookworm as builder -ARG VECTOR_VER=0.7.1 -ARG VSCALE_VER=0.2.0 -ARG CRON_VER=1.6.2 +ARG VECTOR_VER=0.7.4 +ARG VSCALE_VER=0.3.0 +ARG CRON_VER=1.6.4 ARG PGRX_VER=0.11.3 ARG PG_MAJ=16 @@ -21,27 +21,6 @@ RUN apt-get update \ WORKDIR /vectorize -# install pgvector -RUN git clone https://github.com/pgvector/pgvector.git && \ - cd pgvector && \ - git fetch origin v$VECTOR_VER && \ - git checkout v$VECTOR_VER && \ - make && make install && \ - cd .. && rm -rf pgvector - -# install pg_cron -RUN git clone https://github.com/citusdata/pg_cron.git --branch v$CRON_VER && \ - cd pg_cron && \ - make && make install && \ - cd .. && rm -rf pg_cron - -# install pgmq -RUN git clone https://github.com/tembo-io/pgmq.git && \ - cd pgmq/extension && \ - make && \ - make install && \ - cd ../.. && rm -rf pgmq - # Install Rust dependencies RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y RUN $HOME/.cargo/bin/rustup default stable @@ -54,22 +33,13 @@ RUN $HOME/.cargo/bin/cargo pgrx init --pg$PG_MAJ $(which pg_config) ARG PG_MAJ=16 RUN $HOME/.cargo/bin/cargo pgrx init --pg${PG_MAJ} /usr/bin/pg_config -# install vectorscale -ARG TARGETARCH -RUN if [ "$TARGETARCH" = "amd64" ]; then \ - export RUSTFLAGS="-C target-feature=+avx2,+fma"; \ - fi +COPY . . -RUN git clone https://github.com/timescale/pgvectorscale.git && \ - cd pgvectorscale/pgvectorscale && \ - git fetch origin $VSCALE_VER && \ - git checkout $VSCALE_VER && \ - sed -i '/blas/d' Cargo.toml && \ - sed -i '/blas_src/d' src/access_method/mod.rs && \ - $HOME/.cargo/bin/cargo pgrx install --pg-config=$(which pg_config) +# install dependencies +ARG PG_MAJ=16 +RUN export PATH="${HOME}/.cargo/bin:$PATH" && cd extension && make setup.dependencies PGRX_PG_CONFIG=$(cargo pgrx info pg-config pg${PG_MAJ}) # install pg-vectorize -COPY . . RUN cd extension && \ $HOME/.cargo/bin/cargo pgrx install --pg-config=$(which pg_config) diff --git a/images/vectorize-pg/postgresql.conf b/images/vectorize-pg/postgresql.conf index c2e75d8..47afcc1 100644 --- a/images/vectorize-pg/postgresql.conf +++ b/images/vectorize-pg/postgresql.conf @@ -816,5 +816,5 @@ pg_stat_statements.track = all # Track statements generated by stored pr # Add settings for extensions here shared_preload_libraries = 'vectorize,pg_cron' cron.database_name = 'postgres' -vectorize.embedding_service_url = 'http://vector-serve:3000/v1/embeddings' +vectorize.embedding_service_url = 'http://vector-serve:3000/v1' vectorize.ollama_service_url = 'http://ollama-serve:3001/v1/chat'