Base
Base class for capability composition and delegation.
This module defines the BaseDataStore base class that provides capability delegation infrastructure for all datastore implementations.
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.
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 |
as_cache(eviction_manager=None, matching_strategy=None)
Create a Cache instance from this datastore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eviction_manager |
Any | None
|
Optional eviction manager for cache eviction. Defaults to None. |
None
|
matching_strategy |
Any
|
Default matching strategy for cache retrieval. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Cache |
Cache
|
Instance wrapping this datastore. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If required capabilities not registered. |
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.