Skip to content

Commit

Permalink
PGvector service (#86)
Browse files Browse the repository at this point in the history
* Support PGvector service

Signed-off-by: V, Ganesan <ganesan.v@intel.com>
  • Loading branch information
ganesanintel authored Jun 5, 2024
1 parent 3f5cdea commit 1b70010
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions comps/vectorstores/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
21 changes: 21 additions & 0 deletions comps/vectorstores/langchain/pgvector/README.md
Original file line number Diff line number Diff line change
@@ -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
```
13 changes: 13 additions & 0 deletions comps/vectorstores/langchain/pgvector/__init__.py
Original file line number Diff line number Diff line change
@@ -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.
17 changes: 17 additions & 0 deletions comps/vectorstores/langchain/pgvector/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions comps/vectorstores/langchain/pgvector/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE EXTENSION IF NOT EXISTS vector;

0 comments on commit 1b70010

Please sign in to comment.