How to get the predicted intent with confidence using agent

I am loading the trained rasa models manually by using this

agent = Agent.load(
                model,
                action_endpoint=EndpointConfig(ACTION_ENDPOINT)
            )

And i am predicting the result like this

botResponse = await agent.handle_text(query)

but this just returns the response as text, but i need the confidence and intent name as well

I tried the handle_message but still it does not give confidence.

I used two different apis of rasa to achieve the same

To get the intent and confidence of the query parse_message_using_nlu_interpreter and to get the response handle_text

queryResponseList = await agent.handle_text(query)
intentInfo = await agent.parse_message_using_nlu_interpreter(query)
intent = Intent(**{
            "name": intentInfo["intent"]["name"],
            "confidence": intentInfo["intent"]["confidence"]
        })

If you’re really just curious about the confidence values for intents, you might find this blogpost useful.

1 Like