Home / Function/ _convert_to_openai_tool_calls() — langchain Function Reference

_convert_to_openai_tool_calls() — langchain Function Reference

Architecture documentation for the _convert_to_openai_tool_calls() function in utils.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3e3cbfaf_2c0e_1924_ab8e_87598311849e["_convert_to_openai_tool_calls()"]
  0b528c80_0ce7_1c74_8932_bc433bcb03c6["utils.py"]
  3e3cbfaf_2c0e_1924_ab8e_87598311849e -->|defined in| 0b528c80_0ce7_1c74_8932_bc433bcb03c6
  236631e2_af7c_cf93_f815_a72d2cc4db6f["convert_to_openai_messages()"]
  236631e2_af7c_cf93_f815_a72d2cc4db6f -->|calls| 3e3cbfaf_2c0e_1924_ab8e_87598311849e
  style 3e3cbfaf_2c0e_1924_ab8e_87598311849e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/messages/utils.py lines 2172–2183

def _convert_to_openai_tool_calls(tool_calls: list[ToolCall]) -> list[dict]:
    return [
        {
            "type": "function",
            "id": tool_call["id"],
            "function": {
                "name": tool_call["name"],
                "arguments": json.dumps(tool_call["args"], ensure_ascii=False),
            },
        }
        for tool_call in tool_calls
    ]

Subdomains

Frequently Asked Questions

What does _convert_to_openai_tool_calls() do?
_convert_to_openai_tool_calls() is a function in the langchain codebase, defined in libs/core/langchain_core/messages/utils.py.
Where is _convert_to_openai_tool_calls() defined?
_convert_to_openai_tool_calls() is defined in libs/core/langchain_core/messages/utils.py at line 2172.
What calls _convert_to_openai_tool_calls()?
_convert_to_openai_tool_calls() is called by 1 function(s): convert_to_openai_messages.

Analyze Your Own Codebase

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

Try Supermodel Free