_format_tool_call_for_mistral() — langchain Function Reference
Architecture documentation for the _format_tool_call_for_mistral() function in chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8a6a7033_9f65_cb08_2b61_2a09610d6827["_format_tool_call_for_mistral()"] cfb937d2_ce7f_5338_2b62_6452043ac78a["chat_models.py"] 8a6a7033_9f65_cb08_2b61_2a09610d6827 -->|defined in| cfb937d2_ce7f_5338_2b62_6452043ac78a 0040f7d2_abde_821f_7713_ae3da549425c["_convert_message_to_mistral_chat_message()"] 0040f7d2_abde_821f_7713_ae3da549425c -->|calls| 8a6a7033_9f65_cb08_2b61_2a09610d6827 17458072_b7f3_6bde_1cc2_60c8f77a0cbc["_convert_tool_call_id_to_mistral_compatible()"] 8a6a7033_9f65_cb08_2b61_2a09610d6827 -->|calls| 17458072_b7f3_6bde_1cc2_60c8f77a0cbc style 8a6a7033_9f65_cb08_2b61_2a09610d6827 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/mistralai/langchain_mistralai/chat_models.py lines 329–340
def _format_tool_call_for_mistral(tool_call: ToolCall) -> dict:
"""Format LangChain ToolCall to dict expected by Mistral."""
result: dict[str, Any] = {
"function": {
"name": tool_call["name"],
"arguments": json.dumps(tool_call["args"], ensure_ascii=False),
}
}
if _id := tool_call.get("id"):
result["id"] = _convert_tool_call_id_to_mistral_compatible(_id)
return result
Domain
Subdomains
Source
Frequently Asked Questions
What does _format_tool_call_for_mistral() do?
_format_tool_call_for_mistral() is a function in the langchain codebase, defined in libs/partners/mistralai/langchain_mistralai/chat_models.py.
Where is _format_tool_call_for_mistral() defined?
_format_tool_call_for_mistral() is defined in libs/partners/mistralai/langchain_mistralai/chat_models.py at line 329.
What does _format_tool_call_for_mistral() call?
_format_tool_call_for_mistral() calls 1 function(s): _convert_tool_call_id_to_mistral_compatible.
What calls _format_tool_call_for_mistral()?
_format_tool_call_for_mistral() is called by 1 function(s): _convert_message_to_mistral_chat_message.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free