From c2f1d022a2e55dfddd313e54d01250d3f64c6eb2 Mon Sep 17 00:00:00 2001 From: ccurme Date: Fri, 29 Nov 2024 08:56:06 -0500 Subject: [PATCH] mistral[patch]: ensure tool call IDs in tool messages are correctly formatted (#28422) Fixes tests for cross-provider compatibility: https://github.com/langchain-ai/langchain/actions/runs/12085358877/job/33702420504#step:10:376 --- libs/partners/mistralai/langchain_mistralai/chat_models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/partners/mistralai/langchain_mistralai/chat_models.py b/libs/partners/mistralai/langchain_mistralai/chat_models.py index 85924a714543c..aed0f70542786 100644 --- a/libs/partners/mistralai/langchain_mistralai/chat_models.py +++ b/libs/partners/mistralai/langchain_mistralai/chat_models.py @@ -353,7 +353,9 @@ def _convert_message_to_mistral_chat_message( "role": "tool", "content": message.content, "name": message.name, - "tool_call_id": message.tool_call_id, + "tool_call_id": _convert_tool_call_id_to_mistral_compatible( + message.tool_call_id + ), } else: raise ValueError(f"Got unknown type {message}")