mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-08 18:57:52 +02:00
change[langgraph]: clean up Interrupt interface for v1 (#5405)
This commit is contained in:
@@ -14,7 +14,7 @@ from langchain_core.tools import tool as dec_tool
|
||||
from pydantic import BaseModel, ValidationError
|
||||
from pydantic.v1 import ValidationError as ValidationErrorV1
|
||||
|
||||
from langgraph.errors import NodeInterrupt
|
||||
from langgraph.errors import GraphBubbleUp, GraphInterrupt
|
||||
from langgraph.prebuilt import ToolNode
|
||||
from langgraph.prebuilt.tool_node import TOOL_CALL_ERROR_TEMPLATE
|
||||
from langgraph.types import Command, Send
|
||||
@@ -462,16 +462,16 @@ def test_tool_node_incorrect_tool_name():
|
||||
|
||||
|
||||
def test_tool_node_node_interrupt():
|
||||
def tool_interrupt(some_val: int) -> str:
|
||||
def tool_interrupt(some_val: int) -> None:
|
||||
"""Tool docstring."""
|
||||
raise NodeInterrupt("foo")
|
||||
raise GraphBubbleUp("foo")
|
||||
|
||||
def handle(e: NodeInterrupt):
|
||||
def handle(e: GraphInterrupt):
|
||||
return "handled"
|
||||
|
||||
for handle_tool_errors in (True, (NodeInterrupt,), "handled", handle, False):
|
||||
for handle_tool_errors in (True, (GraphBubbleUp,), "handled", handle, False):
|
||||
node = ToolNode([tool_interrupt], handle_tool_errors=handle_tool_errors)
|
||||
with pytest.raises(NodeInterrupt) as exc_info:
|
||||
with pytest.raises(GraphBubbleUp) as exc_info:
|
||||
node.invoke(
|
||||
{
|
||||
"messages": [
|
||||
|
||||
Reference in New Issue
Block a user