From 88b4725e2ebd15b6605d073d26fc9089654762b7 Mon Sep 17 00:00:00 2001 From: "David S. Batista" Date: Tue, 13 Feb 2024 09:33:11 +0100 Subject: [PATCH] code formating --- integrations/pgvector/examples/example.py | 4 +++- .../document_stores/pgvector/document_store.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/integrations/pgvector/examples/example.py b/integrations/pgvector/examples/example.py index 14c2cba60..91da91d19 100644 --- a/integrations/pgvector/examples/example.py +++ b/integrations/pgvector/examples/example.py @@ -10,6 +10,7 @@ # Download some Markdown files to index. # git clone https://github.com/anakin87/neural-search-pills +import os import glob from haystack import Pipeline @@ -20,9 +21,10 @@ from haystack_integrations.components.retrievers.pgvector import PgvectorEmbeddingRetriever from haystack_integrations.document_stores.pgvector import PgvectorDocumentStore +os.environ["PG_CONN_STR"] = "postgresql://postgres:postgres@localhost:5432/postgres" + # Initialize PgvectorDocumentStore document_store = PgvectorDocumentStore( - connection_string="postgresql://postgres:postgres@localhost:5432/postgres", table_name="haystack_test", embedding_dimension=768, vector_function="cosine_similarity", diff --git a/integrations/pgvector/src/haystack_integrations/document_stores/pgvector/document_store.py b/integrations/pgvector/src/haystack_integrations/document_stores/pgvector/document_store.py index 57a7b44e2..c8d619763 100644 --- a/integrations/pgvector/src/haystack_integrations/document_stores/pgvector/document_store.py +++ b/integrations/pgvector/src/haystack_integrations/document_stores/pgvector/document_store.py @@ -118,7 +118,9 @@ def __init__( https://github.com/pgvector/pgvector?tab=readme-ov-file#hnsw """ - self.connection_string = connection_string if isinstance(connection_string, str) else connection_string.resolve_value() + self.connection_string = ( + connection_string if isinstance(connection_string, str) else connection_string.resolve_value() + ) self.table_name = table_name self.embedding_dimension = embedding_dimension if vector_function not in VALID_VECTOR_FUNCTIONS: