diff --git a/ddtrace/contrib/internal/openai/utils.py b/ddtrace/contrib/internal/openai/utils.py index d526f96b30..0217b1e61d 100644 --- a/ddtrace/contrib/internal/openai/utils.py +++ b/ddtrace/contrib/internal/openai/utils.py @@ -89,7 +89,7 @@ def _extract_token_chunk(self, chunk): """Attempt to extract the token chunk (last chunk in the stream) from the streamed response.""" if not self._dd_span._get_ctx_item("_dd.auto_extract_token_chunk"): return - choices = getattr(chunk, "choices", None) + choices = getattr(chunk, "choices") if not choices: return choice = choices[0] @@ -155,7 +155,7 @@ async def _extract_token_chunk(self, chunk): """Attempt to extract the token chunk (last chunk in the stream) from the streamed response.""" if not self._dd_span._get_ctx_item("_dd.auto_extract_token_chunk"): return - choices = getattr(chunk, "choices", None) + choices = getattr(chunk, "choices") if not choices: return choice = choices[0]