Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat(client): allow more params.(like langfuse_version, etc) #1165

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
Loading
from

Conversation

XenoAmess
Copy link

@XenoAmess XenoAmess commented Apr 16, 2025

Important

Enhance on_chain_start in langchain.py to dynamically update trace-level parameters using metadata prefixed with langfuse_.

  • Behavior:
    • In on_chain_start in langchain.py, trace-level information is updated with metadata keys prefixed by langfuse_.
    • This allows dynamic updates to parameters like session_id and user_id based on metadata.
  • Misc:
    • Refactored code to use a dictionary update_dict for updating trace information.

This description was created by Ellipsis for 0b4f495. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Added support for dynamic trace parameter updates through metadata prefixing in the langchain callback handler, but introduced a bug that breaks existing functionality.

  • Fixed bug in on_chain_start where session_id and user_id are incorrectly set to None instead of using metadata values
  • Added support for dynamic parameter updates via langfuse_ prefixed metadata keys
  • Improved code organization by collecting updates in a dictionary before applying to trace
  • Maintained backward compatibility for existing metadata parameter handling

The main issue is that the current implementation always sets session_id and user_id to None in the update_dict, overriding any values that may have been set in metadata. This needs to be fixed to preserve the existing functionality while adding support for the new dynamic parameters.

💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

langfuse/callback/langchain.py Outdated Show resolved Hide resolved
langfuse/callback/langchain.py Show resolved Hide resolved
langfuse/callback/langchain.py Outdated Show resolved Hide resolved
@XenoAmess XenoAmess force-pushed the feature-more-params branch from 0b4f495 to 04fb8bd Compare April 16, 2025 11:08
@XenoAmess XenoAmess closed this Apr 16, 2025
@XenoAmess XenoAmess reopened this Apr 16, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@XenoAmess XenoAmess force-pushed the feature-more-params branch from 1b95ebb to 465b18d Compare April 28, 2025 06:07
@hassiebp
Copy link
Contributor

hassiebp commented May 5, 2025

@XenoAmess Thanks for raising this! As per our contributing guide, could you please open a Github issue / discussion first to lay out your line of thinking for this change to continue the discussion there on why this should be merged / this feature is necessary?

@XenoAmess XenoAmess changed the title feat(client): allow more params.(like langfuse_environment, langfuse_version, etc) feat(client): allow more params.(like langfuse_version, etc) May 6, 2025
@XenoAmess
Copy link
Author

@XenoAmess Thanks for raising this! As per our contributing guide, could you please open a Github issue / discussion first to lay out your line of thinking for this change to continue the discussion there on why this should be merged / this feature is necessary?

sure, at https://github.com/orgs/langfuse/discussions/6697

@XenoAmess XenoAmess force-pushed the feature-more-params branch from 465b18d to f8fcb4f Compare May 7, 2025 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.