From c249152fadf57bb08ebf3864bc02c5578b8c260c Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Fri, 31 Oct 2025 13:46:49 -0400 Subject: [PATCH] feat(models): tool calling flow diagram --- src/oss/langchain/models.mdx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/oss/langchain/models.mdx b/src/oss/langchain/models.mdx index 11a9dc177..afe6df8e1 100644 --- a/src/oss/langchain/models.mdx +++ b/src/oss/langchain/models.mdx @@ -523,6 +523,31 @@ Models can request to call tools that perform tasks such as fetching data from a You may hear the term "function calling". We use this interchangeably with "tool calling". +Here's the basic tool calling flow: + +```mermaid +sequenceDiagram + participant U as User + participant M as Model + participant T as Tools + + U->>M: "What's the weather in SF and NYC?" + M->>M: Analyze request & decide tools needed + + par Parallel Tool Calls + M->>T: get_weather("San Francisco") + M->>T: get_weather("New York") + end + + par Tool Execution + T-->>M: SF weather data + T-->>M: NYC weather data + end + + M->>M: Process results & generate response + M->>U: "SF: 72°F sunny, NYC: 68°F cloudy" +``` + :::python To make tools that you have defined available for use by a model, you must bind them using @[`bind_tools()`][BaseChatModel.bind_tools]. In subsequent invocations, the model can choose to call any of the bound tools as needed. :::