The Smart Rules module provides functionality for creating and working with smart rules (UniqueQL queries) to filter and search content in the knowledge base.
Smart rules allow you to create complex queries using UniqueQL to filter and search content. They act as conditionals to reduce the amount of retrieved information by evaluating metadata of documents.
classBaseStatement(BaseModel):model_config=ConfigDict(serialize_by_alias=True)defwith_variables(self,user_metadata:Mapping[str,Union[str,int,bool]],tool_parameters:Mapping[str,Union[str,int,bool]],)->Self:returnself._fill_in_variables(user_metadata,tool_parameters)defis_compiled(self)->bool:# Serialize the object to json stringjson_str=self.model_dump_json()# Check if the json string has <T> or <T+> or <T-> or <toolParameters or <userMetadatareturn("<T>"injson_stror"<T+"injson_stror"<T-"injson_stror"<toolParameters"injson_stror"<userMetadata"injson_str)def_fill_in_variables(self,user_metadata:Mapping[str,Union[str,int,bool]],tool_parameters:Mapping[str,Union[str,int,bool]],)->Self:returnself.model_copy()