David Diaz T
David Diaz T2w ago

Can't update trace between lambdas using the custom trace Id.

Hello! I want to update a trace with information from 2 different lambdas but can't seem to get it right. Here is the context: I am working in a chatbot using AWS Lambdas. I create a trace with a custom trace_id in a lambda_function_1 and use it to register some calls to the OpenAI API. This works fine. Then I generate a response and send the response with the custom trace id to lambda_function_2 which handles the logic to send the response back to the user. After the response is sent, I get an response_id. I want to add the response_id to the trace created in the lambda_function_1 by metadata. I am doing this by updating the trace with its custom trace id I got from lambda_function_1:
langfuse.trace(
id=trace_id,
output=output,
metadata={"response_id": response_id},
)
langfuse.trace(
id=trace_id,
output=output,
metadata={"response_id": response_id},
)
However, this doesn't seem to work. Also, I made sure to add langfuse_context.flush() before both lambdas stop executing. What I am missing? Pd: I create the trace using Python Low Level SDK Thanks!
0 Replies
No replies yetBe the first to reply to this messageJoin