From f10da2f04408f342e920de8472228cd8a6716d2d Mon Sep 17 00:00:00 2001 From: Mahdi Date: Tue, 14 Oct 2025 09:45:55 +0330 Subject: [PATCH 1/4] Add PostgreSQL vector store support with pgvector --- src/raglight/config/settings.py | 7 ++ src/raglight/vectorstore/postgre.py | 126 ++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100644 src/raglight/vectorstore/postgre.py diff --git a/src/raglight/config/settings.py b/src/raglight/config/settings.py index 7b325b0..7014be4 100644 --- a/src/raglight/config/settings.py +++ b/src/raglight/config/settings.py @@ -18,6 +18,13 @@ def setup_logging() -> None: ) CHROMA = "Chroma" + POSTGRE = "Postgre" + DEFAULT_POSTGRE_HOST = os.environ.get("DEFAULT_POSTGRE_HOST", "localhost") + DEFAULT_POSTGRE_PORT = os.environ.get("DEFAULT_POSTGRE_PORT", 5432) + DEFAULT_POSTGRE_DATABASE = os.environ.get("DEFAULT_POSTGRE_DATABASE", "") + DEFAULT_POSTGRE_USER = os.environ.get("DEFAULT_POSTGRE_USER", "postgres") + DEFAULT_POSTGRE_PASSWORD = os.environ.get("DEFAULT_POSTGRE_PASSWORD", "") + OLLAMA = "Ollama" MISTRAL = "Mistral" VLLM = "vLLM" diff --git a/src/raglight/vectorstore/postgre.py b/src/raglight/vectorstore/postgre.py new file mode 100644 index 0000000..f7baba2 --- /dev/null +++ b/src/raglight/vectorstore/postgre.py @@ -0,0 +1,126 @@ +import logging +from typing import List, Dict +from typing_extensions import override +from langchain_core.documents import Document + +from ..config.settings import Settings + +from .vector_store import VectorStore +from ..embeddings.embeddings_model import EmbeddingsModel + +from enum import auto +from langchain_postgres import PGVector + +class PostgreVS(VectorStore): + """ + Concrete implementation for PostgreVDB. + + It inherits the main ingestion logic from the base VectorStore class and + only implements the Postgre-specific methods for adding documents and + performing searches. + """ + + def __init__( + self, + collection_name: str, + embeddings_model: EmbeddingsModel, + persist_directory: str = None, + host: str = Settings.DEFAULT_POSTGRE_HOST, + port: int = Settings.DEFAULT_POSTGRE_PORT, + database: str = Settings.DEFAULT_POSTGRE_DATABASE, + user: str = Settings.DEFAULT_POSTGRE_DATABASE, + password: str = Settings.DEFAULT_POSTGRE_DATABASE + + ) -> None: + """ + Initializes a PostgreVS instance. + """ + super().__init__(persist_directory, embeddings_model) + + self.persist_directory = persist_directory + self.host = host + self.port = port + self.database = database + connection_string = f"postgresql://{user}:{password}@{host}:{port}/{database}" + + if host and port: + + self.vector_store = PGVector( + collection_name=collection_name, + connection=connection_string, + embeddings=embeddings_model, + use_jsonb=True, + ) + + self.vector_store_classes = PGVector( + collection_name=f"{collection_name}_classes", + connection=connection_string, + embeddings=self.embeddings_model, + use_jsonb=True, + ) + else: + raise ValueError( + "Invalid configuration for PostgreVS: " + "You must either:\n" + " • Provide both host and port (for PostgreDB), OR\n" + " • Provide both user and password (for PostgreDB).\n" + " • Provide exist database (for PostgreDB).\n" + + f"Received -> host={host}, port={port}, user={user}, password={'*' * len(password) if password else None}, database={database}" + ) + + @override + def add_documents(self, documents: List[Document]) -> None: + """ + Implements the logic to add documents specifically to the main PostgreDB collection, + using batching for efficiency. + """ + if not documents: + return + + # logging.info( + # f"⏳ Adding {len(documents)} document chunks to PostgreDB collection '{self.vector_store._collection_name}'..." + # ) + self.vector_store.add_documents(documents=documents) + logging.info("✅ Documents successfully added to the main collection.") + + @override + def add_class_documents(self, documents: List[Document]) -> None: + """ + Implements the logic to add class signature documents to the dedicated PostgreDB + collection for classes. + """ + if not documents: + return + + logging.info( + f"⏳ Adding {len(documents)} class documents to PostgreDB collection '{self.vector_store_classes._collection_name}'..." + ) + self.vector_store_classes.add_documents(documents=documents) + logging.info("✅ Class documents successfully added to the class collection.") + + @override + def similarity_search( + self, + question: str, + k: int = 5, + filter: Dict[str, str] = None, + collection_name: str = None, + ) -> List[Document]: + """ + Implements similarity search using the main PostgreDB client. + """ + return self.vector_store.similarity_search(question, k=k, filter=filter) + + @override + def similarity_search_class( + self, + question: str, + k: int = 5, + filter: Dict[str, str] = None, + collection_name: str = None, + ) -> List[Document]: + """ + Implements similarity search using the dedicated class PostgreDB client. + """ + pass \ No newline at end of file From 5a4bb4b26b39665340cf0943d39f5eb670926a9b Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sat, 18 Oct 2025 12:09:14 +0330 Subject: [PATCH 2/4] update README.md,settings.py,builder.py,pyproject.toml and add test_postgres_vector_store.py --- README.md | 1 + pyproject.toml | 1 + src/raglight/config/settings.py | 12 +++--- src/raglight/rag/builder.py | 3 ++ .../vectorstore/{postgre.py => postgres.py} | 38 +++++++++---------- tests/test_config.py | 6 +++ .../test_postgres_vector_store.py | 25 ++++++++++++ 7 files changed, 61 insertions(+), 25 deletions(-) rename src/raglight/vectorstore/{postgre.py => postgres.py} (78%) create mode 100644 tests/tests_vector_store/test_postgres_vector_store.py diff --git a/README.md b/README.md index 6055afc..855740e 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,7 @@ For embeddings models, you can use these providers : For your vector store, you can use : - Chroma (`Settings.CHROMA`) +- Postgres (`Settings.POSTGRES`) ## Quick Start 🚀 diff --git a/pyproject.toml b/pyproject.toml index 73ff880..ffc35f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ dependencies = [ "python-dotenv>=1.1.1", "pydantic>=2.11.7", "google-genai>=1.2.0", + "langchain-postgres==0.0.16", ] [project.scripts] raglight = "raglight.cli.main:app" diff --git a/src/raglight/config/settings.py b/src/raglight/config/settings.py index 7014be4..afc2123 100644 --- a/src/raglight/config/settings.py +++ b/src/raglight/config/settings.py @@ -18,12 +18,12 @@ def setup_logging() -> None: ) CHROMA = "Chroma" - POSTGRE = "Postgre" - DEFAULT_POSTGRE_HOST = os.environ.get("DEFAULT_POSTGRE_HOST", "localhost") - DEFAULT_POSTGRE_PORT = os.environ.get("DEFAULT_POSTGRE_PORT", 5432) - DEFAULT_POSTGRE_DATABASE = os.environ.get("DEFAULT_POSTGRE_DATABASE", "") - DEFAULT_POSTGRE_USER = os.environ.get("DEFAULT_POSTGRE_USER", "postgres") - DEFAULT_POSTGRE_PASSWORD = os.environ.get("DEFAULT_POSTGRE_PASSWORD", "") + POSTGRES = "Postgres" + POSTGRES_HOST = os.environ.get("POSTGRES_HOST", "localhost") + POSTGRES_PORT = os.environ.get("POSTGRES_PORT", 5432) + POSTGRES_DATABASE = os.environ.get("POSTGRES_DATABASE", "") + POSTGRES_USER = os.environ.get("POSTGRES_USER", "postgres") + POSTGRES_PASSWORD = os.environ.get("POSTGRES_PASSWORD", "") OLLAMA = "Ollama" MISTRAL = "Mistral" diff --git a/src/raglight/rag/builder.py b/src/raglight/rag/builder.py index bfe1577..be9582c 100644 --- a/src/raglight/rag/builder.py +++ b/src/raglight/rag/builder.py @@ -13,6 +13,7 @@ from ..llm.openai_model import OpenAIModel from ..vectorstore.vector_store import VectorStore from ..vectorstore.chroma import ChromaVS +from ..vectorstore.postgres import PostgresVS from ..config.settings import Settings from .rag import RAG from ..rat.rat import RAT @@ -119,6 +120,8 @@ def with_vector_store(self, type: str, **kwargs) -> Builder: ) elif type == Settings.CHROMA: self.vector_store = ChromaVS(embeddings_model=self.embeddings, **kwargs) + elif type == Settings.POSTGRES: + self.vector_store = PostgresVS(embeddings_model=self.embeddings, **kwargs) else: raise ValueError(f"Unknown VectorStore type: {type}") logging.info("✅ VectorStore created") diff --git a/src/raglight/vectorstore/postgre.py b/src/raglight/vectorstore/postgres.py similarity index 78% rename from src/raglight/vectorstore/postgre.py rename to src/raglight/vectorstore/postgres.py index f7baba2..6dc6668 100644 --- a/src/raglight/vectorstore/postgre.py +++ b/src/raglight/vectorstore/postgres.py @@ -11,12 +11,12 @@ from enum import auto from langchain_postgres import PGVector -class PostgreVS(VectorStore): +class PostgresVS(VectorStore): """ - Concrete implementation for PostgreVDB. + Concrete implementation for PostgresVDB. It inherits the main ingestion logic from the base VectorStore class and - only implements the Postgre-specific methods for adding documents and + only implements the Postgres-specific methods for adding documents and performing searches. """ @@ -25,15 +25,15 @@ def __init__( collection_name: str, embeddings_model: EmbeddingsModel, persist_directory: str = None, - host: str = Settings.DEFAULT_POSTGRE_HOST, - port: int = Settings.DEFAULT_POSTGRE_PORT, - database: str = Settings.DEFAULT_POSTGRE_DATABASE, - user: str = Settings.DEFAULT_POSTGRE_DATABASE, - password: str = Settings.DEFAULT_POSTGRE_DATABASE + host: str = Settings.POSTGRES_HOST, + port: int = Settings.POSTGRES_PORT, + database: str = Settings.POSTGRES_DATABASE, + user: str = Settings.POSTGRES_USER, + password: str = Settings.POSTGRES_PASSWORD ) -> None: """ - Initializes a PostgreVS instance. + Initializes a PostgresVS instance. """ super().__init__(persist_directory, embeddings_model) @@ -60,11 +60,11 @@ def __init__( ) else: raise ValueError( - "Invalid configuration for PostgreVS: " + "Invalid configuration for PostgresVS: " "You must either:\n" - " • Provide both host and port (for PostgreDB), OR\n" - " • Provide both user and password (for PostgreDB).\n" - " • Provide exist database (for PostgreDB).\n" + " • Provide both host and port (for PostgresDB), OR\n" + " • Provide both user and password (for PostgreDsB).\n" + " • Provide exist database (for PostgresDB).\n" f"Received -> host={host}, port={port}, user={user}, password={'*' * len(password) if password else None}, database={database}" ) @@ -72,14 +72,14 @@ def __init__( @override def add_documents(self, documents: List[Document]) -> None: """ - Implements the logic to add documents specifically to the main PostgreDB collection, + Implements the logic to add documents specifically to the main PostgresDB collection, using batching for efficiency. """ if not documents: return # logging.info( - # f"⏳ Adding {len(documents)} document chunks to PostgreDB collection '{self.vector_store._collection_name}'..." + # f"⏳ Adding {len(documents)} document chunks to PostgresDB collection '{self.vector_store._collection_name}'..." # ) self.vector_store.add_documents(documents=documents) logging.info("✅ Documents successfully added to the main collection.") @@ -87,14 +87,14 @@ def add_documents(self, documents: List[Document]) -> None: @override def add_class_documents(self, documents: List[Document]) -> None: """ - Implements the logic to add class signature documents to the dedicated PostgreDB + Implements the logic to add class signature documents to the dedicated PostgresDB collection for classes. """ if not documents: return logging.info( - f"⏳ Adding {len(documents)} class documents to PostgreDB collection '{self.vector_store_classes._collection_name}'..." + f"⏳ Adding {len(documents)} class documents to PostgresDB collection '{self.vector_store_classes._collection_name}'..." ) self.vector_store_classes.add_documents(documents=documents) logging.info("✅ Class documents successfully added to the class collection.") @@ -108,7 +108,7 @@ def similarity_search( collection_name: str = None, ) -> List[Document]: """ - Implements similarity search using the main PostgreDB client. + Implements similarity search using the main PostgresDB client. """ return self.vector_store.similarity_search(question, k=k, filter=filter) @@ -121,6 +121,6 @@ def similarity_search_class( collection_name: str = None, ) -> List[Document]: """ - Implements similarity search using the dedicated class PostgreDB client. + Implements similarity search using the dedicated class PostgresDB client. """ pass \ No newline at end of file diff --git a/tests/test_config.py b/tests/test_config.py index 393656a..5b98c37 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -8,3 +8,9 @@ class TestsConfig: SYSTEM_PROMPT = "/Users/labess40/dev/RAGLight/systemPrompt.txt" COLLECTION_NAME = "grece" DATA_PATH = "/Users/labess40/Desktop/nutrition/grece" + OLLAMA_EMBEDDING_MODEL="nomic-embed-text:v1.5" + POSTGRES_HOST = "192.168.1.103" + POSTGRES_PORT=5432 + POSTGRES_DATABASE="ai_db" + POSTGRES_USER="" + POSTGRES_PASSWORD="" diff --git a/tests/tests_vector_store/test_postgres_vector_store.py b/tests/tests_vector_store/test_postgres_vector_store.py new file mode 100644 index 0000000..a7de4d1 --- /dev/null +++ b/tests/tests_vector_store/test_postgres_vector_store.py @@ -0,0 +1,25 @@ +import unittest +from ..test_config import TestsConfig + +from ...src.raglight.embeddings.ollama_embeddings import OllamaEmbeddingsModel +from ...src.raglight.vectorstore.postgres import PostgresVS + + +class TestVectorStore(unittest.TestCase): + def setUp(self): + model_embeddings = TestsConfig.OLLAMA_EMBEDDING_MODEL + collection_name = TestsConfig.COLLECTION_NAME + self.data_path = TestsConfig.DATA_PATH + embeddings = OllamaEmbeddingsModel(model_embeddings) + self.store = PostgresVS( + embeddings_model=embeddings, + collection_name=collection_name, + ) + + def test_ingest(self): + self.store.ingest(data_path=self.data_path) + self.assertEqual(True, True, "Embedding should be added to the store.") + + +if __name__ == "__main__": + unittest.main() From a1f10c0d7f40b8b7b54933e4d7adbcf6687fa563 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sun, 26 Oct 2025 08:55:18 +0330 Subject: [PATCH 3/4] Fix test and ollama embedding for postgre vector --- pyproject.toml | 1 + src/raglight/embeddings/ollama_embeddings.py | 23 +++++++++++++++++++ tests/test_config.py | 5 ++-- .../test_postgres_vector_store.py | 18 ++++++++++++--- 4 files changed, 42 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ffc35f6..cde8d8a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ "pydantic>=2.11.7", "google-genai>=1.2.0", "langchain-postgres==0.0.16", + "psycopg2_binary==2.9.11", ] [project.scripts] raglight = "raglight.cli.main:app" diff --git a/src/raglight/embeddings/ollama_embeddings.py b/src/raglight/embeddings/ollama_embeddings.py index 460a0fe..ad682af 100644 --- a/src/raglight/embeddings/ollama_embeddings.py +++ b/src/raglight/embeddings/ollama_embeddings.py @@ -40,3 +40,26 @@ def load(self) -> OllamaEmbeddings: OllamaEmbeddings: The loaded Ollama embeddings model. """ return OllamaEmbeddings(model=self.model_name, base_url=self.api_base) + def embed_documents(self, documents: list[str]) -> list[list[float]]: + """ + Embeds a list of documents using the loaded Ollama embeddings model. + + Args: + documents (list[str]): List of documents (strings) to embed. + + Returns: + list[list[float]]: List of embedding vectors. + """ + return self.model.embed_documents(documents) + + def embed_query(self, question) -> str: + """ + Embeds a list of documents using the loaded Ollama embeddings model. + + Args: + documents (list[str]): List of documents (strings) to embed. + + Returns: + list[list[float]]: List of embedding vectors. + """ + return self.model.embed_query(question) \ No newline at end of file diff --git a/tests/test_config.py b/tests/test_config.py index 5b98c37..cf5d75e 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -7,10 +7,11 @@ class TestsConfig: CHROMA_PERSIST_DIRECTORY_INGESTION = "/Users/labess40/dev/RAGLight/chromaDb2" SYSTEM_PROMPT = "/Users/labess40/dev/RAGLight/systemPrompt.txt" COLLECTION_NAME = "grece" - DATA_PATH = "/Users/labess40/Desktop/nutrition/grece" + # DATA_PATH = "/Users/labess40/Desktop/nutrition/grece" + DATA_PATH = "/home/danesh/Documents/system.out" OLLAMA_EMBEDDING_MODEL="nomic-embed-text:v1.5" POSTGRES_HOST = "192.168.1.103" POSTGRES_PORT=5432 POSTGRES_DATABASE="ai_db" - POSTGRES_USER="" + POSTGRES_USER="postgres" POSTGRES_PASSWORD="" diff --git a/tests/tests_vector_store/test_postgres_vector_store.py b/tests/tests_vector_store/test_postgres_vector_store.py index a7de4d1..8f7becc 100644 --- a/tests/tests_vector_store/test_postgres_vector_store.py +++ b/tests/tests_vector_store/test_postgres_vector_store.py @@ -1,19 +1,31 @@ import unittest -from ..test_config import TestsConfig -from ...src.raglight.embeddings.ollama_embeddings import OllamaEmbeddingsModel -from ...src.raglight.vectorstore.postgres import PostgresVS +from raglight.embeddings.ollama_embeddings import OllamaEmbeddingsModel +from raglight.vectorstore.postgres import PostgresVS +from ..test_config import TestsConfig class TestVectorStore(unittest.TestCase): def setUp(self): model_embeddings = TestsConfig.OLLAMA_EMBEDDING_MODEL collection_name = TestsConfig.COLLECTION_NAME self.data_path = TestsConfig.DATA_PATH + + self.host = TestsConfig.POSTGRES_HOST + self.port = TestsConfig.POSTGRES_PORT + self.darabase = TestsConfig.POSTGRES_DATABASE + self.user = TestsConfig.POSTGRES_USER + self.password = TestsConfig.POSTGRES_PASSWORD + embeddings = OllamaEmbeddingsModel(model_embeddings) self.store = PostgresVS( embeddings_model=embeddings, collection_name=collection_name, + host=self.host, + port=self.port, + user=self.user, + password=self.password, + database=self.darabase, ) def test_ingest(self): From 207999ca7c926f5b3fb38d145333d7f9990f5652 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sun, 26 Oct 2025 16:39:46 +0330 Subject: [PATCH 4/4] Some Fix Bug --- src/raglight/embeddings/ollama_embeddings.py | 1 + src/raglight/vectorstore/postgres.py | 51 ++++++++++++++++--- tests/test_config.py | 3 +- .../test_postgres_vector_store.py | 3 +- 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/src/raglight/embeddings/ollama_embeddings.py b/src/raglight/embeddings/ollama_embeddings.py index ad682af..ee4c72a 100644 --- a/src/raglight/embeddings/ollama_embeddings.py +++ b/src/raglight/embeddings/ollama_embeddings.py @@ -40,6 +40,7 @@ def load(self) -> OllamaEmbeddings: OllamaEmbeddings: The loaded Ollama embeddings model. """ return OllamaEmbeddings(model=self.model_name, base_url=self.api_base) + def embed_documents(self, documents: list[str]) -> list[list[float]]: """ Embeds a list of documents using the loaded Ollama embeddings model. diff --git a/src/raglight/vectorstore/postgres.py b/src/raglight/vectorstore/postgres.py index 6dc6668..2223e3d 100644 --- a/src/raglight/vectorstore/postgres.py +++ b/src/raglight/vectorstore/postgres.py @@ -11,6 +11,7 @@ from enum import auto from langchain_postgres import PGVector + class PostgresVS(VectorStore): """ Concrete implementation for PostgresVDB. @@ -29,8 +30,7 @@ def __init__( port: int = Settings.POSTGRES_PORT, database: str = Settings.POSTGRES_DATABASE, user: str = Settings.POSTGRES_USER, - password: str = Settings.POSTGRES_PASSWORD - + password: str = Settings.POSTGRES_PASSWORD, ) -> None: """ Initializes a PostgresVS instance. @@ -44,14 +44,14 @@ def __init__( connection_string = f"postgresql://{user}:{password}@{host}:{port}/{database}" if host and port: - + self.vector_store = PGVector( collection_name=collection_name, connection=connection_string, embeddings=embeddings_model, use_jsonb=True, ) - + self.vector_store_classes = PGVector( collection_name=f"{collection_name}_classes", connection=connection_string, @@ -65,7 +65,6 @@ def __init__( " • Provide both host and port (for PostgresDB), OR\n" " • Provide both user and password (for PostgreDsB).\n" " • Provide exist database (for PostgresDB).\n" - f"Received -> host={host}, port={port}, user={user}, password={'*' * len(password) if password else None}, database={database}" ) @@ -110,6 +109,26 @@ def similarity_search( """ Implements similarity search using the main PostgresDB client. """ + connection_string = f"postgresql://{self.user}:{self.password}@{self.host}:{self.port}/{self.database}" + if collection_name and collection_name != self.vector_store._collection_name: + if self.host and self.port: + vector_store = PGVector( + collection_name=collection_name, + connection=connection_string, + embeddings=self.embeddings_model, + use_jsonb=True, + ) + else: + raise ValueError( + "Invalid configuration for PostgresVS: " + "You must either:\n" + " • Provide both host and port (for PostgresDB), OR\n" + " • Provide both user and password (for PostgreDsB).\n" + " • Provide exist database (for PostgresDB).\n" + f"Received -> host={self.host}, port={self.port}, user={self.user}, password={'*' * len(self.password) if self.password else None}, database={self.database}" + ) + return vector_store.similarity_search(question, k=k, filter=filter) + return self.vector_store.similarity_search(question, k=k, filter=filter) @override @@ -123,4 +142,24 @@ def similarity_search_class( """ Implements similarity search using the dedicated class PostgresDB client. """ - pass \ No newline at end of file + connection_string = f"postgresql://{self.user}:{self.password}@{self.host}:{self.port}/{self.database}" + if collection_name and collection_name != self.vector_store._collection_name: + if self.host and self.port: + vector_store = PGVector( + collection_name=f"{collection_name}_classes", + connection=connection_string, + embeddings=self.embeddings_model, + use_jsonb=True, + ) + else: + raise ValueError( + "Invalid configuration for PostgresVS: " + "You must either:\n" + " • Provide both host and port (for PostgresDB), OR\n" + " • Provide both user and password (for PostgreDsB).\n" + " • Provide exist database (for PostgresDB).\n" + f"Received -> host={self.host}, port={self.port}, user={self.user}, password={'*' * len(self.password) if self.password else None}, database={self.database}" + ) + return vector_store.similarity_search(question, k=k, filter=filter) + + return self.vector_store.similarity_search(question, k=k, filter=filter) diff --git a/tests/test_config.py b/tests/test_config.py index b6f7632..2593f76 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -8,7 +8,8 @@ class TestsConfig: TEST_SYSTEM_PROMPT = "tests/prompts/prompt.txt" COLLECTION_NAME = "grece" # DATA_PATH = "/Users/labess40/Desktop/nutrition/grece" - DATA_PATH = "/home/danesh/Documents/system.out" + DEFAULT_OLLAMA_CLIENT = "http://192.168.1.103:11434" + DATA_PATH = "/home/danesh/Documents/Out" OLLAMA_EMBEDDING_MODEL="nomic-embed-text:v1.5" POSTGRES_HOST = "192.168.1.103" POSTGRES_PORT=5432 diff --git a/tests/tests_vector_store/test_postgres_vector_store.py b/tests/tests_vector_store/test_postgres_vector_store.py index 8f7becc..a7adb57 100644 --- a/tests/tests_vector_store/test_postgres_vector_store.py +++ b/tests/tests_vector_store/test_postgres_vector_store.py @@ -8,6 +8,7 @@ class TestVectorStore(unittest.TestCase): def setUp(self): model_embeddings = TestsConfig.OLLAMA_EMBEDDING_MODEL + ollama_client= TestsConfig.DEFAULT_OLLAMA_CLIENT collection_name = TestsConfig.COLLECTION_NAME self.data_path = TestsConfig.DATA_PATH @@ -17,7 +18,7 @@ def setUp(self): self.user = TestsConfig.POSTGRES_USER self.password = TestsConfig.POSTGRES_PASSWORD - embeddings = OllamaEmbeddingsModel(model_embeddings) + embeddings = OllamaEmbeddingsModel(model_embeddings, api_base=ollama_client) self.store = PostgresVS( embeddings_model=embeddings, collection_name=collection_name,