prompting.validators.criteria
#
Module Contents#
Classes#
Abstract base class for defining task-specific evaluation criteria. |
|
Create a collection of name/value pairs. |
|
Abstract base class for defining task-specific evaluation criteria. |
|
Create a collection of name/value pairs. |
|
Abstract base class for defining task-specific evaluation criteria. |
|
Abstract base class for defining task-specific evaluation criteria. |
|
Create a collection of name/value pairs. |
|
Abstract base class for defining task-specific evaluation criteria. |
- class prompting.validators.criteria.TaskCriterion#
Bases:
abc.ABC
Abstract base class for defining task-specific evaluation criteria.
- Returns:
Tensor containing the penalty values for each response.
- Return type:
torch.FloatTensor
- class prompting.validators.criteria.TextLengthUnitEnum(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- CHARACTERS = 'characters'#
- WORDS = 'words'#
- SENTENCES = 'sentences'#
- PARAGRAPHS = 'paragraphs'#
- class prompting.validators.criteria.MatchLengthCriteria#
Bases:
TaskCriterion
Abstract base class for defining task-specific evaluation criteria.
- Returns:
Tensor containing the penalty values for each response.
- Return type:
torch.FloatTensor
- unit: TextLengthUnitEnum#
- _count_sentences(text)#
- class prompting.validators.criteria.ContentMatchTypeEnum(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- STARTS_WITH = 'starts with'#
- ENDS_WITH = 'ends with'#
- INCLUDES = 'includes'#
- class prompting.validators.criteria.MatchContentCriteria#
Bases:
TaskCriterion
Abstract base class for defining task-specific evaluation criteria.
- Returns:
Tensor containing the penalty values for each response.
- Return type:
torch.FloatTensor
- contentMatchType: ContentMatchTypeEnum#
- __post_init__()#
- _get_regex_pattern()#
- class prompting.validators.criteria.SimpleResponseLayoutCriteria#
Bases:
TaskCriterion
Abstract base class for defining task-specific evaluation criteria.
- Returns:
Tensor containing the penalty values for each response.
- Return type:
torch.FloatTensor
- class prompting.validators.criteria.LayoutMatchTypeEnum(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- UNORDERED_LIST = 'unordered list'#
- NUMBERED_LIST = 'numbered list'#
- class prompting.validators.criteria.MatchLayoutCriteria#
Bases:
TaskCriterion
Abstract base class for defining task-specific evaluation criteria.
- Returns:
Tensor containing the penalty values for each response.
- Return type:
torch.FloatTensor
- layout_type: LayoutMatchTypeEnum#