Skip to main content
Base classes and interfaces that provide the foundation for all query clause implementations in Superlinked.

NLQCompatible

NLQCompatible()
Helper class that provides a standard way to create an ABC using inheritance for natural language query compatibility.

Inheritance

Inheritance Chain:
  • NLQCompatible
  • ABC

Descendants

Classes that implement NLQ compatibility:
  • NLQCompatibleClauseHandler
  • BaseLooksLikeFilterClause
  • HardFilterClause
  • SimilarFilterClause
  • WeightBySpaceClause

Properties

annotation_by_space_annotation
dict[str, str]
Mapping of space annotations to their corresponding annotation strings.
is_type_mandatory_in_nlq
bool
Whether the type is mandatory in natural language queries.
nlq_annotations
list[NLQAnnotation]
List of natural language query annotations.

Methods

get_allowed_values()

get_allowed_values(param) -> set[ParamInputType]
param
TypedParam | Evaluated[TypedParam]
required
The parameter to get allowed values for.
Returns: set[ParamInputType] - Set of allowed values for the parameter.

set_defaults_for_nlq()

set_defaults_for_nlq() -> Self
Returns: Self - The instance with defaults set for natural language queries.

QueryClause

QueryClause()
Abstract base class for all query clause implementations.

Inheritance

Inheritance Chain:
  • QueryClause
  • ABC

Descendants

All query clause implementations:
  • SingleValueParamQueryClause
  • WeightBySpaceClause

Properties

params
Sequence[TypedParam | Evaluated[TypedParam]]
Sequence of parameters used by this query clause.

Static Methods

get_param()

get_param(typed_param) -> Param
typed_param
TypedParam | Evaluated[TypedParam]
required
The typed parameter to extract the Param from.
Returns: Param - The extracted parameter.

get_typed_param()

get_typed_param(typed_param) -> TypedParam
typed_param
TypedParam | Evaluated[TypedParam]
required
The typed parameter to extract the TypedParam from.
Returns: TypedParam - The extracted typed parameter.

Methods

alter_param_values()

alter_param_values(param_values, is_override_set) -> Self
param_values
Mapping[str, ParamInputType | None]
required
The parameter values to alter.
is_override_set
bool
required
Whether this is an override operation.
Returns: Self - The clause with altered parameter values.

get_altered_knn_search_params()

get_altered_knn_search_params(knn_search_clause_params) -> KNNSearchClauseParams
knn_search_clause_params
KNNSearchClauseParams
required
The KNN search parameters to modify.
Returns: KNNSearchClauseParams - The modified search parameters.

get_altered_metadata_extraction_params()

get_altered_metadata_extraction_params(metadata_extraction_params) -> MetadataExtractionClauseParams
metadata_extraction_params
MetadataExtractionClauseParams
required
The metadata extraction parameters to modify.
Returns: MetadataExtractionClauseParams - The modified metadata extraction parameters.

get_altered_nql_params()

get_altered_nql_params(nlq_clause_params) -> NLQClauseParams
nlq_clause_params
NLQClauseParams
required
The NLQ clause parameters to modify.
Returns: NLQClauseParams - The modified NLQ parameters.

get_altered_query_vector_params()

get_altered_query_vector_params(query_vector_params, index_node_id, query_schema, storage_manager) -> QueryVectorClauseParams
query_vector_params
QueryVectorClauseParams
required
The query vector parameters to modify.
index_node_id
str
required
The index node identifier.
query_schema
IdSchemaObject
required
The schema object for the query.
storage_manager
StorageManager
required
The storage manager instance.
Returns: QueryVectorClauseParams - The modified query vector parameters.

get_default_value_by_param_name()

get_default_value_by_param_name() -> dict[str, Any]
Returns: dict[str, Any] - Mapping of parameter names to their default values.

get_param_value_by_param_name()

get_param_value_by_param_name() -> dict[str, ParamInputType]
Returns: dict[str, ParamInputType] - Mapping of parameter names to their current values.

get_space_weight_param_name_by_space()

get_space_weight_param_name_by_space() -> dict[Space, str]
Returns: dict[Space, str] - Mapping of spaces to their weight parameter names.

get_weight_param_name_by_space()

get_weight_param_name_by_space() -> dict[Space | None, str]
Returns: dict[Space | None, str] - Mapping of spaces (or None) to their weight parameter names.
I