Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,19 @@ with langfuse.start_as_current_observation(
) as span:

with propagate_attributes(
span.update_trace(
input={"person": "Ada Lovelace"}
)

# LangChain execution will be part of this trace
response = chain.invoke(
{"person": "Ada Lovelace"},
config={"callbacks": [langfuse_handler]}
)

span.update_trace(output={"response": response})
user_id="user_123",
):
span.update_trace(
input={"person": "Ada Lovelace"}
)

# LangChain execution will be part of this trace
response = chain.invoke(
{"person": "Ada Lovelace"},
config={"callbacks": [langfuse_handler]}
)

span.update_trace(output={"response": response})

print(f"Trace ID: {predefined_trace_id}") # Use this for scoring later
print(f"Trace ID: {langfuse_handler.last_trace_id}") # Care needed in concurrent environments where handler is reused
Expand Down