_convert_tool_call_id_to_mistral_compatible() — langchain Function Reference
Architecture documentation for the _convert_tool_call_id_to_mistral_compatible() function in chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 17458072_b7f3_6bde_1cc2_60c8f77a0cbc["_convert_tool_call_id_to_mistral_compatible()"] cfb937d2_ce7f_5338_2b62_6452043ac78a["chat_models.py"] 17458072_b7f3_6bde_1cc2_60c8f77a0cbc -->|defined in| cfb937d2_ce7f_5338_2b62_6452043ac78a 8a6a7033_9f65_cb08_2b61_2a09610d6827["_format_tool_call_for_mistral()"] 8a6a7033_9f65_cb08_2b61_2a09610d6827 -->|calls| 17458072_b7f3_6bde_1cc2_60c8f77a0cbc 34daee73_1fe3_5f5c_3bef_81e1aa38b91f["_format_invalid_tool_call_for_mistral()"] 34daee73_1fe3_5f5c_3bef_81e1aa38b91f -->|calls| 17458072_b7f3_6bde_1cc2_60c8f77a0cbc 0040f7d2_abde_821f_7713_ae3da549425c["_convert_message_to_mistral_chat_message()"] 0040f7d2_abde_821f_7713_ae3da549425c -->|calls| 17458072_b7f3_6bde_1cc2_60c8f77a0cbc 76bc7ada_a973_1a8c_e8b0_7b26594a42d3["_is_valid_mistral_tool_call_id()"] 17458072_b7f3_6bde_1cc2_60c8f77a0cbc -->|calls| 76bc7ada_a973_1a8c_e8b0_7b26594a42d3 d0ec03cf_547e_8100_bf3d_7e0f35430e25["_base62_encode()"] 17458072_b7f3_6bde_1cc2_60c8f77a0cbc -->|calls| d0ec03cf_547e_8100_bf3d_7e0f35430e25 style 17458072_b7f3_6bde_1cc2_60c8f77a0cbc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/mistralai/langchain_mistralai/chat_models.py lines 132–141
def _convert_tool_call_id_to_mistral_compatible(tool_call_id: str) -> str:
"""Convert a tool call ID to a Mistral-compatible format."""
if _is_valid_mistral_tool_call_id(tool_call_id):
return tool_call_id
hash_bytes = hashlib.sha256(tool_call_id.encode()).digest()
hash_int = int.from_bytes(hash_bytes, byteorder="big")
base62_str = _base62_encode(hash_int)
if len(base62_str) >= 9:
return base62_str[:9]
return base62_str.rjust(9, "0")
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _convert_tool_call_id_to_mistral_compatible() do?
_convert_tool_call_id_to_mistral_compatible() is a function in the langchain codebase, defined in libs/partners/mistralai/langchain_mistralai/chat_models.py.
Where is _convert_tool_call_id_to_mistral_compatible() defined?
_convert_tool_call_id_to_mistral_compatible() is defined in libs/partners/mistralai/langchain_mistralai/chat_models.py at line 132.
What does _convert_tool_call_id_to_mistral_compatible() call?
_convert_tool_call_id_to_mistral_compatible() calls 2 function(s): _base62_encode, _is_valid_mistral_tool_call_id.
What calls _convert_tool_call_id_to_mistral_compatible()?
_convert_tool_call_id_to_mistral_compatible() is called by 3 function(s): _convert_message_to_mistral_chat_message, _format_invalid_tool_call_for_mistral, _format_tool_call_for_mistral.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free