Skip to content

Base

Base class for capability composition and delegation.

This module defines the BaseDataStore base class that provides capability delegation infrastructure for all datastore implementations.

Authors

Kadek Denaya (kadek.d.r.diana@gdplabs.id)

References

NONE

BaseDataStore()

Bases: ABC

Base class for datastores with multiple capabilities.

This class provides the infrastructure for capability composition and delegation. Datastores inherit from this class and register capability handlers based on their configuration.

Initialize the datastore with specified capabilities.

cache: CacheCapability property

Access cache capability if supported.

Returns:

Name Type Description
CacheCapability CacheCapability

Cache capability handler.

Raises:

Type Description
NotSupportedException

If cache capability is not supported.

fulltext: FulltextCapability property

Access fulltext capability if supported.

Returns:

Name Type Description
FulltextCapability FulltextCapability

Fulltext capability handler.

Raises:

Type Description
NotSupportedException

If fulltext capability is not supported.

graph: GraphCapability property

Access graph capability if supported.

Returns:

Name Type Description
GraphCapability GraphCapability

Graph capability handler.

Raises:

Type Description
NotSupportedException

If graph capability is not supported.

registered_capabilities: list[CapabilityType] property

Return list of currently registered capabilities.

Returns:

Type Description
list[CapabilityType]

list[str]: List of capability names that are registered and available.

supported_capabilities: list[CapabilityType] abstractmethod property

Return list of currently supported capabilities.

A data store might have more capabilities than the ones that are currently registered. Each data store should implement this method to return the list of supported capabilities.

Returns:

Type Description
list[CapabilityType]

list[str]: List of capability names that are supported.

Raises:

Type Description
NotImplementedError

If the method is not implemented by subclass.

vector: VectorCapability property

Access vector capability if supported.

Returns:

Name Type Description
VectorCapability VectorCapability

Vector capability handler.

Raises:

Type Description
NotSupportedException

If vector capability is not supported

with_cache(em_invoker=None, **kwargs)

Configure cache capability and return datastore instance.

Parameters:

Name Type Description Default
em_invoker BaseEMInvoker | None

Embedding model invoker. Defaults to None, in which case semantic matching is not available.

None
**kwargs

Cache capability configuration parameters.

{}

Returns:

Name Type Description
Self Self

Self for method chaining.

with_fulltext(**kwargs)

Configure fulltext capability and return datastore instance.

Parameters:

Name Type Description Default
**kwargs

Fulltext capability configuration parameters.

{}

Returns:

Name Type Description
Self Self

Self for method chaining.

with_graph(**kwargs)

Configure graph capability and return datastore instance.

Parameters:

Name Type Description Default
**kwargs

Graph capability configuration parameters.

{}

Returns:

Name Type Description
Self Self

Self for method chaining.

with_vector(em_invoker, **kwargs)

Configure vector capability and return datastore instance.

Parameters:

Name Type Description Default
em_invoker BaseEMInvoker

Embedding model invoker (required).

required
**kwargs

Vector capability configuration parameters.

{}

Returns:

Name Type Description
Self Self

Self for method chaining.

CapabilityType

Bases: StrEnum

Enumeration of supported capability types.