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
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
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
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
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
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. |
translate_query_filter(query_filter)
classmethod
Translate QueryFilter or FilterClause to datastore's native filter syntax.
This method provides a public interface for converting the GLLM DataStore's QueryFilter DSL into each datastore's native filter format. Subclasses must implement this method to provide their specific translation logic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query_filter
|
FilterClause | QueryFilter | None
|
The filter to translate. Can be a single FilterClause, a QueryFilter with multiple clauses, or None for empty filters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The translated filter in the datastore's native format. Returns None for empty filters. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If not implemented by subclass. |
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.