Reference
Filter Objects
Filter_Objects module utilities and functionality.
IncomingQuery
Represents an incoming query with its components.
Attributes:
Name | Type | Description |
---|---|---|
query | str | The query string. |
operator | str | The operator used in the query. |
exactMatch | bool | Indicates whether the query requires an exact match. |
__init__
Initialize an IncomingQuery object.
Arguments:
Name | Type | Description |
---|---|---|
query | str | The query string. |
operator | str | The operator used in the query. |
exactMatch | bool | Indicates whether the query requires an exact match. |
QueryObject
Represents a query object with its components.
Attributes:
Name | Type | Description |
---|---|---|
id | str | The ID of the query object. |
query | RuleGroupType | The query object. |
parse_incoming_query
Parses an incoming query string into a list of RuleType objects.
Arguments:
Name | Type | Description |
---|---|---|
incomingQuery | str | The incoming query string. |
Returns:
Name | Description |
---|---|
List[[RuleType](/sdk/python/references/models/prompt)] | A list of RuleType objects. |
evaluate_rule_group
Evaluates a rule group against incoming query rules.
Arguments:
Name | Type | Description |
---|---|---|
ruleGroup | RuleGroupType | The rule group to evaluate. |
incomingQueryRules | List[RuleType] | The incoming query rules. |
Returns:
Name | Description |
---|---|
bool | True if the rule group matches, False otherwise. |
check_operator_match
Checks if the operator between two rules matches.
Arguments:
Name | Type | Description |
---|---|---|
fieldRule | RuleType | The rule with the operator. |
fieldIncomingRule | RuleType | The incoming rule. |
Returns:
Name | Description |
---|---|
bool | True if the operator matches, False otherwise. |
condition_met
Checks if the condition between two rules is met.
Arguments:
Name | Type | Description |
---|---|---|
fieldRule | RuleType | The rule with the condition. |
fieldIncomingRule | RuleType | The incoming rule. |
Returns:
Name | Description |
---|---|
bool | True if the condition is met, False otherwise. |
find_best_match
Finds the best match for the incoming query among the list of objects.
Arguments:
Name | Type | Description |
---|---|---|
objects | List[QueryObject] | The list of objects to search through. |
incomingQuery | IncomingQuery | The incoming query to match against. |
Returns:
Name | Description |
---|---|
Optional[[QueryObject](/sdk/python/references/filter_objects)] | The best match for the incoming query, or None if no match is found. |
find_all_matches
Finds all matches for the incoming query among the list of objects.
Arguments:
Name | Type | Description |
---|---|---|
objects | List[QueryObject] | The list of objects to search through. |
incoming_query | IncomingQuery | The incoming query to match against. |
Returns:
Name | Description |
---|---|
List[[QueryObject](/sdk/python/references/filter_objects)] | A list of all matches for the incoming query. |