DylanonWic commited on
Commit
391ea44
1 Parent(s): 6f3689a

Upload 17 files

Browse files
Files changed (2) hide show
  1. chatbot_multiagent.ipynb +25 -15
  2. chatbot_multiagent.py +1 -1
chatbot_multiagent.ipynb CHANGED
@@ -205,7 +205,7 @@
205
  " workflow.add_conditional_edges(\n",
206
  " meta[\"name\"],\n",
207
  " router,\n",
208
- " {\"continue\": meta['continue'], \"call_tool\": \"call_tool\", \"__end__\": END},\n",
209
  " )\n",
210
  "\n",
211
  "workflow.add_conditional_edges(\n",
@@ -249,45 +249,55 @@
249
  },
250
  {
251
  "cell_type": "code",
252
- "execution_count": 8,
253
  "metadata": {},
254
  "outputs": [
255
  {
256
  "name": "stdout",
257
  "output_type": "stream",
258
  "text": [
259
- "{'analyst': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"location\":\"นวมินทร์ 71\"}', 'name': 'find_place_from_text'}}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 335, 'total_tokens': 357}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_507c9469a1', 'finish_reason': 'function_call', 'logprobs': None}, name='analyst', id='run-364a4721-9a93-44fa-9a52-775ed65fce98-0')], 'sender': 'analyst'}}\n",
260
  "----\n",
261
- "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"location\":\"นวมินทร์ 71, กรุงเทพมหานคร\"}', 'name': 'find_place_from_text'}}, response_metadata={'token_usage': {'completion_tokens': 24, 'prompt_tokens': 333, 'total_tokens': 357}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-4c69ccd0-2dff-45cb-9961-23c4fa3c5caf-0')], 'sender': 'data collector'}}\n",
262
  "----\n",
263
- "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"location\":\"นวมินทร์ 71\"}', 'name': 'find_place_from_text'}}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 410, 'total_tokens': 432}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-74b33ab4-fa8d-4244-8a9e-a50214c87162-0')], 'sender': 'reporter'}}\n",
264
  "----\n",
265
- "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"location\":\"นวมินทร์ 71, กรุงเทพมหานคร, ไทย\"}', 'name': 'find_place_from_text'}}, response_metadata={'token_usage': {'completion_tokens': 26, 'prompt_tokens': 385, 'total_tokens': 411}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-922d93a6-233d-4946-857d-0fa7672e3825-0')], 'sender': 'data collector'}}\n",
266
  "----\n",
267
- "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71, กรุงเทพมหานคร, ไทย\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 44, 'prompt_tokens': 464, 'total_tokens': 508}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-a5611413-8372-4019-9835-7fc372753217-0')], 'sender': 'reporter'}}\n",
268
  "----\n",
269
- "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 461, 'total_tokens': 502}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-a38c3339-7f1d-4368-845f-1bb43f4df107-0')], 'sender': 'data collector'}}\n",
270
  "----\n",
271
- "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71, กรุงเทพมหานคร, ไทย\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 45, 'prompt_tokens': 555, 'total_tokens': 600}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_507c9469a1', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-aa6417ad-5890-4eba-97fc-38a5adc9687a-0')], 'sender': 'reporter'}}\n",
272
  "----\n",
273
- "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 553, 'total_tokens': 594}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-6a5a11fd-a81f-4e1b-85ea-2b919169b15e-0')], 'sender': 'data collector'}}\n",
274
  "----\n",
275
- "{'reporter': {'messages': [AIMessage(content='ได้ทำการค้นหาร้านอาหารแถวนวมินทร์ 71 แล้ว ขอสรุปผลการค้นหาดังนี้:\\n\\n1. **จำนวนร้านอาหาร**: ในระยะ 1 กิโลเมตรรอบ ๆ นวมินทร์ 71 มีร้านอาหารหลายแห่งที่เปิดให้บริการ ซึ่งแสดงให้เห็นถึงความต้องการและความสนใจในการรับประทานอาหารในพื้นที่นี้\\n\\n2. **ประเภทของร้านอาหาร**: ร้านอาหารที่พบมีหลายประเภท ตั้งแต่อาหารไทย, อาหารจีน, อาหารญี่ปุ่น, จนถึงฟาสต์ฟู้ด ซึ่งทำให้มีความหลากหลายในการเลือกใช้บริการ\\n\\n3. **การแข่งขัน**: เนื่องจากมีร้านอาหารอยู่หลายแห่งในบริเวณนี้ จึงมีการแข่งขันที่สูง ซึ่งอาจจะต้องพิจารณาในเรื่องของคุณภาพอาหาร, ราคา, และการบริการ เพื่อดึงดูดลูกค้า\\n\\n4. **โอกาสในการเปิดร้าน**: หากสามารถนำเสนอแนวคิดหรือเมนูที่แตกต่างจากที่มีอยู่ในตลาด หรือสร้างบรรยากาศที่ดึงดูดลูกค้า จะสามารถแข่งขันได้ในตลาดนี้\\n\\n5. **ลูกค้าเป้าหมาย**: ควรพิจารณากลุ่มลูกค้าในบริเวณนี้ เช่น คนทำงาน, นักเรียน, หรือครอบครัว เพื่อการตลาดที่มีประสิทธิภาพ\\n\\nจากข้อมูลที่ได้รับ การเปิดร้านอาหารแถวนวมินทร์ 71 มีโอกาสที่ดี แต่ก็ต้องมีการวางแผนและกลยุทธ์การตลาดที่เหมาะสมเพื่อตอบสนองความต้องการของลูกค้าในพื้นที่นี้ให้ได้ดีที่สุด', response_metadata={'token_usage': {'completion_tokens': 364, 'prompt_tokens': 647, 'total_tokens': 1011}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'stop', 'logprobs': None}, name='reporter', id='run-83a4c073-9917-42c2-97b2-7ba11bbda1a3-0')], 'sender': 'reporter'}}\n",
276
  "----\n",
277
- "{'data collector': {'messages': [AIMessage(content='FINAL ANSWER: การเปิดร้านอาหารแถวนวมินทร์ 71 มีโอกาสที่ดี เนื่องจากมีร้านอาหารหลายแห่งในพื้นที่ แสดงถึงความต้องการในการรับประทานอาหาร แต่ก็มีการแข่งขันที่สูง ดังนั้นควรพิจารณาในเรื่องของคุณภาพอาหาร, ราคา, และการบริการ เพื่อดึงดูดลูกค้า รวมถึงการออกแบบเมนูที่แตกต่างและกลยุทธ์การตลาดที่เหมาะสมเพื่อตอบสนองความต้องการของลูกค้าในพื้นที่.', response_metadata={'token_usage': {'completion_tokens': 117, 'prompt_tokens': 964, 'total_tokens': 1081}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'stop', 'logprobs': None}, name='data collector', id='run-380be5c9-29d1-43e9-91b9-afb5caf0d15a-0')], 'sender': 'data collector'}}\n",
 
 
 
 
 
 
 
 
 
 
278
  "----\n"
279
  ]
280
  },
281
  {
282
  "ename": "GraphRecursionError",
283
- "evalue": "Recursion limit of 10 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.",
284
  "output_type": "error",
285
  "traceback": [
286
  "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
287
  "\u001b[0;31mGraphRecursionError\u001b[0m Traceback (most recent call last)",
288
- "Cell \u001b[0;32mIn[8], line 14\u001b[0m\n\u001b[1;32m 1\u001b[0m graph \u001b[38;5;241m=\u001b[39m workflow\u001b[38;5;241m.\u001b[39mcompile()\n\u001b[1;32m 3\u001b[0m events \u001b[38;5;241m=\u001b[39m graph\u001b[38;5;241m.\u001b[39mstream(\n\u001b[1;32m 4\u001b[0m {\n\u001b[1;32m 5\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m: [\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 12\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrecursion_limit\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m10\u001b[39m},\n\u001b[1;32m 13\u001b[0m )\n\u001b[0;32m---> 14\u001b[0m \u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43ms\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mevents\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 15\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mprint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 16\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mprint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m----\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
289
  "File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1038\u001b[0m, in \u001b[0;36mPregel.stream\u001b[0;34m(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug)\u001b[0m\n\u001b[1;32m 1036\u001b[0m \u001b[38;5;66;03m# handle exit\u001b[39;00m\n\u001b[1;32m 1037\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m loop\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mout_of_steps\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m-> 1038\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m GraphRecursionError(\n\u001b[1;32m 1039\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRecursion limit of \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mconfig[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrecursion_limit\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m reached \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1040\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwithout hitting a stop condition. You can increase the \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1041\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlimit by setting the `recursion_limit` config key.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1042\u001b[0m )\n\u001b[1;32m 1043\u001b[0m \u001b[38;5;66;03m# set final channel values as run output\u001b[39;00m\n\u001b[1;32m 1044\u001b[0m run_manager\u001b[38;5;241m.\u001b[39mon_chain_end(read_channels(loop\u001b[38;5;241m.\u001b[39mchannels, output_keys))\n",
290
- "\u001b[0;31mGraphRecursionError\u001b[0m: Recursion limit of 10 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key."
291
  ]
292
  }
293
  ],
 
205
  " workflow.add_conditional_edges(\n",
206
  " meta[\"name\"],\n",
207
  " router,\n",
208
+ " {\"continue\": meta['continue'], \"call_tool\": \"call_tool\", \"__end__\": END} if meta[\"name\"]==\"data collector\" else {\"continue\": meta['continue'], \"__end__\": END},\n",
209
  " )\n",
210
  "\n",
211
  "workflow.add_conditional_edges(\n",
 
249
  },
250
  {
251
  "cell_type": "code",
252
+ "execution_count": 9,
253
  "metadata": {},
254
  "outputs": [
255
  {
256
  "name": "stdout",
257
  "output_type": "stream",
258
  "text": [
259
+ "{'analyst': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"location\":\"นวมินทร์ 71\"}', 'name': 'find_place_from_text'}}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 335, 'total_tokens': 357}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='analyst', id='run-258145dd-989c-47e8-b808-9605a218a7c9-0')], 'sender': 'analyst'}}\n",
260
  "----\n",
261
+ "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"location\":\"นวมินทร์ 71\"}', 'name': 'find_place_from_text'}}, response_metadata={'token_usage': {'completion_tokens': 22, 'prompt_tokens': 333, 'total_tokens': 355}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_507c9469a1', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-a6d8ab7d-108c-4e55-acb3-f0efddd3c08b-0')], 'sender': 'data collector'}}\n",
262
  "----\n",
263
+ "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 408, 'total_tokens': 448}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-dbbb13d7-b770-4f99-9117-05908d44103b-0')], 'sender': 'reporter'}}\n",
264
  "----\n",
265
+ "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 39, 'prompt_tokens': 401, 'total_tokens': 440}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-b3e48624-f692-4261-ad56-c01e0429afde-0')], 'sender': 'data collector'}}\n",
266
  "----\n",
267
+ "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 39, 'prompt_tokens': 493, 'total_tokens': 532}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-5fbf68b6-e2e0-42f2-b978-9f3cde178693-0')], 'sender': 'reporter'}}\n",
268
  "----\n",
269
+ "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 39, 'prompt_tokens': 485, 'total_tokens': 524}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-099fb223-8be9-48f5-bf6f-af3a697172e0-0')], 'sender': 'data collector'}}\n",
270
  "----\n",
271
+ "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 39, 'prompt_tokens': 577, 'total_tokens': 616}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-2a83ea1e-5777-48aa-82bc-57c601e29a4b-0')], 'sender': 'reporter'}}\n",
272
  "----\n",
273
+ "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 39, 'prompt_tokens': 569, 'total_tokens': 608}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-e836fa27-c007-4741-90f2-bd8acdf1cd01-0')], 'sender': 'data collector'}}\n",
274
  "----\n",
275
+ "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 661, 'total_tokens': 701}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-ae137b63-1be4-4859-9f9f-4315632b99e7-0')], 'sender': 'reporter'}}\n",
276
  "----\n",
277
+ "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":500,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 39, 'prompt_tokens': 654, 'total_tokens': 693}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-cc93ad4f-888e-466f-a29e-03653a7709a7-0')], 'sender': 'data collector'}}\n",
278
+ "----\n",
279
+ "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 746, 'total_tokens': 787}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-2be60a63-ce04-4f94-8ba9-29969b6f6b4f-0')], 'sender': 'reporter'}}\n",
280
+ "----\n",
281
+ "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 740, 'total_tokens': 780}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-f0783436-107b-4513-bebc-f59ff1028878-0')], 'sender': 'data collector'}}\n",
282
+ "----\n",
283
+ "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 833, 'total_tokens': 874}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-bc595713-4ab3-4b26-a9fa-ab2a73f66f86-0')], 'sender': 'reporter'}}\n",
284
+ "----\n",
285
+ "{'data collector': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"restaurant\",\"location_name\":\"นวมินทร์ 71\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 40, 'prompt_tokens': 827, 'total_tokens': 867}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_48196bc67a', 'finish_reason': 'function_call', 'logprobs': None}, name='data collector', id='run-5ae4ab19-ae02-4d06-ab74-20f06c34f6fb-0')], 'sender': 'data collector'}}\n",
286
+ "----\n",
287
+ "{'reporter': {'messages': [AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"input_dict\":{\"keyword\":\"ร้านอาหาร\",\"location_name\":\"นวมินทร์ 71\",\"radius\":1000,\"place_type\":\"restaurant\"}}', 'name': 'nearby_search'}}, response_metadata={'token_usage': {'completion_tokens': 41, 'prompt_tokens': 920, 'total_tokens': 961}, 'model_name': 'gpt-4o-mini', 'system_fingerprint': 'fp_507c9469a1', 'finish_reason': 'function_call', 'logprobs': None}, name='reporter', id='run-8287ca4f-d479-4ec8-b4ef-57188ebb2d3a-0')], 'sender': 'reporter'}}\n",
288
  "----\n"
289
  ]
290
  },
291
  {
292
  "ename": "GraphRecursionError",
293
+ "evalue": "Recursion limit of 15 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.",
294
  "output_type": "error",
295
  "traceback": [
296
  "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
297
  "\u001b[0;31mGraphRecursionError\u001b[0m Traceback (most recent call last)",
298
+ "Cell \u001b[0;32mIn[9], line 14\u001b[0m\n\u001b[1;32m 1\u001b[0m graph \u001b[38;5;241m=\u001b[39m workflow\u001b[38;5;241m.\u001b[39mcompile()\n\u001b[1;32m 3\u001b[0m events \u001b[38;5;241m=\u001b[39m graph\u001b[38;5;241m.\u001b[39mstream(\n\u001b[1;32m 4\u001b[0m {\n\u001b[1;32m 5\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmessages\u001b[39m\u001b[38;5;124m\"\u001b[39m: [\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 12\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrecursion_limit\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;241m15\u001b[39m},\n\u001b[1;32m 13\u001b[0m )\n\u001b[0;32m---> 14\u001b[0m \u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43ms\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mevents\u001b[49m\u001b[43m:\u001b[49m\n\u001b[1;32m 15\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mprint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43ms\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 16\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mprint\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m----\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
299
  "File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/langgraph/pregel/__init__.py:1038\u001b[0m, in \u001b[0;36mPregel.stream\u001b[0;34m(self, input, config, stream_mode, output_keys, interrupt_before, interrupt_after, debug)\u001b[0m\n\u001b[1;32m 1036\u001b[0m \u001b[38;5;66;03m# handle exit\u001b[39;00m\n\u001b[1;32m 1037\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m loop\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mout_of_steps\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m-> 1038\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m GraphRecursionError(\n\u001b[1;32m 1039\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRecursion limit of \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mconfig[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mrecursion_limit\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m reached \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1040\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwithout hitting a stop condition. You can increase the \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1041\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mlimit by setting the `recursion_limit` config key.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1042\u001b[0m )\n\u001b[1;32m 1043\u001b[0m \u001b[38;5;66;03m# set final channel values as run output\u001b[39;00m\n\u001b[1;32m 1044\u001b[0m run_manager\u001b[38;5;241m.\u001b[39mon_chain_end(read_channels(loop\u001b[38;5;241m.\u001b[39mchannels, output_keys))\n",
300
+ "\u001b[0;31mGraphRecursionError\u001b[0m: Recursion limit of 15 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key."
301
  ]
302
  }
303
  ],
chatbot_multiagent.py CHANGED
@@ -181,7 +181,7 @@ for meta in agent_meta:
181
  workflow.add_conditional_edges(
182
  meta["name"],
183
  router,
184
- {"continue": meta['continue'], "call_tool": "call_tool", "__end__": END},
185
  )
186
 
187
  workflow.add_conditional_edges(
 
181
  workflow.add_conditional_edges(
182
  meta["name"],
183
  router,
184
+ {"continue": meta['continue'], "call_tool": "call_tool", "__end__": END} if meta["name"]=="data collector" else {"continue": meta['continue'], "__end__": END},
185
  )
186
 
187
  workflow.add_conditional_edges(