Skip to content

Commit

Permalink
updated layout to latest convention
Browse files Browse the repository at this point in the history
  • Loading branch information
sahusiddharth committed Jan 29, 2024
1 parent 14d323e commit 6402ed7
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .retriever import SupabaseEmbeddingRetriever

__all__ = ["SupabaseEmbeddingRetriever"]
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

from haystack import component
from haystack.dataclasses import Document

from src.supabase_haystack.document_store import SupabaseDocumentStore
from haystack_integrations.document_stores.supabase import SupabaseDocumentStore


@component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: 2023-present John Doe <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
from src.supabase_haystack.document_store import SupabaseDocumentStore
from .document_store import SupabaseDocumentStore

__all__ = ["SupabaseDocumentStore"]
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from haystack.document_stores.types import DuplicatePolicy
from haystack.utils.filters import convert

from src.supabase_haystack.filters import _normalize_filters
from .filters import _normalize_filters

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -44,6 +44,7 @@ def __init__(
self.dimension = dimension
self._collection_name = collection_name
self._dummy_vector = [0.0]*dimension
self.collection_creation_kwargs = collection_creation_kwargs
db_connection = f"postgresql://{user}:{password}@{host}:{port}/{db_name}"
self._pgvector_client = vecs.create_client(db_connection)
self._collection = self._pgvector_client.get_or_create_collection(name=collection_name, dimension=dimension, **collection_creation_kwargs)
Expand Down
2 changes: 1 addition & 1 deletion integrations/supabase/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from haystack.document_stores.types import DuplicatePolicy

from src.supabase_haystack.document_store import SupabaseDocumentStore
from src.haystack_integrations.document_stores.supabase import SupabaseDocumentStore

# This is the approximate time it takes for the documents to be available
SLEEP_TIME = 20
Expand Down
4 changes: 2 additions & 2 deletions integrations/supabase/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from haystack.document_stores.types import DocumentStore, DuplicatePolicy
from haystack.testing.document_store import CountDocumentsTest, DeleteDocumentsTest, WriteDocumentsTest

from src.supabase_haystack.document_store import SupabaseDocumentStore
from src.haystack_integrations.document_stores.supabase import SupabaseDocumentStore


class TestDocumentStore(CountDocumentsTest, DeleteDocumentsTest, WriteDocumentsTest):
Expand Down Expand Up @@ -78,7 +78,7 @@ def test_embedding_retrieval(self, document_store: SupabaseDocumentStore):
assert results[0].content == "Most similar document"
assert results[1].content == "2nd best document"

@patch("src.supabase_haystack.document_store.vecs")
@patch("src.haystack_integrations.document_stores.supabase.document_store.vecs")
def test_init(self, mock_supabase):

document_store = SupabaseDocumentStore(
Expand Down

0 comments on commit 6402ed7

Please sign in to comment.