INNER CODE UNIT · Python
handler_feedback
meetbryce/open-source-slack-ai · ossai/handlers.py:21
def handler_feedback(body):
"""
Handler for the feedback buttons that passes the feedback to Langsmith.
"""
client = Client()
actions_data = body.get("actions")[0]
run_id = actions_data.get("value")
action_id = actions_data.get("action_id")
score = 0.0
if action_id == "not_helpful_button":
score = -1.0
elif action_id == "helpful_button":
score = 1.0
elif action_id == "very_helpful_button":
score = 2.0