haive.core.engine.vectorstore.base¶

Base vector store configuration for the Haive framework.

This module provides the base configuration class and registration system for vector stores, following the same pattern as the retriever configurations.

Classes¶

BaseVectorStoreConfig

Base configuration for all vector store implementations.

Module Contents¶

class haive.core.engine.vectorstore.base.BaseVectorStoreConfig[source]¶

Bases: haive.core.engine.base.InvokableEngine

Base configuration for all vector store implementations.

This class provides the common interface and registration mechanism for vector store configurations in the Haive framework. All vector store configurations should extend this class and implement the required methods.

The registration system allows vector stores to be automatically discovered and instantiated based on their type, providing a consistent interface across all vector store implementations.

engine_type¶

The type of engine (always VECTOR_STORE).

Type:

EngineType

embedding¶

Configuration for the embedding model.

Type:

BaseEmbeddingConfig

collection_name¶

Name of the collection/index in the vector store.

Type:

str

Examples

>>> from haive.core.engine.vectorstore.base import BaseVectorStoreConfig
>>> from haive.core.engine.vectorstore.types import VectorStoreType
>>>
>>> @BaseVectorStoreConfig.register(VectorStoreType.CUSTOM)
>>> class CustomVectorStoreConfig(BaseVectorStoreConfig):
...     def instantiate(self):
...         # Implementation
...         pass
create_runnable(runnable_config=None)[source]¶

Create a runnable vector store instance.

This method is required by InvokableEngine and delegates to instantiate().

Parameters:

runnable_config (dict[str, Any] | None) – Optional runtime configuration (not used for vector stores).

Returns:

An instantiated vector store.

Return type:

VectorStore

classmethod get_config_class(vector_store_type)[source]¶

Get a registered vector store configuration class by type.

Parameters:

vector_store_type (str | Any) – The type identifier for the vector store.

Returns:

The registered configuration class, or None if not found.

Return type:

type[BaseVectorStoreConfig] | None

get_input_fields()[source]¶

Return input field definitions for vector stores.

Default implementation for adding documents to vector stores. Subclasses can override this if they have different input requirements.

Returns:

Dictionary mapping field names to (type, default) tuples.

Return type:

dict[str, tuple[type, Any]]

get_output_fields()[source]¶

Return output field definitions for vector stores.

Default implementation returns document IDs. Subclasses can override this if they have different output types.

Returns:

Dictionary mapping field names to (type, default) tuples.

Return type:

dict[str, tuple[type, Any]]

abstractmethod instantiate()[source]¶

Create a vector store instance from this configuration.

This method must be implemented by all vector store configurations to create the actual vector store instance with the configured parameters.

Returns:

An instantiated vector store ready for use.

Return type:

VectorStore

Raises:

NotImplementedError – If not implemented by subclass.

classmethod list_registered_types()[source]¶

List all registered vector store types.

Returns:

List of registered type identifiers.

Return type:

list[str]

classmethod register(vector_store_type)[source]¶

Register a vector store configuration class.

This decorator registers a vector store configuration class with a specific type, allowing it to be automatically discovered and instantiated.

Parameters:

vector_store_type (str | Any) – The type identifier for the vector store.

Returns:

Decorator function that registers the class.

Return type:

Any

Examples

>>> @BaseVectorStoreConfig.register("custom")
>>> class CustomVectorStoreConfig(BaseVectorStoreConfig):
...     pass
validate_embedding()[source]¶

Validate that the embedding configuration is properly set.

Raises:

ValueError – If embedding is not configured.

Return type:

None