Skip to content
Discussion options

You must be logged in to vote

You can assign custom names to generation observations using the name parameter when creating them with the context manager.

Using the Context Manager

When using start_as_current_observation(), pass the name parameter directly:

from langfuse import get_client

langfuse = get_client()

with langfuse.start_as_current_observation(as_type="span", name="outer-process") as outer_span:
    
    with langfuse.start_as_current_observation(as_type="generation", name="llm-step-1") as gen1:
        # gen1 is active, child of outer_span
        gen1.update(output="LLM 1 output")
    
    with langfuse.start_as_current_observation(as_type="generation", name="llm-step-2") as gen2:
        # gen2 is acti…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Lotte-Verheyden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant