How can I get the trace_id in langfuse.openai.OpenAI? #1051
-
My code is from langfuse.openai import OpenAI
resp = OpenAI(
**global_params
).chat.completions.create(
messages=messages,
stream=stream,
**params,
) When stream is set to false, the 'resp' I receive is of type ChatCompletion. I cannot find the trace_id within this variable. I want to obtain the trace_id, what should I do? 🤕 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The OpenAI integration does not return the trace_id if it is automatically created. This is a great idea and we're open for contributions on this. However, this should not be blocking, as all users who want to add scores to the same trace or add the trace_id to their logs use this: https://langfuse.com/docs/openai#fully-featured-create-trace-via-sdk Thereby you create a trace using the Langfuse Python SDK and have full access to all trace parameters and methods. |
Beta Was this translation helpful? Give feedback.
The OpenAI integration does not return the trace_id if it is automatically created. This is a great idea and we're open for contributions on this.
However, this should not be blocking, as all users who want to add scores to the same trace or add the trace_id to their logs use this: https://langfuse.com/docs/openai#fully-featured-create-trace-via-sdk
Thereby you create a trace using the Langfuse Python SDK and have full access to all trace parameters and methods.