You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
filterblock: Document block behavior in more detail
Update the documentation for the parameters to reflect the updated
types (strings) after the move to yaml based block configuration.
While we're at it, document a list of oeprations that make sense to
use with this block. Also include some examples for cases that warrant
some more detailed examples:
- The `contains` operation only works with strings.
- All operations can take multiple candidates for the right side of
the operation (filter value) and the block will check all of them
and treat the result as True if any are true.
- filter_column operator filter_value
Signed-off-by: Russell Bryant <rbryant@redhat.com>
Copy file name to clipboardExpand all lines: src/instructlab/sdg/filterblock.py
+52-2Lines changed: 52 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -91,11 +91,61 @@ def __init__(
91
91
- block_name (str): An identifier for this block.
92
92
- filter_column (str): The name of the column in the dataset to apply the filter on.
93
93
- filter_value (any or list of any): The value(s) to filter by.
94
-
- operation (callable): A function that takes two arguments (column value and filter value) and returns a boolean indicating whether the row should be included in the filtered dataset.
95
-
- convert_dtype (callable, optional): A function to convert the data type of the filter column before applying the filter. Defaults to None.
94
+
- operation (string): The name of a function provided by the "operator"
95
+
Python package that takes two arguments (column value and filter value)
96
+
and returns a boolean indicating whether the row should be included in
97
+
the filtered dataset.
98
+
- convert_dtype (string, optional): the name of a Python type to convert
99
+
the column values to. Supported values are "int", "float", and "bool".
100
+
Defaults to None.
96
101
97
102
Returns:
98
103
None
104
+
105
+
For supported values of `operation`, see the "operator" package
0 commit comments