Skip to content

fix the invalid paraments error in last_message model with return direct type tools #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion langgraph_supervisor/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from langchain_core.language_models import BaseChatModel, LanguageModelLike
from langchain_core.runnables import RunnableConfig
from langchain_core.tools import BaseTool
from langchain_core.messages import ToolMessage
from langgraph.graph import END, START, StateGraph
from langgraph.prebuilt import ToolNode
from langgraph.prebuilt.chat_agent_executor import (
Expand Down Expand Up @@ -68,7 +69,10 @@ def _process_output(output: dict) -> dict:
if output_mode == "full_history":
pass
elif output_mode == "last_message":
messages = messages[-1:]
if isinstance(messages[-1], ToolMessage):
messages = messages[-2:]
else:
messages = messages[-1:]

else:
raise ValueError(
Expand Down