mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-02 05:45:47 +00:00
community[patch]: Add pgvector to docker compose and update settings used in integration test (#18815)
This commit is contained in:
parent
ad29806255
commit
1f50274df7
@ -52,6 +52,28 @@ services:
|
||||
retries: 60
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
pgvector:
|
||||
# postgres with the pgvector extension
|
||||
image: ankane/pgvector
|
||||
environment:
|
||||
POSTGRES_DB: langchain
|
||||
POSTGRES_USER: langchain
|
||||
POSTGRES_PASSWORD: langchain
|
||||
ports:
|
||||
- "6024:5432"
|
||||
command: |
|
||||
postgres -c log_statement=all
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
"psql postgresql://langchain:langchain@localhost/langchain --command 'SELECT 1;' || exit 1",
|
||||
]
|
||||
interval: 5s
|
||||
retries: 60
|
||||
volumes:
|
||||
- postgres_data_pgvector:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
postgres_data_pgvector:
|
||||
|
@ -9,13 +9,20 @@ from sqlalchemy.orm import Session
|
||||
from langchain_community.vectorstores.pgvector import PGVector
|
||||
from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings
|
||||
|
||||
# The connection string matches the default settings in the docker-compose file
|
||||
# located in the root of the repository: [root]/docker/docker-compose.yml
|
||||
# Non-standard ports are used to avoid conflicts with other local postgres
|
||||
# instances.
|
||||
# To spin up postgres with the pgvector extension:
|
||||
# cd [root]/docker/docker-compose.yml
|
||||
# docker compose up pgvector
|
||||
CONNECTION_STRING = PGVector.connection_string_from_db_params(
|
||||
driver=os.environ.get("TEST_PGVECTOR_DRIVER", "psycopg2"),
|
||||
host=os.environ.get("TEST_PGVECTOR_HOST", "localhost"),
|
||||
port=int(os.environ.get("TEST_PGVECTOR_PORT", "5432")),
|
||||
database=os.environ.get("TEST_PGVECTOR_DATABASE", "postgres"),
|
||||
user=os.environ.get("TEST_PGVECTOR_USER", "postgres"),
|
||||
password=os.environ.get("TEST_PGVECTOR_PASSWORD", "postgres"),
|
||||
port=int(os.environ.get("TEST_PGVECTOR_PORT", "6024")),
|
||||
database=os.environ.get("TEST_PGVECTOR_DATABASE", "langchain"),
|
||||
user=os.environ.get("TEST_PGVECTOR_USER", "langchain"),
|
||||
password=os.environ.get("TEST_PGVECTOR_PASSWORD", "langchain"),
|
||||
)
|
||||
|
||||
ADA_TOKEN_COUNT = 1536
|
||||
|
Loading…
Reference in New Issue
Block a user