antimatter.builders.write_context_rule#

Module Contents#

Classes#

WriteContextClassifierRuleBuilder

Builder class for creating a WriteContextRegexRule

class antimatter.builders.write_context_rule.WriteContextClassifierRuleBuilder#

Builder class for creating a WriteContextRegexRule

add_regex_rule(pattern: str, match_on_key: bool = False) WriteContextClassifierRuleBuilder#

Create a new regex rule builder.

Parameters:
  • pattern – The regex pattern for matching

  • match_on_key – If True, match against the key instead of the field

Returns:

The builder instance

add_llm_config(model: str, prompt: str) WriteContextClassifierRuleBuilder#

Add LLM config to the rule

Parameters:
  • model – The LLM model to use

  • prompt – The prompt to use

Returns:

The builder instance

add_span_tag(name: str, tag_type: str | antimatter.tags.TagType = TagType.Unary, value: str | None = None) WriteContextClassifierRuleBuilder#

The span tag to add when the regex rule matches

Parameters:
  • name – The span tag name

  • tag_type – The span tag type; default ‘unary’

  • value – The span tag value, if the tag_type is not ‘unary’

Returns:

The builder instance

add_capsule_tag(name: str, tag_type: str | antimatter.tags.TagType = TagType.Unary, value: str | None = None) WriteContextClassifierRuleBuilder#

The capsule tag to add when the regex rule matches

Parameters:
  • name – The capsule tag name

  • tag_type – The capsule tag type; default ‘unary’

  • value – The capsule tag value, if the tag_type is not ‘unary’

Returns:

The builder instance

build() antimatter_api.ClassifierRule#

Build the rule.

Returns:

The built rule