Skip to content

Conversation

edmundmills
Copy link

When using pipe and results, I found myself writing things like this repeatedly:

    return pipe(
        previous_result,
        result.bind(partial(parse_to_struct, output_struct=LLMOutput)),
        result.bind(partial(select_chosen_result, search_results=search_results)),
        result.bind(partial(result_to_link_message, trace_metadata=trace_metadata)),
    )

I wrote a helper function to make this a little cleaner, which would allow:

    return pipe(
        previous_result,
        result.bind_with(parse_to_struct, output_struct=LLMOutput),
        result.bind_with(select_chosen_result, search_results=search_results),
        result.bind_with(result_to_link_message, trace_metadata=trace_metadata),
    )

Not sure if this warrants inclusion, but thought I'd share in case it does.

@edmundmills
Copy link
Author

Reading through the issues, I've realized this is addressing the same issue as #214, but for the result world.

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.

1 participant