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
SequentialChain does not feed output/input variables #1866
Comments
To address the issue of the Here's a general approach to configure the mappings: from langchain.sequential import SequentialChain
# Assuming chain1's output needs to be chain2's input
sequential_chain = SequentialChain(components=[chain1, chain2])
sequential_chain.set_input_mapping({
"chain2_input_key": "chain1_output_key" # Map chain1's output to chain2's input
})
sequential_chain.set_output_mapping({
"final_output": "chain2_output_key" # Map chain2's output to a final output key
})
# Execute the sequential chain with initial input
result = sequential_chain.invoke({"chain1_input_key": initial_input_value}) Replace This setup should resolve the error message indicating missing input keys by ensuring that the output from the first chain is correctly passed as input to the second chain. If you continue to face issues, it might be worth reviewing the handling of input and output keys within your chains to ensure they align with the expected configurations.
|
@dosu It doesnt work as intended, now i get this error message: |
It appears there was a misunderstanding regarding the functionality provided by the Here's a step-by-step guide to manually handle the output from the first chain and use it as input for the second:
This approach requires you to explicitly manage the output and input keys, ensuring that the output from the first chain is correctly formatted and passed as the expected input for the second chain. Without specific details on how your
|
@ogabrielluiz could you take a look at this? I'm not sure how to proceed since its just standard components... |
Hello Everyone,
I am trying to connect two LLM chains sequentially.
The first one outputs chain1_result.
The second one expects chain1_result as a input.
I've included one SequentialChain component, linking the two chains.
The flow builds succesfully, but when i try to run the chat, it show the message 'Error: Missing some input keys: {'chain1_result'}'
Is there something that i'm missing?
The text was updated successfully, but these errors were encountered: