Runnable Lamdba type signatures more validation #4

Open
opened 2026-02-16 00:18:02 -05:00 by yindo · 1 comment
Owner

Originally created by @eyurtsev on GitHub (Oct 20, 2023).

Invalid type signatures on the function used for runnable lambda lead to errors that are difficult to understand:

    async def raise_error(input_: int) -> None: # <-- Issue due to None
        """Raise an error."""
        raise ValueError("This is a server side error.")

    add_routes(app, RunnableLambda(raise_error))

    # Invoke request
    async with get_async_client(app) as runnable:
        assert await runnable.ainvoke(1)

Also argumentless:

    async def raise_error() -> None:
        """Raise an error."""
        raise ValueError("This is a server side error.")
Originally created by @eyurtsev on GitHub (Oct 20, 2023). Invalid type signatures on the function used for runnable lambda lead to errors that are difficult to understand: ```python async def raise_error(input_: int) -> None: # <-- Issue due to None """Raise an error.""" raise ValueError("This is a server side error.") add_routes(app, RunnableLambda(raise_error)) # Invoke request async with get_async_client(app) as runnable: assert await runnable.ainvoke(1) ``` Also argumentless: ```python async def raise_error() -> None: """Raise an error.""" raise ValueError("This is a server side error.") ```
Author
Owner

@eyurtsev commented on GitHub (Oct 20, 2023):

cc @nfcampos keeping track of here in the meantime

@eyurtsev commented on GitHub (Oct 20, 2023): cc @nfcampos keeping track of here in the meantime
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langserve#4