A group of filter rules combined with AND logic or with OR logic.
rules can hold other QueryCondition objects, so conditions nest to
express mixed logic such as A and (B or C). Pass a QueryCondition as
the filter argument of get_span_fields() on
Application, which allows at
most 3 levels of nesting and 10 rules.
Example
from fiddler_evals import ( OperatorType, QueryCondition, QueryConditionType, QueryRule,)# LLM spans that either used many tokens or ran on a GPT-4 modelspan_filter = QueryCondition( rules=[ QueryRule( field="Span::span_type", operator=OperatorType.EQUAL, value="llm", ), QueryCondition( condition=QueryConditionType.OR, rules=[ QueryRule( field="SpanAttribute::gen_ai.usage.total_tokens", operator=OperatorType.GREATER, value=4000, ), QueryRule( field="SpanAttribute::gen_ai.request.model", operator=OperatorType.BEGINS_WITH, value="gpt-4", ), ], ), ])
Attributes
QueryConditionType
How rules are combined; defaults to AND.
List[QueryRule | QueryCondition]
Rules and nested conditions to combine.
add_rule()
Add a filter rule.
Parameters
QueryRule | QueryCondition
required
Rule or nested condition to append to rules.
add_rules()
Add multiple filter rules.
Parameters
List[QueryRule | QueryCondition]
required
Rules or nested conditions to append to rules, in order.
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.