mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-24 08:32:24 +02:00
Handle edge case
This commit is contained in:
@@ -772,6 +772,8 @@ def create_react_agent(
|
||||
# Define the function that determines whether to continue or not
|
||||
def should_continue(state: StateSchema) -> Union[str, list]:
|
||||
messages = _get_state_value(state, "messages")
|
||||
if not messages:
|
||||
return END
|
||||
last_message = messages[-1]
|
||||
# If there is no function call, then we finish
|
||||
if not isinstance(last_message, AIMessage) or not last_message.tool_calls:
|
||||
|
||||
Reference in New Issue
Block a user