cannot import name 'ConditionalChain' from 'langchain.chains' #25221
Unanswered
LiuChao888
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The In version 0.2.9, you can use alternative classes or methods that provide similar functionality, such as Here's an example of how you might use from langchain.chains import RunnableLambda
# Define a simple lambda function
def my_lambda(input):
if input == "condition_met":
return "Condition met!"
else:
return "Condition not met."
# Create a RunnableLambda chain
lambda_chain = RunnableLambda(my_lambda)
# Run the chain with an example input
result = lambda_chain.run("condition_met")
print(result) # Output: Condition met! If you need the |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
nothing
Description
I uesd langchain version is 0.2.9, but I can not to import 'ConditionalChain' from 'langchain.chains'
please tell me how can I current import it .and please give me example code to use latest ConditionalChain
thanks
System Info
langchain 0.2.9
Beta Was this translation helpful? Give feedback.
All reactions