feat(client): allow updating span/generation name#1255
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Disclaimer: Experimental PR review
Greptile Summary
This PR introduces the ability to update span and generation names after their initial creation in the Langfuse Python SDK. This is a significant usability enhancement that allows developers to dynamically rename spans during execution when the appropriate name might only be known after some processing or based on runtime conditions.
The changes include:
update()method for bothLangfuseSpanandLangfuseGenerationclassesupdate_name()methodspan.update()) and context-based updates (update_current_span)The implementation maintains consistency with existing SDK patterns and leverages OpenTelemetry's standard conventions.
Confidence score: 5/5
langfuse/_client/span.pyas it contains the core implementation of the new functionality3 files reviewed, no comments
Edit PR Review Bot Settings | Greptile
Important
Add functionality to update span and generation names in Langfuse client, with tests verifying the updates.
nameparameter toupdate_current_generation()andupdate_current_span()inclient.pyto allow updating the name of the current generation and span.LangfuseSpan.update()andLangfuseGeneration.update()inspan.pyto support name updates.nameis provided, the OpenTelemetry span name is updated usingupdate_name().test_update_current_span_name()andtest_update_current_generation_name()intest_otel.pyto verify span and generation name updates.test_span_name_update()andtest_generation_name_update()to verify direct updates viaupdate()method.This description was created by
for e8a0839. You can customize this summary. It will automatically update as commits are pushed.