Reasoning
Reasoning
dataclass
¶
Source code in flexeval/core/reasoning_parser/base.py
7 8 9 10 | |
ReasoningParser ¶
Base class for parsing raw LLM output text into reasoning and content parts.
Subclasses must implement __call__, which receives the raw text and returns
an instance of Reasoning class.
Source code in flexeval/core/reasoning_parser/base.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
__call__
abstractmethod
¶
__call__(raw_text: str) -> Reasoning
Parse raw LLM output and return the reasoning and content parts.
Parameters:
-
raw_text(str) –Raw output string produced by the language model.
Returns:
-
Reasoning–An instance of
Reasoningclass.
Source code in flexeval/core/reasoning_parser/base.py
20 21 22 23 24 25 26 27 28 29 30 | |
SeparatedRegexReasoningParser ¶
Extracts reasoning and content using two independent regex patterns.
Each pattern is applied separately. If a pattern has a capture group, the last group is used; otherwise the full match is used.
Source code in flexeval/core/reasoning_parser/regex_reasoning_parser.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
pattern_for_reasoning_content
instance-attribute
¶
pattern_for_reasoning_content = compile(
pattern_for_reasoning_content, DOTALL
)
__init__ ¶
__init__(
pattern_for_content: str,
pattern_for_reasoning_content: str,
) -> None
Source code in flexeval/core/reasoning_parser/regex_reasoning_parser.py
35 36 37 38 39 40 41 42 | |
__call__ ¶
__call__(raw_text: str) -> Reasoning
Source code in flexeval/core/reasoning_parser/regex_reasoning_parser.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
UnifiedRegexReasoningParser ¶
Extracts reasoning and content using a single regex with named groups.
The pattern must contain named groups (?P<reasoning_content>...) and/or
(?P<content>...) to populate the corresponding fields of :class:Reasoning.
Source code in flexeval/core/reasoning_parser/regex_reasoning_parser.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
__init__ ¶
__init__(pattern: str) -> None
Source code in flexeval/core/reasoning_parser/regex_reasoning_parser.py
13 14 15 | |
__call__ ¶
__call__(raw_text: str) -> Reasoning
Source code in flexeval/core/reasoning_parser/regex_reasoning_parser.py
17 18 19 20 21 22 23 24 25 | |