Weather Assistant with Tool Calling

This example pipeline creates an AI-powered weather assistant that uses Azure OpenAI's tool calling capabilities to answer weather-related questions. When a user asks about weather in a specific location, the system determines whether to use external weather API tools, makes the appropriate API calls, and returns formatted responses through the AI assistant.

  1. Configure the JSON Generator Snap to generate a JSON request containing a user message "What's the weather in Hyderabad?" with instructions for the AI assistant to use available tools.
  2. Configure the Azure OpenAI Function Generator Snap to create a function definition called get_weather that can retrieve current weather information for a given location, with a city parameter.
    Azure OpenAI Function Generator Snap configuration Azure OpenAI Function Generator Snap output

    Azure OpenAI Function Generator Snap configuration


    Azure OpenAI Function Generator Snap output

  3. Configure the Azure OpenAI Tool Calling Snap to call the Azure OpenAI GPT-4o-mini model with tool calling capabilities, using the original messages and generated tools to determine the appropriate response.

    On validation, the Snap displays the processed response from Azure OpenAI.

    Azure OpenAI Tool Calling Snap configuration Azure OpenAI Tool Calling Snap output

    Azure OpenAI Tool Calling Snap configuration


    Azure OpenAI Tool Calling Snap output

  4. Configure the HTTP Client Snap to handle additional HTTP requests if needed for external services during processing.
  5. Configure the Mapper Snap to map and format the OpenAI response to the desired structure.
  6. Configure the Azure OpenAI Function Result Generator Snap to create a function definition called get_weather that can retrieve current weather information for a given location, with a city parameter.
    On validation, it generates a properly formatted function result using the function ID and weather content for the AI model to process.
To successfully reuse this pipeline:
  1. Download and import the pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide pipeline parameters as needed.