Fix Runnable Lambda Afunc Repr (#13413)

Otherwise, you get an error when using async functions.


h/t to Chris Ruppelt
This commit is contained in:
William FH 2023-11-15 13:11:42 -08:00 committed by GitHub
parent 1726d5dcdd
commit ba501b27a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -2430,7 +2430,12 @@ class RunnableLambda(Runnable[Input, Output]):
def __repr__(self) -> str:
"""A string representation of this runnable."""
if hasattr(self, "func"):
return f"RunnableLambda({get_lambda_source(self.func) or '...'})"
elif hasattr(self, "afunc"):
return f"RunnableLambda(afunc={get_lambda_source(self.afunc) or '...'})"
else:
return "RunnableLambda(...)"
def _invoke(
self,

File diff suppressed because one or more lines are too long