From 1c55536ec1097043c0b7209f79e711b89f76a06b Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Mon, 25 Aug 2025 10:30:41 -0400 Subject: [PATCH] chore(core): add note about backward compatibility for `tool_calls` in `additional_kwargs` in `JsonOutputKeyToolsParser` --- libs/core/langchain_core/output_parsers/openai_tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/core/langchain_core/output_parsers/openai_tools.py b/libs/core/langchain_core/output_parsers/openai_tools.py index 63495bc2d84..5c2e0cd6644 100644 --- a/libs/core/langchain_core/output_parsers/openai_tools.py +++ b/libs/core/langchain_core/output_parsers/openai_tools.py @@ -246,6 +246,8 @@ class JsonOutputKeyToolsParser(JsonOutputToolsParser): _ = tool_call.pop("id") else: try: + # This exists purely for backward compatibility / cached messages + # All new messages should use `message.tool_calls` raw_tool_calls = copy.deepcopy(message.additional_kwargs["tool_calls"]) except KeyError: if self.first_tool_only: