Passing Function output tools to AOAI assistants through logic App

Mohamed Hussein 510 Reputation points
2024-12-20T19:11:36.0533333+00:00

Good Day,

I'm trying to pass function outputt tools of AOAI assistants through Logic Apps Standardplan

concatenating strings and pass them as body of function tools,

It works with a single output

but when tried on multiple outputs, it returns error

Operating RunID (single output)
08584669522185349404430240422CU00

Failed RunID (mutliple output using string concatenation)
08584668862834659534641351337CU00

User's image

User's image

{
    "tool_call_id": "@{body('ParseJSONRunStatusLoop').required_action.submit_tool_outputs.tool_calls[variables('FuncToolIndexVar')].id}",
    "output": "@{body('ParseJSONSearchBing')}"
},

{
  "error": {
    "message": "Invalid type for 'tool_outputs[0]': expected an object, but got a string instead.",
    "type": "invalid_request_error",
    "param": "tool_outputs[0]",
    "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,275 questions
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,451 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sina Salam 14,551 Reputation points
    2024-12-21T18:55:16.2833333+00:00

    Hello Mohamed Hussein,

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

    I understand that you are having issue with passing Function output tools to AOAI assistants through logic App.

    Regarding the image and the error you encountered, it is clear that:

    • The tool_outputs expects an array of objects, not a single string or concatenated string.
    • When concatenating multiple outputs, they must be converted into valid objects before being included in the tool_outputs array.

    Use this video https://youtu.be/lbb_ZrSQh_A from YouTube to see how you can address the potential challenge of ensuring the correct JSON schema for Azure OpenAI's input.

    Understand this:

    • Likely passed as a string, which is acceptable as tool_outputs[0] in some cases.
    • Strings cannot be concatenated directly; the API expects an array of objects, and passing concatenated strings breaks the schema.

    This is a correct JSON Body for Multiple Outputs should be similar to this example:

       {
           "tool_call_id": "@{body('ParseJSONRunStatusLoop').required_action.submit_tool_outputs.tool_calls[variables('FuncToolIndexVar')].id}",
           "tool_outputs": [
               { "output": "@{body('ParseJSONSearchBing')}" },
               { "output": "@{body('AnotherFunctionOutput')}" }
           ]
       }
    

    I hope this is helpful! Do not hesitate to let me know if you need more steps and 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.