您可以从tracker_store
. Agent
为此,首先确保您在调用时传递了发件人 ID agent.handle_text(query, sender_id="some sender id")
。然后使用以下命令检索跟踪器:
current_tracker = agent.get_or_create_tracker(sender_id="some sender id")
拥有跟踪器后,您可以使用以下命令检索最后发送消息的 NLU 解析数据:
user_event = tracker.get_last_event_for(UserUttered)
if user_event:
nlu_parse_data = user_event.parse_data
nlu_parse_data
应该是这样的:
"text": "Hi MoodBot.",
"parse_data": {
"intent": {
"id": 3068390702409455462,
"name": "greet",
"confidence": 0.9968197345733643
},
"entities": [],
"text": "Hi MoodBot.",
"message_id": "47efa155fc234abea554242883f0a74e",
"metadata": {},
"intent_ranking": [
{
"id": 3068390702409455462,
"name": "greet",
"confidence": 0.9968197345733643
},
{
"id": -7997748339392136471,
"name": "bot_challenge",
"confidence": 0.0019184695556759834
},
{
"id": -3856210704443307570,
"name": "mood_unhappy",
"confidence": 0.0010514792520552874
},