fix: pgvector_store read connection_string from env (#2887)

Co-authored-by: alanchen <40684202+chenliang15405@users.noreply.github.com>
This commit is contained in:
王潇
2025-10-21 16:58:06 +08:00
committed by GitHub
parent a46ebbca4d
commit 14f40dda0e

View File

@@ -1,6 +1,7 @@
"""Postgres vector store.""" """Postgres vector store."""
import logging import logging
import os
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Any, List, Optional from typing import Any, List, Optional
@@ -99,8 +100,10 @@ class PGVectorStore(VectorStoreBase):
max_chunks_once_load=max_chunks_once_load, max_threads=max_threads max_chunks_once_load=max_chunks_once_load, max_threads=max_threads
) )
self._vector_store_config = vector_store_config self._vector_store_config = vector_store_config
self.connection_string = vector_store_config.connection_string or os.getenv(
"PGVECTOR_CONNECTION_STRING"
)
self.connection_string = vector_store_config.connection_string
self.embeddings = embedding_fn self.embeddings = embedding_fn
self.collection_name = name self.collection_name = name