Predictive Intelligence Error, 301 : SolutionName is empty

MattStoodley
Tera Contributor

Hi all.

I've been building a predictive intelligence Assignment Group  Assigner

following Multi-Method Assignment Group Prediction with Now ... - ServiceNow Community
 
However the build of the Predictive Intelligence part is causing problems.

I have definitely selected the 'Solution Name' as I create the tool. and the solution definitely exists as I chose it from the dropdown when creating the tool.

However, when I run the tool I get the error:

"301: SolutionName is empty"

The 'request' appears to send a json object which includes the 'short_description' and the 'topnresults' but does not contain a 'SolutionName' field.

Should it.

If so how can I fix this?



 

1 ACCEPTED SOLUTION

qprinsloo
Mega Sage

Hi @MattStoodley , I ran into the exact same issue getting the 301: Solution Name is empty in the PI tool output. Searching for an answer I came across your question. Were you able to solve it? I'm about to open a case with support myself since this seems to be an issue with the Predictive Intelligence tool itself in Now Assist Skill kit since there is no configuration available besides just selecting the 'Solution label'.

 

As a work around to keep going, I instead opted to add an additional script tool and call the solution directly using the below script. This is working for me.  Just replace with your solution name obviously. 

(function runScript(context) {

    var solutionName =
        "ml_yoursolutionnamehere";

    try {

        var shortDescription =
            context.getValue("incident.short_description") || "";

        var description =
            context.getValue("incident.description") || "";

        var mlSolution =
            sn_ml.MLSolutionFactory.getSolution(solutionName);

        var response =
            mlSolution.predict([{
                short_description: shortDescription,
                description: description
            }], {
                top_n: 3
            });

        var result = JSON.parse(response);
        var predictions = result["1"] || [];

        return JSON.stringify({
            prediction_found: predictions.length > 0,
            prediction_count: predictions.length,
            predictions: predictions.map(function(p) {
                return {
                    assignment_group: p.predictedValue || "",
                    assignment_group_sys_id: p.predictedSysId || "",
                    confidence: p.confidence || 0,
                    threshold: p.threshold || 0
                };
            })
        });

    } catch (e) {

        return JSON.stringify({
            prediction_found: false,
            error: e.message
        });
    }

})(context);

 

View solution in original post

6 REPLIES 6

qprinsloo
Mega Sage

Hi @MattStoodley , I ran into the exact same issue getting the 301: Solution Name is empty in the PI tool output. Searching for an answer I came across your question. Were you able to solve it? I'm about to open a case with support myself since this seems to be an issue with the Predictive Intelligence tool itself in Now Assist Skill kit since there is no configuration available besides just selecting the 'Solution label'.

 

As a work around to keep going, I instead opted to add an additional script tool and call the solution directly using the below script. This is working for me.  Just replace with your solution name obviously. 

(function runScript(context) {

    var solutionName =
        "ml_yoursolutionnamehere";

    try {

        var shortDescription =
            context.getValue("incident.short_description") || "";

        var description =
            context.getValue("incident.description") || "";

        var mlSolution =
            sn_ml.MLSolutionFactory.getSolution(solutionName);

        var response =
            mlSolution.predict([{
                short_description: shortDescription,
                description: description
            }], {
                top_n: 3
            });

        var result = JSON.parse(response);
        var predictions = result["1"] || [];

        return JSON.stringify({
            prediction_found: predictions.length > 0,
            prediction_count: predictions.length,
            predictions: predictions.map(function(p) {
                return {
                    assignment_group: p.predictedValue || "",
                    assignment_group_sys_id: p.predictedSysId || "",
                    confidence: p.confidence || 0,
                    threshold: p.threshold || 0
                };
            })
        });

    } catch (e) {

        return JSON.stringify({
            prediction_found: false,
            error: e.message
        });
    }

})(context);

 

Thanks, Yes, I did solve it in basically the same way in the end.  Thanks for documenting your answer, That'll save someone a lot of trouble.

Hi @qprinsloo,

 

Regarding your solution, as I am experiencing the same error and new to NASK building, could you correct me if I'm wrong, but will I be creating a new Script Tool that would connect from the "fetchDetailsIncident" script tool, essentially having 4 tools that connect from it? 

 

Then you are making the change to the Prompt to ensure you set the correct output for the PI pre-trained machine learning model. Am I correct?

 

JoelO_0-1793149052573.png

 

Much appreciate your assistance. 

qprinsloo
Mega Sage

@Joel O , correct that is how the example by Joost was setup. However, you don't necessarily need all 4 to depend on the 'fetchDetailsIncident' tool since some (like the group lookup) just returned all active ITIL groups. Anything that depends on the output from that initial tool though should connect and run after it.

Also, just FYI, in my testing the agent was not consistently passing the incident record/info down to the skill and downstream tools. Attempts to adjust the prompts and data passed were not successful. I've since moved this fully to the Agent layer and do not call the custom skill at all. This example uses an agent already but then calls the custom skill. Well, in testing, the is where the disconnect was occurring sometimes and Agent was not consistently passing the right target incident input to the skill or the skill would drop come context at times. Thus, I've moved the skill functionality fully to the initial agent layer. Its a similar approach but just bypasses having to use a custom skill at all. The agent then does the group lookup, PI confidence, etc. This is still in UAT on our end before going to production but that switch to eliminate the skill has made it more reliable. I've also added a knowledge guidance tool as well. Ignore that in the example images below.

 

  

Snag_5dd30cf.png

 

Snag_5dd53a9.png