From 7d158489b9ac480ea85f0256403a28f4fcc57416 Mon Sep 17 00:00:00 2001 From: David <474346+bettlebrox@users.noreply.github.com> Date: Fri, 25 Oct 2024 15:18:33 +0100 Subject: [PATCH] fix: 'NoneType' object has no attribute '__dict__' (#978) --- langfuse/openai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langfuse/openai.py b/langfuse/openai.py index ae5d1b8f..1255eee0 100644 --- a/langfuse/openai.py +++ b/langfuse/openai.py @@ -519,7 +519,7 @@ def _get_langfuse_data_from_default_response(resource: OpenAiDefinition, respons usage = response.get("usage", None) - return model, completion, usage.__dict__ if _is_openai_v1() else usage + return model, completion, usage.__dict__ if _is_openai_v1() and usage is not None else usage def _is_openai_v1():