patch[langgraph]: Fix hint for invoke/stream to allow for Command and None (#5414)

use Command and None as well
This commit is contained in:
Sydney Runkle
2025-07-09 13:23:28 -04:00
committed by GitHub
parent 1240f8bdca
commit 6eace78c53
2 changed files with 10 additions and 8 deletions
+5 -4
View File
@@ -99,6 +99,7 @@ from langgraph.types import (
All,
CachePolicy,
Checkpointer,
Command,
Interrupt,
Send,
StateSnapshot,
@@ -2342,7 +2343,7 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou
def stream(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
stream_mode: StreamMode | Sequence[StreamMode] | None = None,
@@ -2564,7 +2565,7 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou
async def astream(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
stream_mode: StreamMode | Sequence[StreamMode] | None = None,
@@ -2808,7 +2809,7 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou
def invoke(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
stream_mode: StreamMode = "values",
@@ -2883,7 +2884,7 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou
async def ainvoke(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
stream_mode: StreamMode = "values",
+5 -4
View File
@@ -9,6 +9,7 @@ from langchain_core.runnables.graph import Graph as DrawableGraph
from typing_extensions import Self
from langgraph.pregel.types import All, StateSnapshot, StateUpdate, StreamMode
from langgraph.types import Command
from langgraph.typing import InputT, OutputT, StateT
@@ -98,7 +99,7 @@ class PregelProtocol(Runnable[InputT, Any], Generic[StateT, InputT, OutputT], AB
@abstractmethod
def stream(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
stream_mode: StreamMode | list[StreamMode] | None = None,
@@ -110,7 +111,7 @@ class PregelProtocol(Runnable[InputT, Any], Generic[StateT, InputT, OutputT], AB
@abstractmethod
def astream(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
stream_mode: StreamMode | list[StreamMode] | None = None,
@@ -122,7 +123,7 @@ class PregelProtocol(Runnable[InputT, Any], Generic[StateT, InputT, OutputT], AB
@abstractmethod
def invoke(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
interrupt_before: All | Sequence[str] | None = None,
@@ -132,7 +133,7 @@ class PregelProtocol(Runnable[InputT, Any], Generic[StateT, InputT, OutputT], AB
@abstractmethod
async def ainvoke(
self,
input: InputT,
input: InputT | Command | None,
config: RunnableConfig | None = None,
*,
interrupt_before: All | Sequence[str] | None = None,