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. |
hybrid
property
Access hybrid capability if supported.
Returns:
| Name | Type | Description |
|---|---|---|
HybridCapability |
HybridCapability
|
Hybrid capability handler. |
Raises:
| Type | Description |
|---|---|
NotSupportedException
|
If hybrid capability is not supported. |
NotRegisteredException
|
If hybrid capability is not registered. |
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, **kwargs)
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
|
The filter to translate. Can be a single FilterClause or a QueryFilter with multiple clauses. |
required |
**kwargs
|
Additional keyword arguments for the datastore's native filter syntax. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The translated filter in the datastore's native format. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If not implemented by subclass. |
with_encryption(encryptor, fields)
Enable encryption for specified fields.
Encryption works transparently - users don't need to access it directly. It's automatically used by fulltext and vector capabilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
encryptor
|
BaseEncryptor
|
The encryptor instance to use. Must not be None. |
required |
fields
|
set[str] | list[str]
|
Set or list of field names to encrypt. Must not be empty. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
Self for method chaining. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If encryptor is None or fields is empty. |
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_hybrid(config, **kwargs)
Configure hybrid capability and return datastore instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
list[SearchConfig]
|
List of search configurations for hybrid search. |
required |
**kwargs
|
Additional hybrid 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.