Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: test(early implementation): add abstract test class for vector stores with local and… #2815

Closed
wants to merge 25 commits into from
Closed

DRAFT: test(early implementation): add abstract test class for vector stores with local and… #2815

wants to merge 25 commits into from

Conversation

sergerdn
Copy link
Contributor

@sergerdn sergerdn commented Apr 13, 2023

DRAFT

There have been no changes made to the current functionality of the tests or anything else. The only addition I've made is a draft for the future implementation of testing vector stores to ensure that they are thoroughly tested.

I've created the AbstractVectorStoreTestLocal class to test vector stores that can be either local with a persistent database on a file system or stored in memory.

Fix #2491

Also take a look #2816

@sergerdn sergerdn changed the title feat(draft): add abstract test class for vector stores with local and… test(early implementation): add abstract test class for vector stores with local and… Apr 13, 2023
@sergerdn sergerdn marked this pull request as ready for review April 13, 2023 08:20
@sergerdn
Copy link
Contributor Author

@hwchase17

I am ready for review.

Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think would be helpful to see this implement for 1 or 2 vectorstores, to see if abstractions are correct or not

i also wonder if this could just be a bunch of tests, parameterized by a list of vectorstore classes. eg does each vectorstore need its own testing class, or should we just one one testing function for semantic search, which is called in a loop on all vectorstores

tests/integration_tests/vectorstores/basic.py Outdated Show resolved Hide resolved
@sergerdn
Copy link
Contributor Author

sergerdn commented Apr 14, 2023

i think would be helpful to see this implement for 1 or 2 vectorstores, to see if abstractions are correct or not

Agree.

i also wonder if this could just be a bunch of tests, parameterized by a list of vectorstore classes. eg does each vectorstore need its own testing class, or should we just one one testing function for semantic search, which is called in a loop on all vectorstores

An abstract class and another class are being used for testing. All TestVectorStore classes inherit from both classes, but only for specific preparatory tasks. I want to simplify this while ensuring that it's done correctly.

In any case, I believe that we only need one class to handle all the necessary work.

I am thinking about something like this:

class BaseVectorStoreTest(AbstractVectorStoreTest, ABC):
    """Doing all hard work here"""
    vector_store_class: Type[VectorStore]


class TestChromaRemote(AbstractVectorStoreTestRemote, BaseVectorStoreTest, ABC):
    vector_store_class = Chroma


  def setup_class(self) -> None:
      """Prepare the test environment to connect to the vector store"""


class TestChromaLocal(AbstractVectorStoreTestLocal, BaseVectorStoreTest, ABC):
    vector_store_class = Chroma

    def setup_class(self,db_store_dir) -> None:
        """Prepare the test environment to prepare local DB for the vector store"""

@sergerdn sergerdn marked this pull request as draft April 14, 2023 06:13
@sergerdn sergerdn changed the title test(early implementation): add abstract test class for vector stores with local and… DRAFT: test(early implementation): add abstract test class for vector stores with local and… Apr 14, 2023
@sergerdn
Copy link
Contributor Author

sergerdn commented Apr 14, 2023

I have decided to move the new tests to a new directory. I believe that this will make it easier for me and anyone else to work with them. I am not sure that I will be able to implement tests for all vector stores at this moment. Once all the work is finished (all tests will be implemented with new api), the old directory can be removed.

If someone decides to change some tests during my work, we won't have a merge conflict in this case.

I want to make it as much better as I can, it needs more time for thinking rather than realisation.

If anyone, including you, has some good ideas for me, it will help me very much.

@sergerdn
Copy link
Contributor Author

sergerdn commented Apr 14, 2023

@hwchase17

I am ready for a review, but I haven't finished yet. I would appreciate some feedback from you.

@sergerdn
Copy link
Contributor Author

pytest-dev/pyfakefs#813

@dosubot dosubot bot added Ɑ: vector store Related to vector store module 🤖:improvement Medium size change to existing code to handle new use-cases labels Jul 14, 2023
@leo-gan
Copy link
Collaborator

leo-gan commented Sep 13, 2023

@sergerdn Hi , could you, please, resolve the merging issues and address the last comments (if needed)? After that ping me and I push this PR for the review. Thanks!

If this PR is not needed anymore, could you, please, let me know?

@sergerdn sergerdn closed this by deleting the head repository Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases Ɑ: vector store Related to vector store module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error while loading saved index in chroma db
4 participants