Skip to content

The agent engineering platform.

chore(core): add note about backward compatibility for `tool_calls` in `additional_kwargs` in `JsonOutputKeyToolsParser`

Mason Daugherty1c55536ec109
diff --git a/libs/core/langchain_core/output_parsers/openai_tools.py b/libs/core/langchain_core/output_parsers/openai_tools.py
index 63495bc2d8..5c2e0cd664 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: