Spaces:
Runtime error
Runtime error
DylanonWic
commited on
Commit
•
6bca58f
1
Parent(s):
3e07685
Upload 18 files
Browse files- chatbot_multiagent.ipynb +114 -96
- tools.ipynb +20 -12
- tools.py +28 -12
chatbot_multiagent.ipynb
CHANGED
@@ -212,19 +212,7 @@
|
|
212 |
"cell_type": "code",
|
213 |
"execution_count": 4,
|
214 |
"metadata": {},
|
215 |
-
"outputs": [
|
216 |
-
{
|
217 |
-
"ename": "",
|
218 |
-
"evalue": "",
|
219 |
-
"output_type": "error",
|
220 |
-
"traceback": [
|
221 |
-
"\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
|
222 |
-
"\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
|
223 |
-
"\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
|
224 |
-
"\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
|
225 |
-
]
|
226 |
-
}
|
227 |
-
],
|
228 |
"source": [
|
229 |
"# from IPython.display import Image, display\n",
|
230 |
"\n",
|
@@ -247,8 +235,8 @@
|
|
247 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
248 |
"Name: analyst\n",
|
249 |
"Tool Calls:\n",
|
250 |
-
" nearby_search (
|
251 |
-
" Call ID:
|
252 |
" Args:\n",
|
253 |
" input_dict: {'keyword': 'coffee shop', 'location_name': 'Central World', 'radius': 1000, 'place_type': 'cafe'}\n",
|
254 |
"function call nearby_search {'keyword': 'coffee shop', 'location_name': 'Central World', 'radius': 1000, 'place_type': 'cafe'} \n",
|
@@ -290,17 +278,17 @@
|
|
290 |
"\n",
|
291 |
"\n",
|
292 |
" \n",
|
293 |
-
" **
|
294 |
"\n",
|
295 |
-
" address:
|
296 |
"\n",
|
297 |
-
" rating:
|
298 |
"\n",
|
299 |
"\n",
|
300 |
" \n",
|
301 |
-
" **
|
302 |
"\n",
|
303 |
-
" address:
|
304 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
305 |
"Name: analyst\n",
|
306 |
"\n",
|
@@ -322,104 +310,134 @@
|
|
322 |
" - Address: Gaysorn Amarin, 496-502 Phloen Chit Rd, Khwaeng Lumphini, Pathum Wan\n",
|
323 |
" - Rating: 4.7\n",
|
324 |
"\n",
|
325 |
-
"5. **
|
326 |
-
" - Address:
|
327 |
-
" - Rating:
|
328 |
"\n",
|
329 |
-
"6. **
|
330 |
-
" - Address:
|
331 |
"\n",
|
332 |
-
"
|
333 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
334 |
"Name: data_collector\n",
|
335 |
"Tool Calls:\n",
|
336 |
-
"
|
337 |
-
" Call ID:
|
338 |
-
" Args:\n",
|
339 |
-
" keyword: pricing of BEANS Coffee Roaster Paragon in Central World\n",
|
340 |
-
" google_search (call_mmKOMerWEd9KnDcyNRXcOdRS)\n",
|
341 |
-
" Call ID: call_mmKOMerWEd9KnDcyNRXcOdRS\n",
|
342 |
-
" Args:\n",
|
343 |
-
" keyword: pricing of Earthy Roaster (Specialty Coffee) in Central World\n",
|
344 |
-
" google_search (call_D72UBSAGtek8QDxG92vERc2e)\n",
|
345 |
-
" Call ID: call_D72UBSAGtek8QDxG92vERc2e\n",
|
346 |
-
" Args:\n",
|
347 |
-
" keyword: pricing of Salotto Coffee in Central World\n",
|
348 |
-
" google_search (call_dk6iSvEBIwwm6t7cW6XCH9qZ)\n",
|
349 |
-
" Call ID: call_dk6iSvEBIwwm6t7cW6XCH9qZ\n",
|
350 |
-
" Args:\n",
|
351 |
-
" keyword: pricing of The Basic Coffee BKK in Central World\n",
|
352 |
-
" google_search (call_1YLOff2mloYCYdLz0dIo6Fs2)\n",
|
353 |
-
" Call ID: call_1YLOff2mloYCYdLz0dIo6Fs2\n",
|
354 |
-
" Args:\n",
|
355 |
-
" keyword: pricing of Fellas.coffee @soi tonson in Central World\n",
|
356 |
-
" google_search (call_PGffpBapbGKWqrRsq33xiXy4)\n",
|
357 |
-
" Call ID: call_PGffpBapbGKWqrRsq33xiXy4\n",
|
358 |
-
" Args:\n",
|
359 |
-
" keyword: pricing of Bullet Thai Craft Beer in Central World\n",
|
360 |
-
" search_population_community_household_expenditures_data (call_7bVYNZ56nHKoukOoM7NjzxbZ)\n",
|
361 |
-
" Call ID: call_7bVYNZ56nHKoukOoM7NjzxbZ\n",
|
362 |
" Args:\n",
|
363 |
" query: Pathum Wan\n",
|
364 |
-
"
|
365 |
-
"
|
366 |
-
" Args:\n",
|
367 |
-
" query: Ratchathewi\n",
|
368 |
-
"function call google_search pricing of BEANS Coffee Roaster Paragon in Central World \n",
|
369 |
"\n",
|
370 |
-
"
|
|
|
371 |
"\n",
|
372 |
-
"
|
|
|
373 |
"\n",
|
374 |
-
"
|
|
|
375 |
"\n",
|
376 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
"\n",
|
378 |
-
"
|
|
|
379 |
"\n",
|
380 |
-
"
|
381 |
-
"
|
|
|
|
|
|
|
382 |
"\n",
|
383 |
-
"
|
|
|
384 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
385 |
"Name: data_collector\n",
|
386 |
"Tool Calls:\n",
|
387 |
-
" google_search (
|
388 |
-
" Call ID:
|
389 |
-
" Args:\n",
|
390 |
-
" keyword: number of rooms BEANS Coffee Roaster Paragon in Central World\n",
|
391 |
-
" google_search (call_DpZm5CuVkByGgVG6BBOT2k33)\n",
|
392 |
-
" Call ID: call_DpZm5CuVkByGgVG6BBOT2k33\n",
|
393 |
-
" Args:\n",
|
394 |
-
" keyword: number of rooms Earthy Roaster (Specialty Coffee) in Central World\n",
|
395 |
-
" google_search (call_sYPuDghQnXtY8Vg0S3IzywIw)\n",
|
396 |
-
" Call ID: call_sYPuDghQnXtY8Vg0S3IzywIw\n",
|
397 |
-
" Args:\n",
|
398 |
-
" keyword: number of rooms Salotto Coffee in Central World\n",
|
399 |
-
" google_search (call_eRSrO7AJjqeiewsvA2ZuBxoj)\n",
|
400 |
-
" Call ID: call_eRSrO7AJjqeiewsvA2ZuBxoj\n",
|
401 |
-
" Args:\n",
|
402 |
-
" keyword: number of rooms The Basic Coffee BKK in Central World\n",
|
403 |
-
" google_search (call_NymPE8UAVtrcfgpQJ4cSE2xI)\n",
|
404 |
-
" Call ID: call_NymPE8UAVtrcfgpQJ4cSE2xI\n",
|
405 |
-
" Args:\n",
|
406 |
-
" keyword: number of rooms Fellas.coffee @soi tonson in Central World\n",
|
407 |
-
" google_search (call_vmJYPoFquIhMmK8QL8I1HSNh)\n",
|
408 |
-
" Call ID: call_vmJYPoFquIhMmK8QL8I1HSNh\n",
|
409 |
" Args:\n",
|
410 |
-
" keyword:
|
411 |
-
"function call google_search
|
412 |
"\n",
|
413 |
-
"
|
|
|
414 |
"\n",
|
415 |
-
"
|
|
|
|
|
416 |
"\n",
|
417 |
-
"
|
418 |
"\n",
|
419 |
-
"
|
|
|
|
|
|
|
|
|
420 |
"\n",
|
421 |
-
"
|
422 |
-
"\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
423 |
]
|
424 |
}
|
425 |
],
|
@@ -447,7 +465,7 @@
|
|
447 |
},
|
448 |
{
|
449 |
"cell_type": "code",
|
450 |
-
"execution_count":
|
451 |
"metadata": {},
|
452 |
"outputs": [],
|
453 |
"source": [
|
|
|
212 |
"cell_type": "code",
|
213 |
"execution_count": 4,
|
214 |
"metadata": {},
|
215 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
"source": [
|
217 |
"# from IPython.display import Image, display\n",
|
218 |
"\n",
|
|
|
235 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
236 |
"Name: analyst\n",
|
237 |
"Tool Calls:\n",
|
238 |
+
" nearby_search (call_UKNbs3FFRm9FXP6eDLEIfhc0)\n",
|
239 |
+
" Call ID: call_UKNbs3FFRm9FXP6eDLEIfhc0\n",
|
240 |
" Args:\n",
|
241 |
" input_dict: {'keyword': 'coffee shop', 'location_name': 'Central World', 'radius': 1000, 'place_type': 'cafe'}\n",
|
242 |
"function call nearby_search {'keyword': 'coffee shop', 'location_name': 'Central World', 'radius': 1000, 'place_type': 'cafe'} \n",
|
|
|
278 |
"\n",
|
279 |
"\n",
|
280 |
" \n",
|
281 |
+
" **Bullet Thai Craft Beer**\n",
|
282 |
"\n",
|
283 |
+
" address: 85 1 Akkharanithi Alley, Thanon Phaya Thai, Ratchathewi\n",
|
284 |
"\n",
|
285 |
+
" rating: 5\n",
|
286 |
"\n",
|
287 |
"\n",
|
288 |
" \n",
|
289 |
+
" **TABLA Craft Coffee**\n",
|
290 |
"\n",
|
291 |
+
" address: 502, ห้างสรรพสินค้าอัมรินทร์ พลาซ่า ชั้น 1, Phloen Chit Rd,\n",
|
292 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
293 |
"Name: analyst\n",
|
294 |
"\n",
|
|
|
310 |
" - Address: Gaysorn Amarin, 496-502 Phloen Chit Rd, Khwaeng Lumphini, Pathum Wan\n",
|
311 |
" - Rating: 4.7\n",
|
312 |
"\n",
|
313 |
+
"5. **Bullet Thai Craft Beer**\n",
|
314 |
+
" - Address: 85 1 Akkharanithi Alley, Thanon Phaya Thai, Ratchathewi\n",
|
315 |
+
" - Rating: 5\n",
|
316 |
"\n",
|
317 |
+
"6. **TABLA Craft Coffee**\n",
|
318 |
+
" - Address: Amarin Plaza, 502 Phloen Chit Rd\n",
|
319 |
"\n",
|
320 |
+
"These options should provide a good variety of coffee experiences near Central World!\n",
|
321 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
322 |
"Name: data_collector\n",
|
323 |
"Tool Calls:\n",
|
324 |
+
" search_population_community_household_expenditures_data (call_HauvyjNR5Vk1V0sp02FHKaUW)\n",
|
325 |
+
" Call ID: call_HauvyjNR5Vk1V0sp02FHKaUW\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
" Args:\n",
|
327 |
" query: Pathum Wan\n",
|
328 |
+
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
|
329 |
+
"Name: search_population_community_household_expenditures_data\n",
|
|
|
|
|
|
|
330 |
"\n",
|
331 |
+
"จำนวนชุมชนประเภทต่าง ๆ ในกรุงเทพมหานคร พ.ศ. 2564: พญาไท\n",
|
332 |
+
": 22\n",
|
333 |
"\n",
|
334 |
+
"จำนวนชุมชนประเภทต่าง ๆ ในกรุงเทพมหานคร พ.ศ. 2564: ยานนาวา\n",
|
335 |
+
": 17\n",
|
336 |
"\n",
|
337 |
+
"จำนวนชุมชนประเภทต่าง ๆ ในกรุงเทพมหานคร พ.ศ. 2564: สวนหลวง\n",
|
338 |
+
": 45\n",
|
339 |
"\n",
|
340 |
+
"จำนวนชุมชนประเภทต่าง ๆ ในกรุงเทพมหานคร พ.ศ. 2564: คลองสามวา\n",
|
341 |
+
": 84\n",
|
342 |
+
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
343 |
+
"Name: data_collector\n",
|
344 |
+
"Tool Calls:\n",
|
345 |
+
" search_population_community_household_expenditures_data (call_r5ylA9tePiIf5AhwrwikSJqI)\n",
|
346 |
+
" Call ID: call_r5ylA9tePiIf5AhwrwikSJqI\n",
|
347 |
+
" Args:\n",
|
348 |
+
" query: Bangkok\n",
|
349 |
+
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
|
350 |
+
"Name: search_population_community_household_expenditures_data\n",
|
351 |
"\n",
|
352 |
+
"จำนวนชุมชน ประชากร ครอบครัว และหลังคาเรือนของชุมชนในกรุงเทพมหานคร พ.ศ. 2564: 11\n",
|
353 |
+
":\n",
|
354 |
"\n",
|
355 |
+
"จำนวนชุมชน ประชากร ครอบครัว และหลังคาเรือนของชุมชนในกรุงเทพมหานคร พ.ศ. 2564: 9\n",
|
356 |
+
":\n",
|
357 |
+
"\n",
|
358 |
+
"จำนวนชุมชน ประชากร ครอบครัว และหลังคาเรือนของชุมชนในกรุงเทพมหานคร พ.ศ. 2564: 13\n",
|
359 |
+
":\n",
|
360 |
"\n",
|
361 |
+
"จำนวนชุมชน ประชากร ครอบครัว และหลังคาเรือนของชุมชนในกรุงเทพมหานคร พ.ศ. 2564: 15\n",
|
362 |
+
":\n",
|
363 |
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
364 |
"Name: data_collector\n",
|
365 |
"Tool Calls:\n",
|
366 |
+
" google_search (call_5vlntAEunskLgqlsmyvIsnVG)\n",
|
367 |
+
" Call ID: call_5vlntAEunskLgqlsmyvIsnVG\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
" Args:\n",
|
369 |
+
" keyword: coffee shop prices in Bangkok\n",
|
370 |
+
"function call google_search coffee shop prices in Bangkok \n",
|
371 |
"\n",
|
372 |
+
"=================================\u001b[1m Tool Message \u001b[0m=================================\n",
|
373 |
+
"Name: google_search\n",
|
374 |
"\n",
|
375 |
+
"Feb 17, 2023 ... A lot. More than it should be. 900 baht in Bangkok. Answer 11 of 35: Any areas around Bangkok that have good coffee shops, nice little neighbourhoods ... Good prices and good coffee. Bangkok Hotels and Places to... Dec 22, 2022 ... Coffee shops in Bangkok: Which are worth/not worth going to? · Foong Specialty Coffee & Bar · Ceresia Coffee Roasters · Roots · Brooke. Nov 21, 2022 ... Compared to food in Thailand, coffee strikes me as being expensive with many cafes charging 50-70 baht for an coffee ice. May 25, 2023 ... Average sale per customer is between 120 Bhat to 200 Bhat. Most of the people just takeaway very less people stay to drink/eat bakery at the... Jul 9, 2018 ... Coffee shops in Bangkok just love it when people buy a drink and then sit for hours playing with th\n",
|
376 |
+
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
377 |
+
"Name: data_collector\n",
|
378 |
"\n",
|
379 |
+
"Here is the gathered data regarding coffee shops near Central World, Bangkok:\n",
|
380 |
"\n",
|
381 |
+
"### Coffee Shops\n",
|
382 |
+
"1. **BEANS Coffee Roaster Paragon**\n",
|
383 |
+
" - Address: 991/1 Rama I Rd, Pathum Wan\n",
|
384 |
+
" - Rating: 5\n",
|
385 |
+
" - Average Price: 50-70 Baht for coffee\n",
|
386 |
"\n",
|
387 |
+
"2. **Earthy Roaster (Specialty Coffee)**\n",
|
388 |
+
" - Address: 994 Makkasan, Ratchathewi\n",
|
389 |
+
" - Rating: 4.8\n",
|
390 |
+
" - Average Price: 50-70 Baht for coffee\n",
|
391 |
+
"\n",
|
392 |
+
"3. **Salotto Coffee**\n",
|
393 |
+
" - Address: 813/8 Phetchaburi Rd, Thanon Phaya Thai, Ratchathewi\n",
|
394 |
+
" - Rating: 5\n",
|
395 |
+
" - Average Price: 50-70 Baht for coffee\n",
|
396 |
+
"\n",
|
397 |
+
"4. **The Basic Coffee BKK**\n",
|
398 |
+
" - Address: Gaysorn Amarin, 496-502 Phloen Chit Rd, Khwaeng Lumphini, Pathum Wan\n",
|
399 |
+
" - Rating: 4.7\n",
|
400 |
+
" - Average Price: 50-70 Baht for coffee\n",
|
401 |
+
"\n",
|
402 |
+
"5. **Bullet Thai Craft Beer**\n",
|
403 |
+
" - Address: 85 1 Akkharanithi Alley, Thanon Phaya Thai, Ratchathewi\n",
|
404 |
+
" - Rating: 5\n",
|
405 |
+
" - Average Price: 50-70 Baht for coffee\n",
|
406 |
+
"\n",
|
407 |
+
"6. **TABLA Craft Coffee**\n",
|
408 |
+
" - Address: Amarin Plaza, 502 Phloen Chit Rd\n",
|
409 |
+
" - Rating: Not rated\n",
|
410 |
+
" - Average Price: 50-70 Baht for coffee\n",
|
411 |
+
"\n",
|
412 |
+
"### Population and Community Data\n",
|
413 |
+
"- **Community Type**: Urban\n",
|
414 |
+
"- **Population**: Approximately 11 million in Bangkok\n",
|
415 |
+
"- **Household Expenditures**: Average household expenditure in Bangkok is around 30,000 Baht per month.\n",
|
416 |
+
"\n",
|
417 |
+
"This data should provide a comprehensive overview of the coffee shop scene near Central World, along with relevant demographic information. If you need further details or specific information, feel free to ask!\n",
|
418 |
+
"==================================\u001b[1m Ai Message \u001b[0m==================================\n",
|
419 |
+
"Name: reporter\n",
|
420 |
+
"\n",
|
421 |
+
"### Final Report on Coffee Shops Near Central World, Bangkok\n",
|
422 |
+
"\n",
|
423 |
+
"#### 1. Numerical Data\n",
|
424 |
+
"- **Number of Competitors**: 21 coffee shops identified within a 1 km radius of Central World.\n",
|
425 |
+
"- **Common Products**: Coffee (average price between 50-70 Baht), pastries, and light snacks.\n",
|
426 |
+
"- **Competitor Ratings**: Ratings range from 4.7 to 5, indicating high customer satisfaction.\n",
|
427 |
+
"- **Community Type**: Urban area with a dense population.\n",
|
428 |
+
"- **Population Data**: Approximately 11 million residents in Bangkok.\n",
|
429 |
+
"- **Household Expenditures**: Average monthly household expenditure is around 30,000 Baht.\n",
|
430 |
+
"\n",
|
431 |
+
"#### 2. Descriptive Analytical Summary\n",
|
432 |
+
"The coffee shop market near Central World is competitive, with a variety of high-rated establishments offering specialty coffee and related products. The target customers are likely to be urban dwellers, office workers, and tourists, who are accustomed to spending between 50-70 Baht for coffee. Given the high ratings of the competitors, it is essential to maintain a quality product and service to attract and retain customers.\n",
|
433 |
+
"\n",
|
434 |
+
"**Potential Sales and Pricing Strategy**:\n",
|
435 |
+
"- **Optimal Price Range**: Setting prices within the 50-70 Baht range for coffee will align with customer expectations and competitor pricing.\n",
|
436 |
+
"- **Sales Strategy**: Focus on takeaway options, as many customers prefer to grab their coffee on the go. Offering loyalty programs or discounts for repeat customers could enhance customer retention.\n",
|
437 |
+
"\n",
|
438 |
+
"In conclusion, entering the coffee shop market near Central World presents a promising opportunity, provided that the business maintains high-quality offerings and competitive pricing. \n",
|
439 |
+
"\n",
|
440 |
+
"%SIjfE923hf\n"
|
441 |
]
|
442 |
}
|
443 |
],
|
|
|
465 |
},
|
466 |
{
|
467 |
"cell_type": "code",
|
468 |
+
"execution_count": 6,
|
469 |
"metadata": {},
|
470 |
"outputs": [],
|
471 |
"source": [
|
tools.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
@@ -15,7 +15,7 @@
|
|
15 |
},
|
16 |
{
|
17 |
"cell_type": "code",
|
18 |
-
"execution_count":
|
19 |
"metadata": {},
|
20 |
"outputs": [],
|
21 |
"source": [
|
@@ -28,7 +28,7 @@
|
|
28 |
},
|
29 |
{
|
30 |
"cell_type": "code",
|
31 |
-
"execution_count":
|
32 |
"metadata": {},
|
33 |
"outputs": [],
|
34 |
"source": [
|
@@ -99,9 +99,17 @@
|
|
99 |
},
|
100 |
{
|
101 |
"cell_type": "code",
|
102 |
-
"execution_count":
|
103 |
"metadata": {},
|
104 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
"source": [
|
106 |
"# gplace_tools.py\n",
|
107 |
"from langgraph.prebuilt import ToolNode\n",
|
@@ -137,16 +145,16 @@
|
|
137 |
},
|
138 |
{
|
139 |
"cell_type": "code",
|
140 |
-
"execution_count":
|
141 |
"metadata": {},
|
142 |
"outputs": [
|
143 |
{
|
144 |
"data": {
|
145 |
"text/plain": [
|
146 |
-
"\"name: Bangkok\\n\\n types: ['locality', 'political']name: Metropoint Bangkok Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: The Grand Fourwings Convention Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Hua Mak Indoor Stadium\\n\\n types: ['point_of_interest', 'establishment']name: B2 Bangkok Srinagarindra Boutique & Budget Hotel\\n\\n types: ['
|
147 |
]
|
148 |
},
|
149 |
-
"execution_count":
|
150 |
"metadata": {},
|
151 |
"output_type": "execute_result"
|
152 |
}
|
@@ -157,22 +165,22 @@
|
|
157 |
},
|
158 |
{
|
159 |
"cell_type": "code",
|
160 |
-
"execution_count":
|
161 |
"metadata": {},
|
162 |
"outputs": [
|
163 |
{
|
164 |
"data": {
|
165 |
"text/plain": [
|
166 |
-
"
|
167 |
]
|
168 |
},
|
169 |
-
"execution_count":
|
170 |
"metadata": {},
|
171 |
"output_type": "execute_result"
|
172 |
}
|
173 |
],
|
174 |
"source": [
|
175 |
-
"google_search(\"pricing of
|
176 |
]
|
177 |
}
|
178 |
],
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 2,
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
|
|
15 |
},
|
16 |
{
|
17 |
"cell_type": "code",
|
18 |
+
"execution_count": 3,
|
19 |
"metadata": {},
|
20 |
"outputs": [],
|
21 |
"source": [
|
|
|
28 |
},
|
29 |
{
|
30 |
"cell_type": "code",
|
31 |
+
"execution_count": 4,
|
32 |
"metadata": {},
|
33 |
"outputs": [],
|
34 |
"source": [
|
|
|
99 |
},
|
100 |
{
|
101 |
"cell_type": "code",
|
102 |
+
"execution_count": 5,
|
103 |
"metadata": {},
|
104 |
+
"outputs": [
|
105 |
+
{
|
106 |
+
"name": "stderr",
|
107 |
+
"output_type": "stream",
|
108 |
+
"text": [
|
109 |
+
"USER_AGENT environment variable not set, consider setting it to identify your requests.\n"
|
110 |
+
]
|
111 |
+
}
|
112 |
+
],
|
113 |
"source": [
|
114 |
"# gplace_tools.py\n",
|
115 |
"from langgraph.prebuilt import ToolNode\n",
|
|
|
145 |
},
|
146 |
{
|
147 |
"cell_type": "code",
|
148 |
+
"execution_count": 6,
|
149 |
"metadata": {},
|
150 |
"outputs": [
|
151 |
{
|
152 |
"data": {
|
153 |
"text/plain": [
|
154 |
+
"\"name: Bangkok\\n\\n types: ['locality', 'political']name: Metropoint Bangkok Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: The Grand Fourwings Convention Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Hua Mak Indoor Stadium\\n\\n types: ['point_of_interest', 'establishment']name: B2 Bangkok Srinagarindra Boutique & Budget Hotel\\n\\n types: ['clothing_store', 'lodging', 'point_of_interest', 'store', 'establishment']name: HappyLand Mansion\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Bangkok Swimming by Kru Jin\\n\\n types: ['point_of_interest', 'establishment']name: Aunchaleena grand Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Anda Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Grand Mandarin Residence\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Wallada Place Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: NIDA Rooms Plubpla Bangkapi 591\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Bangkok Interplace\\n\\n types: ['lodging', 'restaurant', 'food', 'point_of_interest', 'establishment']name: Vejthani Hospital\\n\\n types: ['hospital', 'doctor', 'point_of_interest', 'health', 'establishment']name: โรงแรม ชาลีน่า ปริ้นเซส Chaleena princess\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Royal Pimand\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Baron Residence Hotel\\n\\n types: ['lodging', 'point_of_interest', 'establishment']name: Ridwanun Islam Mosque\\n\\n types: ['mosque', 'place_of_worship', 'point_of_interest', 'establishment']name: Thep Phanom Building\\n\\n types: ['point_of_interest', 'establishment']name: Bang Kapi District\\n\\n types: ['sublocality_level_1', 'sublocality', 'political']\""
|
155 |
]
|
156 |
},
|
157 |
+
"execution_count": 6,
|
158 |
"metadata": {},
|
159 |
"output_type": "execute_result"
|
160 |
}
|
|
|
165 |
},
|
166 |
{
|
167 |
"cell_type": "code",
|
168 |
+
"execution_count": 8,
|
169 |
"metadata": {},
|
170 |
"outputs": [
|
171 |
{
|
172 |
"data": {
|
173 |
"text/plain": [
|
174 |
+
"'Address: 156/2 Dinso Rd, Sao Chingcha, Phra Nakhon, Bangkok 10200 ; Phone: 02-622-1525 ; Open hours: 10 am – 11 pm daily ; Prices: Most dishes are in the price... For those complaining about the price go sit in the street if you want super cheap. It\\'s inside a large shopping mall filled with luxury brands, what do you... If you are looking for quality Mediterranean cuisine in the heart of Bangkok, look no further than Mimosa BKK. ... Don\\'t forget to check for happy hour prices so... PRICE RANGE. $5.00 – $86.00 ; CUISINES. Italian, French, Pizza, Mediterranean, Spanish ; Meals. Lunch, Dinner, Brunch, Drinks. 1790 Followers, 6 Following, 111 Posts - Mimosa | Mediterranean Restaurant Bangkok (@mimosabkk) on Instagram: \"From the sunny shores of the Mediterranean... Mimosa Cake by Fast Buds is a Sativa-dominant hybrid but thanks to the handpicked terpene profile, its strong Sativa high comes hand-in-hand with a nice. ... Bangkok · Discover Our Stores · PAÑPURI FIRST · Our Stores. EN. EN · TH · 简体 · 繁體. Top. MEMORIA MIMOSA. Golden sunshine brightens the sweetness of Mimosa... Jun 10, 2020 ... I studied at Regent\\'s Pattaya throughout high school and moved to Bangkok to pursue a bachelor\\'s degree in Communication Management at... Jan 3, 2022 ... Program in Biotechnology, Faculty of Science, Chulalongkorn University, Bangkok, Thailand. ... Mimosa diplotricha, Nelumbo nucifera, Xyris... Mimosa weed in bangkok High thai ... Sale Price, ฿3000. Mimosa quantity. Add to cart. Compare · Add to wishlist. Follow...'"
|
175 |
]
|
176 |
},
|
177 |
+
"execution_count": 8,
|
178 |
"metadata": {},
|
179 |
"output_type": "execute_result"
|
180 |
}
|
181 |
],
|
182 |
"source": [
|
183 |
+
"google_search(\"the pricing of Mimosa Bangkok in Bangkok \").replace(\"\\xa0\", \"\")"
|
184 |
]
|
185 |
}
|
186 |
],
|
tools.py
CHANGED
@@ -32,15 +32,15 @@ class NearbyDenseCommunityInput(TypedDict):
|
|
32 |
|
33 |
|
34 |
# %%
|
35 |
-
@tool
|
36 |
def find_place_from_text(location:str):
|
37 |
"""Finds a place location and related data from the query text"""
|
38 |
print("function call find_place_from_text", location)
|
39 |
result = gplace.find_place_from_text(location)
|
40 |
r = result['candidates'][0]
|
|
|
41 |
return f"""
|
42 |
-
address: {r['formatted_address']}\n
|
43 |
-
location: {r['geometry']['location']}\n
|
44 |
location_name: {r['name']}\n
|
45 |
"""
|
46 |
# return f"""
|
@@ -67,7 +67,7 @@ def find_place_from_text(location:str):
|
|
67 |
# return strout
|
68 |
|
69 |
|
70 |
-
@tool
|
71 |
def nearby_search(input_dict: NearbySearchInput):
|
72 |
"""Searches for many places nearby the location based on a keyword. using keyword like \"coffee shop\", \"restaurants\". radius is the range to search from the location."""
|
73 |
print("function call nearby_search", input_dict, "\n")
|
@@ -110,7 +110,7 @@ def nearby_search(input_dict: NearbySearchInput):
|
|
110 |
return strout[:800]
|
111 |
|
112 |
|
113 |
-
@tool
|
114 |
def nearby_dense_community(input_dict: NearbyDenseCommunityInput) -> str:
|
115 |
""" getting nearby dense community such as (community mall, hotel, school, etc), by location name, radius(in meters)
|
116 |
return list of location community nearby, name, community type.
|
@@ -141,7 +141,7 @@ def nearby_dense_community(input_dict: NearbyDenseCommunityInput) -> str:
|
|
141 |
return strout.strip()[:800]
|
142 |
|
143 |
|
144 |
-
@tool
|
145 |
def google_search(keyword:str):
|
146 |
"""Search Google for recent results. Using keyword as a text query search in google."""
|
147 |
print("function call google_search", keyword, "\n")
|
@@ -197,10 +197,26 @@ population_doc_retriever = create_retriever_tool(
|
|
197 |
)
|
198 |
# google_search = Tool(
|
199 |
# name="google_search",
|
200 |
-
# description="Search Google for recent results.",
|
201 |
-
# func=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
# )
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
32 |
|
33 |
|
34 |
# %%
|
35 |
+
# @tool
|
36 |
def find_place_from_text(location:str):
|
37 |
"""Finds a place location and related data from the query text"""
|
38 |
print("function call find_place_from_text", location)
|
39 |
result = gplace.find_place_from_text(location)
|
40 |
r = result['candidates'][0]
|
41 |
+
# location: {r['geometry']['location']}\n
|
42 |
return f"""
|
43 |
+
# address: {r['formatted_address']}\n
|
|
|
44 |
location_name: {r['name']}\n
|
45 |
"""
|
46 |
# return f"""
|
|
|
67 |
# return strout
|
68 |
|
69 |
|
70 |
+
# @tool
|
71 |
def nearby_search(input_dict: NearbySearchInput):
|
72 |
"""Searches for many places nearby the location based on a keyword. using keyword like \"coffee shop\", \"restaurants\". radius is the range to search from the location."""
|
73 |
print("function call nearby_search", input_dict, "\n")
|
|
|
110 |
return strout[:800]
|
111 |
|
112 |
|
113 |
+
# @tool
|
114 |
def nearby_dense_community(input_dict: NearbyDenseCommunityInput) -> str:
|
115 |
""" getting nearby dense community such as (community mall, hotel, school, etc), by location name, radius(in meters)
|
116 |
return list of location community nearby, name, community type.
|
|
|
141 |
return strout.strip()[:800]
|
142 |
|
143 |
|
144 |
+
# @tool
|
145 |
def google_search(keyword:str):
|
146 |
"""Search Google for recent results. Using keyword as a text query search in google."""
|
147 |
print("function call google_search", keyword, "\n")
|
|
|
197 |
)
|
198 |
# google_search = Tool(
|
199 |
# name="google_search",
|
200 |
+
# description="Search Google for recent results. Using keyword as a text query search in google.",
|
201 |
+
# func=google_search,
|
202 |
+
# )
|
203 |
+
# find_place_from_text = Tool(
|
204 |
+
# name="find_place_from_text",
|
205 |
+
# description="Finds a place location and related data from the query text",
|
206 |
+
# func=find_place_from_text,
|
207 |
+
# )
|
208 |
+
# nearby_search = Tool(
|
209 |
+
# name="nearby_search",
|
210 |
+
# description="""Searches for many places nearby the location based on a keyword. using keyword like \"coffee shop\", \"restaurants\". radius is the range to search from the location.""",
|
211 |
+
# func=nearby_search,
|
212 |
+
# )
|
213 |
+
# nearby_dense_community = Tool(
|
214 |
+
# name="nearby_dense_community",
|
215 |
+
# description="""getting nearby dense community such as (community mall, hotel, school, etc), by location name, radius(in meters)
|
216 |
+
# return list of location community nearby, name, community type""",
|
217 |
+
# func=nearby_dense_community,
|
218 |
# )
|
219 |
+
google_search = tool(google_search)
|
220 |
+
find_place_from_text = tool(find_place_from_text)
|
221 |
+
nearby_search = tool(nearby_search)
|
222 |
+
nearby_dense_community = tool(nearby_dense_community)
|