src.llm.pattern_detection.pattern_utils.load_patterns(yaml_path)
Load tool call patterns from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
yaml_path
|
str
|
Path to the YAML file containing patterns |
required |
Returns:
Type | Description |
---|---|
Dict[str, str]
|
Dictionary mapping pattern names to pattern strings |
Source code in src/llm/pattern_detection/pattern_utils.py
7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
src.llm.pattern_detection.pattern_utils.normalize_and_map(text)
Returns a tuple of normalized text with whitespace removed and an index mapping.
Processes the input text by removing all whitespace characters and creating a mapping that tracks the original position of each character.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The input string to be normalized. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
A tuple containing two elements:
|
Example usage
normalize_and_map("a b c") # ('abc', [0, 2, 4])
Source code in src/llm/pattern_detection/pattern_utils.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|