Skip to content

Conversation

elronbandel
Copy link
Member

If you cannot find operators fit to your needs simply use function to modify every instance in the data:

        def my_function(instance, stream_name=None):
            instance["x"] += 42
            return instance

Or a function that modify the entire stream:

        def my_other_function(stream, stream_name=None):
            for instance in stream:
                instance["x"] += 42
                yield instance

Both functions can be plugged in every place in unitxt requires operators, e.g pre-processing pipeline.

except (OSError, TypeError):
# If source is not available
return [f"<function {d.__name__} (source unavailable)>"]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice, this is how the result looks at the catalog:

image

@dafnapension dafnapension force-pushed the function-operators branch 19 times, most recently from c35a903 to ca55da9 Compare July 22, 2025 19:01
@dafnapension dafnapension force-pushed the function-operators branch 5 times, most recently from 890a5c3 to 9307cf1 Compare August 4, 2025 22:42
@dafnapension dafnapension force-pushed the function-operators branch 3 times, most recently from f9912f8 to a413f67 Compare August 14, 2025 13:04
@IBM IBM deleted a comment from elronbandel Aug 14, 2025
elronbandel and others added 9 commits August 29, 2025 18:00
Signed-off-by: elronbandel <[email protected]>
…now read through the whole recipe output

Signed-off-by: dafnapension <[email protected]>
…lam -- were already comitted to main, and now live with the general schema fixer operator, so removed the one tailored for tools

Signed-off-by: dafnapension <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants