Retrieve real-time weather information for a location with Google GenAI

This example pipeline demonstrates how to fetch real-time weather information for a location with Google GenAI.

  1. Configure the JSON Generator Snap with your prompt in the Edit JSON field. For example,
    [
      {
          "contents": [
            {
              "content": "You are a friendly and helpful assistant that is equipped with some tools; please use your judgment to decide whether to use the tools or not to answer questions from the user.\nQuestion: What's the weather of San Francisco?",
              "sl_role": "USER"
            }
          ],
          "required":"getWeather"
      }
    ]
  2. Configure the Google GenAI Function Generator Snap to define a function (getWeather) and provide the description as shown below.

    On validation, the Snap displays the generated function definition along with the specfied descriptions.

    Google GenAI Function Generator Snap configuration Google GenAI Function Generator Snap output

    Google GenAI Function Generator Snap configuration


    Google GenAI Function Generator Snap output

  3. Configure the Google Gemini API Tool Calling Snap as follows to fetch the getWeather tool:

    On validation, the Snap displays the getWeather tool call details, including the function name and its arguments such as the unit (Celsius) and city (San Francisco, CA). This ensures the tool is properly retrieved and ready for use in subsequent workflow.

    Google Gemini API Tool Calling Snap configuration Google Gemini API Tool Calling Snap output

    Google Gemini API Tool Calling Snap configuration


    Google Gemini API Tool Calling Snap output

  4. Configure the Pipeline Execute Snap to run the Weather API pipeline and fetch weather data.

    On validation, the Snap displays the weather details, including location information (name, region, country, lat, lon, etc.) and current temperature data (temp_c, temp_f, last_updated).

    Pipeline Execute Snap configuration Pipeline Execute Snap output

    Pipeline Execute Snap configuration


    Pipeline Execute Snap output

  5. Configure the Google GenAI Function Result Generator Snap to fetch the results with the required tool.

    On validation, the Snap displays the weather data results, including the location and current weather information, based on the specified tool configurations.

    Google GenAI Function Result Generator Snap configuration Google GenAI Function Result Generator Snap output

    Google GenAI Function Result Generator Snap configuration


    Google GenAI Function Result Generator Snap output

To successfully reuse pipelines:
  1. Download and import the pipeline in to the SnapLogic Platform.
  2. Configure Snap accounts, as applicable.
  3. Provide pipeline parameters, as applicable.