Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access intermediary step results #168

Open
b0xtch opened this issue Jun 29, 2023 · 2 comments
Open

Access intermediary step results #168

b0xtch opened this issue Jun 29, 2023 · 2 comments

Comments

@b0xtch
Copy link

b0xtch commented Jun 29, 2023

Having the ability to access the result of intermediary results, for example in a sequential chain having the ability to access {{text}}.

    let chain: Chain = Chain::new(vec![
        // First step: make a personalized birthday email
        Step::for_prompt_template(
            prompt!("You are a bot for making personalized greetings", "Make personalized birthday e-mail to the whole company for {{name}} who has their birthday on {{date}}. Include their name")
        ),

        // Second step: summarize the email into a tweet. Importantly, the text parameter becomes the result of the previous prompt.
        Step::for_prompt_template(
            prompt!( "You are an assistant for managing social media accounts for a company", "Summarize this email into a tweet to be sent by the company, use emoji if you can. \n--\n{{text}}")
        )
    ]);

Maybe its possible and I am missing something, feel free to close if that's the case.

@ppppqp
Copy link

ppppqp commented Jul 26, 2023

Maybe we can add hooks to a Step so that the user can react to the input and output for theStep. I am thinking about adding the before and after hooks. In the before hook the user can get the input and in the after hook the user can get the output from the Step. The executor will run those hooks on execution. This will make Chain more flexible & observable & easy to debug. It also makes it possible to modify the intermediate values based on their needs.

If we agree on this, I can start working on it.

@b0xtch
Copy link
Author

b0xtch commented Jul 26, 2023

Maybe we can add hooks to a Step so that the user can react to the input and output for theStep. I am thinking about adding the before and after hooks. In the before hook the user can get the input and in the after hook the user can get the output from the Step. The executor will run those hooks on execution. This will make Chain more flexible & observable & easy to debug. It also makes it possible to modify the intermediate values based on their needs.

If we agree on this, I can start working on it.

Sounds like a great plan. Hooks is a great way to solve it. Being able to observe and use step_n is very helpful as it prevents having to run a completely different step to get that result, costing more.

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

No branches or pull requests

2 participants