Exclude shared

This commit is contained in:
William Fu-Hinthorn
2024-09-06 12:28:33 -07:00
parent 093dab1035
commit e86330ab05
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -781,6 +781,6 @@ def _get_schema(
),
)
for k in schemas[typ]
if isinstance(channels[k], BaseChannel)
if k in channels and isinstance(channels[k], BaseChannel)
},
)
+7
View File
@@ -10,6 +10,7 @@ from pydantic.v1 import BaseModel
from typing_extensions import Annotated, NotRequired, Required, TypedDict
from langgraph.graph.state import StateGraph, _warn_invalid_state_schema
from langgraph.managed.shared_value import SharedValue
class State(BaseModel):
@@ -116,6 +117,9 @@ def test_state_schema_optional_values(total_: bool):
class State(InputState): # this would be ignored
val4: dict
some_shared_channel: Annotated[str, SharedValue.on("assistant_id")] = field(
default="foo"
)
builder = StateGraph(State, input=InputState, output=OutputState)
builder.add_node("n", lambda x: x)
@@ -180,6 +184,9 @@ def test_state_schema_default_values(kw_only_: bool):
val11: Annotated[list[str], "annotated list"] = field(
default_factory=lambda: ["a", "b"]
)
some_shared_channel: Annotated[str, SharedValue.on("assistant_id")] = field(
default="foo"
)
builder = StateGraph(InputState)
builder.add_node("n", lambda x: x)