Revert "disable parallel tool use"

This reverts commit 784b6afa11.
This commit is contained in:
Chester Curme
2025-01-17 10:19:17 -05:00
parent 784b6afa11
commit 4c02a4c501
+31 -54
View File
@@ -1180,7 +1180,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "da81116c-73f6-410a-858a-3a362dc16dd3",
"id": "08439bb4-91e8-4abb-a57a-2511877abcb7",
"metadata": {},
"outputs": [],
"source": [
@@ -1222,13 +1222,7 @@
"tool = TavilySearchResults(max_results=2)\n",
"tools = [tool, human_assistance]\n",
"llm = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
"llm_with_tools = llm.bind_tools(\n",
" tools,\n",
" # Because we will be interrupting during tool execution,\n",
" # we disable parallel tool calling to avoid repeating any\n",
" # tool invocations when we resume.\n",
" tool_choice={\"type\": \"any\", \"disable_parallel_tool_use\": True},\n",
")\n",
"llm_with_tools = llm.bind_tools(tools)\n",
"\n",
"\n",
"def chatbot(state: State):\n",
@@ -1266,7 +1260,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "16cc6b14-f758-4590-beb7-7b76a6841521",
"metadata": {},
"outputs": [],
@@ -1286,7 +1280,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "22ff19af-5a5b-4ca5-82d8-6a38445c24af",
"metadata": {},
"outputs": [
@@ -1321,7 +1315,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"id": "9f318020-ab7e-415b-a5e2-eddec6d9f3a6",
"metadata": {},
"outputs": [
@@ -1334,12 +1328,12 @@
"I need some expert guidance for building an AI agent. Could you request assistance for me?\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"[{'text': \"Certainly! I'd be happy to request expert assistance for you regarding building an AI agent. I'll use the human assistance function to ask for this guidance. Let me do that for you right away.\", 'type': 'text'}, {'id': 'toolu_01XufxDDxm3tXvuuX9h7C7v2', 'input': {'query': 'A user is seeking expert guidance for building an AI agent. Could you provide some key points or steps to consider when developing an AI agent?'}, 'name': 'human_assistance', 'type': 'tool_use'}]\n",
"[{'text': \"Certainly! I'd be happy to request expert assistance for you regarding building an AI agent. To do this, I'll use the human_assistance function to relay your request. Let me do that for you now.\", 'type': 'text'}, {'id': 'toolu_015tcCygn4UdBM24vg9NSycp', 'input': {'query': 'A user is seeking expert guidance for building an AI agent. Can you provide some professional advice or resources on this topic?'}, 'name': 'human_assistance', 'type': 'tool_use'}]\n",
"Tool Calls:\n",
" human_assistance (toolu_01XufxDDxm3tXvuuX9h7C7v2)\n",
" Call ID: toolu_01XufxDDxm3tXvuuX9h7C7v2\n",
" human_assistance (toolu_015tcCygn4UdBM24vg9NSycp)\n",
" Call ID: toolu_015tcCygn4UdBM24vg9NSycp\n",
" Args:\n",
" query: A user is seeking expert guidance for building an AI agent. Could you provide some key points or steps to consider when developing an AI agent?\n"
" query: A user is seeking expert guidance for building an AI agent. Can you provide some professional advice or resources on this topic?\n"
]
}
],
@@ -1365,7 +1359,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"id": "9f511371-98b6-4513-b450-9143778f12dc",
"metadata": {},
"outputs": [
@@ -1375,7 +1369,7 @@
"('tools',)"
]
},
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
@@ -1407,7 +1401,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "df6d81bb-e674-44ef-a46e-17b1a8d2381a",
"metadata": {},
"outputs": [
@@ -1417,40 +1411,32 @@
"text": [
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"[{'text': \"Certainly! I'd be happy to request expert assistance for you regarding building an AI agent. I'll use the human assistance function to ask for this guidance. Let me do that for you right away.\", 'type': 'text'}, {'id': 'toolu_01XufxDDxm3tXvuuX9h7C7v2', 'input': {'query': 'A user is seeking expert guidance for building an AI agent. Could you provide some key points or steps to consider when developing an AI agent?'}, 'name': 'human_assistance', 'type': 'tool_use'}]\n",
"[{'text': \"Certainly! I'd be happy to request expert assistance for you regarding building an AI agent. To do this, I'll use the human_assistance function to relay your request. Let me do that for you now.\", 'type': 'text'}, {'id': 'toolu_015tcCygn4UdBM24vg9NSycp', 'input': {'query': 'A user is seeking expert guidance for building an AI agent. Can you provide some professional advice or resources on this topic?'}, 'name': 'human_assistance', 'type': 'tool_use'}]\n",
"Tool Calls:\n",
" human_assistance (toolu_01XufxDDxm3tXvuuX9h7C7v2)\n",
" Call ID: toolu_01XufxDDxm3tXvuuX9h7C7v2\n",
" human_assistance (toolu_015tcCygn4UdBM24vg9NSycp)\n",
" Call ID: toolu_015tcCygn4UdBM24vg9NSycp\n",
" Args:\n",
" query: A user is seeking expert guidance for building an AI agent. Could you provide some key points or steps to consider when developing an AI agent?\n",
" query: A user is seeking expert guidance for building an AI agent. Can you provide some professional advice or resources on this topic?\n",
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
"Name: human_assistance\n",
"\n",
"We, the experts are here to help! We'd recommend you check out LangGraph to build your agent. It's much more reliable and extensible than simple autonomous agents.\n",
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
"\n",
"Thank you for your patience. I've received some expert advice regarding building an AI agent. Here's the guidance provided:\n",
"Thank you for your patience. I've received a response from the expert assistance. Here's the advice they provided:\n",
"\n",
"The experts recommend looking into LangGraph for building your AI agent. They suggest that LangGraph is a more reliable and extensible option compared to simple autonomous agents.\n",
"The experts recommend that you check out LangGraph for building your AI agent. They suggest that LangGraph is a more reliable and extensible option compared to simple autonomous agents.\n",
"\n",
"LangGraph is a framework designed to help developers create more complex and capable AI agents. Here are a few key points about LangGraph:\n",
"LangGraph is likely a framework or library designed specifically for creating AI agents. It seems to offer advantages in terms of reliability and extensibility, which are crucial factors when developing complex AI systems.\n",
"\n",
"1. Reliability: LangGraph is noted for being more reliable than simpler agent architectures, which can be crucial for developing robust AI systems.\n",
"To follow up on this recommendation, you might want to:\n",
"\n",
"2. Extensibility: The framework offers greater flexibility and extensibility, allowing you to create more sophisticated and adaptable AI agents.\n",
"1. Research LangGraph: Look for its official documentation, tutorials, and any community resources.\n",
"2. Compare LangGraph with other agent-building frameworks to understand its unique benefits.\n",
"3. Check if LangGraph aligns with your specific goals and requirements for your AI agent project.\n",
"4. Look for examples or case studies of AI agents built with LangGraph to get a better idea of its capabilities.\n",
"\n",
"3. Advanced Capabilities: LangGraph likely provides tools and structures for creating agents with more complex behaviors and decision-making processes.\n",
"\n",
"4. Structured Development: Using a framework like LangGraph can provide a more organized approach to building AI agents, potentially simplifying the development process.\n",
"\n",
"To get started with LangGraph, you might want to:\n",
"\n",
"1. Research LangGraph documentation and tutorials.\n",
"2. Understand the core concepts and components of the framework.\n",
"3. Set up your development environment to work with LangGraph.\n",
"4. Start with simple projects to familiarize yourself with its features before moving on to more complex agent designs.\n",
"\n",
"Would you like more specific information about LangGraph or any particular aspect of building AI agents? I'd be happy to request further assistance or search for more detailed information if needed.\n"
"Would you like me to search for more specific information about LangGraph or any other aspect of building AI agents?\n"
]
}
],
@@ -1516,10 +1502,7 @@
"tool = TavilySearchResults(max_results=2)\n",
"tools = [tool, human_assistance]\n",
"llm = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
"llm_with_tools = llm.bind_tools(\n",
" tools,\n",
" tool_choice={\"type\": \"any\", \"disable_parallel_tool_use\": True},\n",
")\n",
"llm_with_tools = llm.bind_tools(tools)\n",
"\n",
"\n",
"def chatbot(state: State):\n",
@@ -1557,7 +1540,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"id": "84627103-bcc8-4645-bd37-b93209fa09dd",
"metadata": {},
"outputs": [],
@@ -1589,7 +1572,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 3,
"id": "c4b65504-92c7-4c82-a6ee-824885d1a8a4",
"metadata": {},
"outputs": [],
@@ -1648,7 +1631,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 4,
"id": "e256fa2e-6c13-42dd-a0a5-d206ee4139bf",
"metadata": {},
"outputs": [],
@@ -1664,10 +1647,7 @@
"tool = TavilySearchResults(max_results=2)\n",
"tools = [tool, human_assistance]\n",
"llm = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
"llm_with_tools = llm.bind_tools(\n",
" tools,\n",
" tool_choice={\"type\": \"any\", \"disable_parallel_tool_use\": True},\n",
")\n",
"llm_with_tools = llm.bind_tools(tools)\n",
"\n",
"\n",
"def chatbot(state: State):\n",
@@ -1986,10 +1966,7 @@
"tool = TavilySearchResults(max_results=2)\n",
"tools = [tool, human_assistance]\n",
"llm = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\")\n",
"llm_with_tools = llm.bind_tools(\n",
" tools,\n",
" tool_choice={\"type\": \"any\", \"disable_parallel_tool_use\": True},\n",
")\n",
"llm_with_tools = llm.bind_tools(tools)\n",
"\n",
"\n",
"def chatbot(state: State):\n",