Vector_store

This module contains functionality related to the the vector_store module for embedding.vector_stores.chroma.

Vector_store

ChromaVectorStoreFactory

Bases: SingletonFactory

Factory for creating configured Chroma vector stores.

This singleton factory creates and manages ChromaVectorStore instances based on the provided configuration. It ensures that only one instance is created for each unique configuration.

Source code in src/embedding/vector_stores/chroma/vector_store.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class ChromaVectorStoreFactory(SingletonFactory):
    """Factory for creating configured Chroma vector stores.

    This singleton factory creates and manages ChromaVectorStore instances
    based on the provided configuration. It ensures that only one instance
    is created for each unique configuration.
    """

    _configuration_class: Type = ChromaVectorStoreConfiguration

    @classmethod
    def _create_instance(
        cls, configuration: ChromaVectorStoreConfiguration
    ) -> ChromaVectorStore:
        """Creates a Chroma vector store based on provided configuration.

        Args:
            configuration: Chroma vector store connection configuration
                containing host, port, and collection name.

        Returns:
            ChromaVectorStore: Configured Chroma vector store instance.
        """
        return ChromaVectorStore(
            host=configuration.host,
            port=str(configuration.port),
            collection_name=configuration.collection_name,
        )