langserve icon indicating copy to clipboard operation
langserve copied to clipboard

`InvokeRequestShallowValidator` prevents LangGraph continuing execution after interrupt

Open riyavsinha opened this issue 1 year ago • 0 comments

After interrupting execution of a Runnable graph, Langgraph requires reinvoking stream with input=None:

for event in app.stream(None, config, stream_mode="values"):
    event["messages"][-1].pretty_print()

LangServe does not support this, though, because of the non-optional "input" in the InvokeRequestShallowValidator.

class InvokeRequestShallowValidator(BaseModel):
    """Shallow validator for Invoke Request.

    Validate basic shape of invoke request, downstream code
    is expected to do further validation.
    """

    input: Any = Field(..., description="The input to the runnable.")
    config: Optional[Dict[str, Any]] = Field(default_factory=dict)

Would it be ok to open a PR to modify this and make it optional? Or are there any other suggested workarounds?

riyavsinha avatar Jul 03 '24 09:07 riyavsinha