my issue is the following:
I created Form Processing models that give the same output given the inputs of "Document Type" (1) and specified "Document" (2). Due to differing layouts they need to be in separate models. What currently works is to call each model individually with their own Predict connector in a child flow and then use the output in the parent flow. When I try to put a variable as the model name, my model specific inputs (1) and (2) throw an error and instead a new generic input "Body" appears.
My current implementation requires one child flow per model. Is there a way to call the AI Builder models dynamically, i.e. save the model name to be called in a string variable defined at the beginning of the flow and use this as the "Model" input?
Thanks in advance.
Solved! Go to Solution.
Thanks for posting the question.
Today it's not possible to set the AI Builder model dynamically on the predict action, although it something we are looking to enable.
One approach I can think of is that you could call various predict actions within a single flow, and after each predict action you set as many variables as outputs you want to get from the model and then use those variable in successive steps in your flow. Here is an example:
If this doesn't fit your needs, there is a workaround you might look into (but I need to warn you that we don't officially support it 🙂). This consists on using the Perform a bound action action on the Common Data Service (current environment) connector. In here you:
- Select as Entity name: AI Models
- Set as Action name: predict
- In Item id (1) you can dynamically specify the id of the AI Builder model you want to call.
- Set version as: 1.0
- On the request: Set the content type of the file you want to analyze (2) and provide a base 64 string of the file to analyze (3) within the structure you see on the screenshot.
When this action gets executed, you will get a JSON response that you can parse.
Let us know if this helps and what approach you end up taking!
Thanks a lot @JoeF-MSFT ,
a solution like the second one with the "Perform a bound action" action is what I was looking for.
Unfortunately, I can't quite make it work yet. Power Automate reads the "request" input as a string and embeds it in quotation marks:
As I understand the correct syntax ought to be: