-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback api fix #1045
Fallback api fix #1045
Conversation
kairon/history/processor.py
Outdated
])) | ||
action_counts = list(conversations.aggregate([{"$match": {"$and": [ | ||
{"type": "flattened"}, | ||
{"data.intent": {"$nin": ['action_listen', 'action_session_start']}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are not actions, can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, why is this named as action_count? isnt it actually a count of total conversation steps?
kairon/history/processor.py
Outdated
{"$project": {"_id": 1, "count": 1}} | ||
], allowDiskUse=True) | ||
) | ||
new_session = list(conversations.aggregate([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
] | ||
} | ||
}}, | ||
{"$match": {'$or': [{"events.name": fallback_action}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use nlu_fallback action for filtering here
{"$sort": {"event.timestamp": 1}}, | ||
{"$group": {"_id": "$sender_id", "events": {"$push": "$event"}}}, | ||
{"$addFields": {"last_event": {"$last": "$events"}}}, | ||
{"$match": {'$or': [{"last_event.name": fallback_action}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use nlu_fallback action for filtering here
conversations.aggregate([ | ||
{"$match": {"event.timestamp": {"$gte": Utility.get_timestamp_from_date(from_date), | ||
"$lte": Utility.get_timestamp_from_date(to_date)}, | ||
"event.name": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use nlu_fallback, action_session_start action for filtering here
] | ||
} | ||
}}, | ||
{"$match": {'$or': [{"events.name": fallback_action}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
{"$sort": {"event.timestamp": 1}}, | ||
{"$group": {"_id": "$sender_id", "events": {"$push": "$event"}}}, | ||
{"$addFields": {"last_event": {"$last": "$events"}}}, | ||
{"$match": {'$or': [{"last_event.name": fallback_action}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
kairon/history/processor.py
Outdated
{"$project": {"_id": 1, "count": 1}} | ||
], allowDiskUse=True) | ||
) | ||
new_session = list(conversations.aggregate([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
|
||
assert hit_fall_back["fallback_count"] == 100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests should pass without modifying them
Fixed fallback api issue in analytics page.