Merge branch 'main' into wfh/test_pending_writes_null

This commit is contained in:
William Fu-Hinthorn
2024-07-23 21:28:51 -07:00
5 changed files with 107 additions and 33 deletions
File diff suppressed because one or more lines are too long
+88 -11
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langgraph"
version = "0.1.10"
version = "0.1.11"
description = "Building stateful, multi-actor applications with LLMs"
authors = []
license = "MIT"
+1 -1
View File
@@ -123,7 +123,7 @@ class MemorySaverAssertCheckpointMetadata(MemorySaver):
class MemorySaverNoPending(MemorySaver):
def get_tuple(self, config: RunnableConfig) -> CheckpointTuple | None:
def get_tuple(self, config: RunnableConfig) -> Optional[CheckpointTuple]:
result = super().get_tuple(config)
if result:
return CheckpointTuple(result.config, result.checkpoint, result.metadata)
+7 -10
View File
@@ -1127,19 +1127,19 @@ def test_pending_writes_resume(checkpointer: BaseCheckpointSaver) -> None:
checkpointer.__exit__(None, None, None)
async def test_cond_edge_after_send() -> None:
def test_cond_edge_after_send() -> None:
class Node:
def __init__(self, name: str):
self.name = name
setattr(self, "__name__", name)
async def __call__(self, state):
def __call__(self, state):
return state + [self.name]
async def send_for_fun(state):
def send_for_fun(state):
return [Send("2", state)]
async def route_to_three(state) -> Literal["3"]:
def route_to_three(state) -> Literal["3"]:
return "3"
builder = StateGraph(list)
@@ -1150,13 +1150,10 @@ async def test_cond_edge_after_send() -> None:
builder.add_conditional_edges("1", send_for_fun)
builder.add_conditional_edges("2", route_to_three)
graph = builder.compile()
graph.name = "MyCustomName"
async for event in graph.astream(["0"], debug=1):
print(event)
assert await graph.ainvoke(["0"]) == ["0", "1", "2", "3"]
assert graph.invoke(["0"]) == ["0", "1", "2", "3"]
async def test_conditional_entry() -> None:
async def test_checkpointer_null_pending_writes() -> None:
class Node:
def __init__(self, name: str):
self.name = name
@@ -7553,7 +7550,7 @@ def test_nested_graph(snapshot: SnapshotAssertion) -> None:
assert app.get_graph().draw_mermaid(with_styles=False) == snapshot
assert app.get_graph(xray=True).draw_mermaid() == snapshot
assert app.ainvoke(
assert app.invoke(
{"my_key": "my value", "never_called": never_called}, debug=True
) == {
"my_key": "my value there and back again",