feat(client): allow more params.(like langfuse_version, etc)
[!IMPORTANT] Enhance
on_chain_startinlangchain.pyto dynamically update trace-level parameters using metadata prefixed withlangfuse_.
- Behavior:
- In
on_chain_startinlangchain.py, trace-level information is updated with metadata keys prefixed bylangfuse_.- This allows dynamic updates to parameters like
session_idanduser_idbased on metadata.- Misc:
- Refactored code to use a dictionary
update_dictfor updating trace information.This description was created by
for 0b4f495ae1c9144f0d249718c819b146c08cb5a2. 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_startwheresession_idanduser_idare 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 👍/👎!
@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 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
Thanks for raising this @XenoAmess - please upgrade to the Langfuse SDK v3 as the v2 will only get critical bug fixes and security patches