Submitting function output to AOAI assistants through Logic App

Mohamed Hussein 550 Reputation points
2024-12-21T06:09:18.95+00:00

Good Day,

Hope all is well,

I'm submitting function requirments to AoAI assistants through Logic App standard plan

The JSON appears fine for me, and validated by JSON lint, however, i'm getting the following error

Logc App RunID 08584668462503611523293456058CU00


{
  "tool_outputs": [
    {
      "tool_call_id": "call_A9EwGg8ldWuRbvGGrB53IjvW",
      "output": {
        "_type": "SearchResponse",
        "queryContext": {
          "originalQuery": "current temperature in Cairo"
        },
        "webPages": {
          "webSearchUrl": "https://www.bing.com/search?q=current+temperature+in+Cairo",
          "totalEstimatedMatches": 1670000,
          "value": [
            {
              "id": "https://api.bing.microsoft.com/api/v7/#WebPages.0",
              "name": "Cairo, Cairo, Egypt Weather Forecast | AccuWeather",
              "url": "https://www.accuweather.com/en/eg/cairo/127164/weather-forecast/127164",
              "isFamilyFriendly": true,
              "displayUrl": "https://www.accuweather.com/en/eg/cairo/127164/weather-forecast/127164",
              "snippet": "Cairo, Cairo, Egypt Weather Forecast, with current conditions, wind, air quality, and what to expect for the next 3 days.",
              "deepLinks": [
                {
                  "name": "Monthly",
                  "url": "https://www.accuweather.com/en/eg/cairo/127164/august-weather/127164",
                  "snippet": "Get the monthly weather forecast for Cairo, Cairo, Egypt, including daily high/low, historical averages, to help you plan ahead."
                },
                {
                  "name": "Daily",
                  "url": "https://www.accuweather.com/en/eg/cairo/127164/daily-weather-forecast/127164",
                  "snippet": "Know what's coming with AccuWeather's extended daily forecasts for Cairo, Cairo, Egypt. Up to 90 days of daily highs, lows, and precipitation chances."
                },
                {
                  "name": "March",
                  "url": "https://www.accuweather.com/en/eg/cairo/127164/march-weather/127164",
                  "snippet": "Get the monthly weather forecast for Cairo, Cairo, Egypt, including daily high/low, historical averages, to help you plan ahead."
                },
                {
                  "name": "Hourly",
                  "url": "https://www.accuweather.com/en/eg/cairo/127164/hourly-weather-forecast/127164",
                  "snippet": "Hourly weather forecast in Cairo, Cairo, Egypt. Check current conditions in Cairo, Cairo, Egypt with radar, hourly, and more."
                },
                {
                  "name": "92 Sunny",
                  "url": "https://www.accuweather.com/en/eg/cairo/127164/daily-weather-forecast/127164?day=2",
                  "snippet": "We would like to show you a description here but the site won’t allow us."
                },
                {
                  "name": "Egypt Weather Radar",
                  "url": "https://www.accuweather.com/en/eg/national/weather-radar",
                  "snippet": "See the latest Egypt Doppler radar weather map including areas of rain, snow and ice. Our interactive map allows you to see the local & national weather"
                }
              ],
              "dateLastCrawled": "2024-12-20T03:50:00.0000000Z",
              "language": "en",
              "isNavigational": true,
              "noCache": false,
              "siteName": "AccuWeather"
            }
          ]
        },
        "relatedSearches": {
          "id": "https://api.bing.microsoft.com/api/v7/#RelatedSearches",
          "value": [
            {
              "text": "cairo weather forecast 15 days",
              "displayText": "cairo weather forecast 15 days",
              "webSearchUrl": "https://www.bing.com/search?q=cairo+weather+forecast+15+days"
            },
            {
              "text": "cairo weather forecast 14 days",
              "displayText": "cairo weather forecast 14 days",
              "webSearchUrl": "https://www.bing.com/search?q=cairo+weather+forecast+14+days"
            },
            {
              "text": "weather in cairo 10 days",
              "displayText": "weather in cairo 10 days",
              "webSearchUrl": "https://www.bing.com/search?q=weather+in+cairo+10+days"
            },
            {
              "text": "weather in cairo this week",
              "displayText": "weather in cairo this week",
              "webSearchUrl": "https://www.bing.com/search?q=weather+in+cairo+this+week"
            },
            {
              "text": "celcius at egypt right now",
              "displayText": "celcius at egypt right now",
              "webSearchUrl": "https://www.bing.com/search?q=celcius+at+egypt+right+now"
            },
            {
              "text": "weather in cairo tomorrow",
              "displayText": "weather in cairo tomorrow",
              "webSearchUrl": "https://www.bing.com/search?q=weather+in+cairo+tomorrow"
            },
            {
              "text": "cairo egypt weather forecast",
              "displayText": "cairo egypt weather forecast",
              "webSearchUrl": "https://www.bing.com/search?q=cairo+egypt+weather+forecast"
            },
            {
              "text": "egypt weather news today",
              "displayText": "egypt weather news today",
              "webSearchUrl": "https://www.bing.com/search?q=egypt+weather+news+today"
            }
          ]
        },
        "rankingResponse": {
          "mainline": {
            "items": [
              {
                "answerType": "WebPages",
                "resultIndex": 0,
                "value": {
                  "id": "https://api.bing.microsoft.com/api/v7/#WebPages.0"
                }
              },
              {
                "answerType": "RelatedSearches",
                "value": {
                  "id": "https://api.bing.microsoft.com/api/v7/#RelatedSearches"
                }
              }
            ]
          }
        }
      }
    }
  ]
}
{
  "type": "Http",
  "inputs": {
    "uri": "https://huswabagpt.openai.azure.com/openai/threads/@{variables('ThreadIDParam')}/runs/@{variables('RunIDVar')}/submit_tool_outputs?api-version=2024-08-01-preview",
    "method": "POST",
    "headers": {
      "Content-Type": "application/json",
      "api-key": "@{parameters('AoAiAsstKey')}"
    },
    "body": "@outputs('JSONofRequestBody')"
  },
  "runAfter": {
    "JSONofRequestBody": [
      "Succeeded"
    ]
  },
  "runtimeConfiguration": {
    "contentTransfer": {
      "transferMode": "Chunked"
    }
  }
}


{
  "error": {
    "message": "Invalid type for 'tool_outputs[0].output': expected a string, but got an object instead.",
    "type": "invalid_request_error",
    "param": "tool_outputs[0].output",
    "code": "invalid_type"
  }
}
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,279 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,455 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sina Salam 14,616 Reputation points
    2024-12-22T20:15:07.31+00:00

    Hello Mohamed Hussein,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you're having issue when submitting function output to AOAI assistants through Logic App.

    Regarding the error, and the code you posted: To resolve it, you need to ensure that the output field is a string, not an object.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.