-
Notifications
You must be signed in to change notification settings - Fork 14.1k
feat: add langfuse llm node input and output #16924
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
Conversation
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.
Pull Request Overview
This PR implements language model tracing with enhanced logging and token usage tracking by integrating Langfuse for llm node input and output.
- Update exception logging to include error details in ops_trace_task.py.
- Retrieve token usage from Message records and correctly assign input and output tokens in langfuse_trace.py.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
api/tasks/ops_trace_task.py | Augmented exception handling with detailed logging. |
api/core/ops/langfuse_trace/langfuse_trace.py | Added token usage tracking by querying Message data; potential inversion in token assignment. |
Comments suppressed due to low confidence (1)
api/tasks/ops_trace_task.py:52
- Consider using logging.error instead of logging.info when logging errors to more clearly indicate failure events.
logging.info(f"Processing trace tasks failed, app_id: {app_id}, error: {e}")
@ZhouhaoJiang Only one can be correct I think the fix you wrote, repeat the TOTAL workflow consumption in every single node. In fact if you sum the total token of the LLM + total token of the Extraction it adds up to 1827 @crazywoola This is a product that subscribers pay for... c'mon... DON'T Release this PR it is going to break analytical data for thousand of users.... |
This reverts commit 82189e1.
Summary
Fix #14272
Fix #13951
Tip
Close issue syntax:
Fixes #<issue number>
orResolves #<issue number>
, see documentation for more details.Screenshots
Now

Before

Checklist
Important
Please review the checklist below before submitting your pull request.
dev/reformat
(backend) andcd web && npx lint-staged
(frontend) to appease the lint gods