Skip to content

In the astream_log() method, you cannot use the bind method with RunnableLambda. #16446

Answered by dosubot bot
jason1315 asked this question in Q&A
Discussion options

You must be logged in to vote

🤖

The error you're encountering is due to the way the bind method is designed to work with RunnableLambda. The bind method is used to bind arguments to the function encapsulated by the RunnableLambda instance. However, the astream_log({}) method is not a function encapsulated by a RunnableLambda instance, but a method of the RunnableLambda class itself.

Here's an example of how to use the bind method correctly:

from langchain_core.runnables import RunnableLambda

def add(x: int, y: int) -> int:
    return x + y

runnable = RunnableLambda(add)
bound_runnable = runnable.bind(y=1)

print(bound_runnable.invoke(2))  # returns 3

In this example, the bind method is used to bind the argument y=1

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@jason1315
Comment options

Comment options

You must be logged in to vote
1 reply
@jason1315
Comment options

Answer selected by efriis
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
01 bug Confirmed bug
4 participants