diff --git a/comps/vectorstores/README.md b/comps/vectorstores/README.md index c7d75ef80f..6b30b150bc 100644 --- a/comps/vectorstores/README.md +++ b/comps/vectorstores/README.md @@ -9,3 +9,7 @@ For details, please refer to this [readme](langchain/redis/README.md) # Vectorstores Microservice with Qdrant For details, please refer to this [readme](langchain/qdrant/README.md) + +# Vectorstores Microservice with PGVector + +For details, please refer to this [readme](langchain/pgvector/README.md) diff --git a/comps/vectorstores/langchain/pgvector/README.md b/comps/vectorstores/langchain/pgvector/README.md new file mode 100644 index 0000000000..7d13ee3126 --- /dev/null +++ b/comps/vectorstores/langchain/pgvector/README.md @@ -0,0 +1,21 @@ +# Start PGVector server + +## 1. Download Pgvector image + +```bash +docker pull pgvector/pgvector:0.7.0-pg16 +``` + +## 2. Configure the username, password and dbname + +```bash +export POSTGRES_USER=testuser +export POSTGRES_PASSWORD=testpwd +export POSTGRES_DB=vectordb +``` + +## 3. Run Pgvector service + +```bash +docker run --name vectorstore-postgres -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_DB=${POSTGRES_DB} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -d -v ./init.sql:/docker-entrypoint-initdb.d/init.sql pgvector/pgvector:0.7.0-pg16 +``` diff --git a/comps/vectorstores/langchain/pgvector/__init__.py b/comps/vectorstores/langchain/pgvector/__init__.py new file mode 100644 index 0000000000..28f108cb63 --- /dev/null +++ b/comps/vectorstores/langchain/pgvector/__init__.py @@ -0,0 +1,13 @@ +# Copyright (c) 2024 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/comps/vectorstores/langchain/pgvector/docker-compose.yml b/comps/vectorstores/langchain/pgvector/docker-compose.yml new file mode 100644 index 0000000000..e497390c48 --- /dev/null +++ b/comps/vectorstores/langchain/pgvector/docker-compose.yml @@ -0,0 +1,17 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +services: + db: + hostname: db + image: pgvector/pgvector:0.7.0-pg16 + ports: + - 5432:5432 + restart: always + environment: + - POSTGRES_DB=vectordb + - POSTGRES_USER=testuser + - POSTGRES_PASSWORD=testpwd + - POSTGRES_HOST_AUTH_METHOD=trust + volumes: + - ./init.sql:/docker-entrypoint-initdb.d/init.sql diff --git a/comps/vectorstores/langchain/pgvector/init.sql b/comps/vectorstores/langchain/pgvector/init.sql new file mode 100644 index 0000000000..0aa0fc2255 --- /dev/null +++ b/comps/vectorstores/langchain/pgvector/init.sql @@ -0,0 +1 @@ +CREATE EXTENSION IF NOT EXISTS vector;