Skip to content

Commit

Permalink
docs: update to AIMessage.tool_calls (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
regchiu authored Jan 30, 2025
1 parent 21401d0 commit 13e63c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
"\n",
"import { TavilySearchResults } from \"@langchain/community/tools/tavily_search\";\n",
"import { ChatOpenAI } from \"@langchain/openai\";\n",
"import { HumanMessage } from \"@langchain/core/messages\";\n",
"import { HumanMessage, AIMessage } from \"@langchain/core/messages\";\n",
"import { ToolNode } from \"@langchain/langgraph/prebuilt\";\n",
"import { StateGraph, MessagesAnnotation } from \"@langchain/langgraph\";\n",
"\n",
Expand All @@ -245,10 +245,10 @@
"\n",
"// Define the function that determines whether to continue or not\n",
"function shouldContinue({ messages }: typeof MessagesAnnotation.State) {\n",
" const lastMessage = messages[messages.length - 1];\n",
" const lastMessage = messages[messages.length - 1] as AIMessage;\n",
"\n",
" // If the LLM makes a tool call, then we route to the \"tools\" node\n",
" if (lastMessage.additional_kwargs.tool_calls) {\n",
" if (lastMessage.tool_calls?.length) {\n",
" return \"tools\";\n",
" }\n",
" // Otherwise, we stop (reply to the user) using the special \"__end__\" node\n",
Expand Down

0 comments on commit 13e63c8

Please sign in to comment.