CsabaConsulting / InspectorGadgetApp

Open Multi-Modal Personal Assistant
MIT License
3 stars 1 forks source link

Provide geolocation tool function with Open Meteo #40

Open MrCsabaToth opened 2 weeks ago

MrCsabaToth commented 2 weeks ago

A new article shows weather forecast interaction with multiple rounds of function calls similarly to my example: https://medium.com/google-cloud/deep-dive-into-function-calling-in-gemini-b62e2618e3a7

The difference is that it doesn't only work with the current location, but also with any named geographic entity name. This is because it uses Open Meteo, which has a free API for converting location names to lat / lon.

MrCsabaToth commented 1 week ago

GET https://geocoding-api.open-meteo.com/v1/search?name=Yosemite%20Valley&count=1 Response:

{
  "results": [
    {
      "id": 7262586,
      "name": "Yosemite Valley",
      "latitude": 37.74075,
      "longitude": -119.57788,
      "elevation": 1208,
      "feature_code": "PPL",
      "country_code": "US",
      "admin1_id": 5332921,
      "admin2_id": 5370594,
      "timezone": "America/Los_Angeles",
      "population": 1035,
      "country_id": 6252001,
      "country": "United States",
      "admin1": "California",
      "admin2": "Mariposa"
    }
  ],
  "generationtime_ms": 1.2050867
}

GET https://geocoding-api.open-meteo.com/v1/search?name=Little%20Yosemite%20Valley&count=1

{
  "generationtime_ms": 0.8980036
}

GET https://geocoding-api.open-meteo.com/v1/search?name=Forestiere%20Underground%20Gardens&count=1 {"generationtime_ms":1.3049841}