[PR #32329] feat: send user feedback to Langfuse as scores #33672

Open
opened 2026-02-21 20:53:42 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32329

State: open
Merged: No


Summary

Closes #27286

  • Adds a new FEEDBACK_TRACE type to the async tracing pipeline so user feedback (thumbs up/down) is forwarded to Langfuse as scores
  • Implements langfuse_client.score() integration converting "like" to 1.0 and "dislike" to 0.0 with data_type="BOOLEAN"
  • Adds no-op dispatch in all other trace providers (LangSmith, Opik, Weave, Arize/Phoenix, Aliyun, MLflow, Tencent) to prevent crashes
  • Dispatches feedback trace from both the service layer (MessageService.create_feedback()) and console controller (MessageFeedbackApi.post())

Test plan

  • 12 new unit tests covering entity creation, serialization, enum values, TraceTask preprocessing, Langfuse score calls (like/dislike), dispatch via trace(), and error handling
  • All 88 existing ops tests continue to pass
  • Ruff linting passes on all changed files
  • Manual verification: submit thumbs up/down in Dify UI, confirm score appears in Langfuse dashboard
**Original Pull Request:** https://github.com/langgenius/dify/pull/32329 **State:** open **Merged:** No --- ## Summary Closes #27286 - Adds a new `FEEDBACK_TRACE` type to the async tracing pipeline so user feedback (thumbs up/down) is forwarded to Langfuse as scores - Implements `langfuse_client.score()` integration converting "like" to 1.0 and "dislike" to 0.0 with `data_type="BOOLEAN"` - Adds no-op dispatch in all other trace providers (LangSmith, Opik, Weave, Arize/Phoenix, Aliyun, MLflow, Tencent) to prevent crashes - Dispatches feedback trace from both the service layer (`MessageService.create_feedback()`) and console controller (`MessageFeedbackApi.post()`) ## Test plan - [x] 12 new unit tests covering entity creation, serialization, enum values, TraceTask preprocessing, Langfuse score calls (like/dislike), dispatch via `trace()`, and error handling - [x] All 88 existing ops tests continue to pass - [x] Ruff linting passes on all changed files - [ ] Manual verification: submit thumbs up/down in Dify UI, confirm score appears in Langfuse dashboard
yindo added the pull-request label 2026-02-21 20:53:42 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33672