diff --git a/src/langtrace_python_sdk/instrumentation/openai/patch.py b/src/langtrace_python_sdk/instrumentation/openai/patch.py index 75bd5e9f..2b520a63 100644 --- a/src/langtrace_python_sdk/instrumentation/openai/patch.py +++ b/src/langtrace_python_sdk/instrumentation/openai/patch.py @@ -281,30 +281,19 @@ def handle_streaming_response(result, span, prompt_tokens, function_call=False): } ), ) - if function_call is False: - span.set_attribute( - "llm.responses", - json.dumps( - { - "message": { - "role": "assistant", - "content": "".join(result_content), - } - } - ), - ) - else: - span.set_attribute( - "llm.responses", - json.dumps( + span.set_attribute( + "llm.responses", + json.dumps( + [ { "message": { "role": "assistant", "content": "".join(result_content), } } - ), - ) + ] + ), + ) span.set_status(StatusCode.OK) span.end()