Home / Function/ _base62_encode() — langchain Function Reference

_base62_encode() — langchain Function Reference

Architecture documentation for the _base62_encode() function in chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d0ec03cf_547e_8100_bf3d_7e0f35430e25["_base62_encode()"]
  cfb937d2_ce7f_5338_2b62_6452043ac78a["chat_models.py"]
  d0ec03cf_547e_8100_bf3d_7e0f35430e25 -->|defined in| cfb937d2_ce7f_5338_2b62_6452043ac78a
  17458072_b7f3_6bde_1cc2_60c8f77a0cbc["_convert_tool_call_id_to_mistral_compatible()"]
  17458072_b7f3_6bde_1cc2_60c8f77a0cbc -->|calls| d0ec03cf_547e_8100_bf3d_7e0f35430e25
  style d0ec03cf_547e_8100_bf3d_7e0f35430e25 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/mistralai/langchain_mistralai/chat_models.py lines 118–129

def _base62_encode(num: int) -> str:
    """Encode a number in base62 and ensures result is of a specified length."""
    base62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    if num == 0:
        return base62[0]
    arr = []
    base = len(base62)
    while num:
        num, rem = divmod(num, base)
        arr.append(base62[rem])
    arr.reverse()
    return "".join(arr)

Domain

Subdomains

Frequently Asked Questions

What does _base62_encode() do?
_base62_encode() is a function in the langchain codebase, defined in libs/partners/mistralai/langchain_mistralai/chat_models.py.
Where is _base62_encode() defined?
_base62_encode() is defined in libs/partners/mistralai/langchain_mistralai/chat_models.py at line 118.
What calls _base62_encode()?
_base62_encode() is called by 1 function(s): _convert_tool_call_id_to_mistral_compatible.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free