Skip to content

Commit d4eb421

Browse files
remove dead branches
1 parent a073290 commit d4eb421

1 file changed

Lines changed: 1 addition & 34 deletions

File tree

sentry_sdk/integrations/openai.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -719,22 +719,6 @@ def _new_sync_chat_completion(f: "Any", *args: "Any", **kwargs: "Any") -> "Any":
719719
finish_span=True,
720720
)
721721

722-
# Attribute check to fail gracefully if the attribute is not present in future `openai` versions.
723-
elif isinstance(response, AsyncStream) and hasattr(response, "_iterator"):
724-
messages = kwargs.get("messages")
725-
726-
if messages is not None and isinstance(messages, str):
727-
messages = [messages]
728-
729-
response._iterator = _wrap_asynchronous_completions_chunk_iterator(
730-
span=span,
731-
integration=integration,
732-
start_time=start_time,
733-
messages=messages,
734-
response=response,
735-
old_iterator=response._iterator,
736-
finish_span=True,
737-
)
738722
else:
739723
_set_completions_api_output_data(
740724
span, response, kwargs, integration, finish_span=True
@@ -786,24 +770,7 @@ async def _new_async_chat_completion(f: "Any", *args: "Any", **kwargs: "Any") ->
786770
reraise(*exc_info)
787771

788772
# Attribute check to fail gracefully if the attribute is not present in future `openai` versions.
789-
if isinstance(response, Stream) and hasattr(response, "_iterator"):
790-
messages = kwargs.get("messages")
791-
792-
if messages is not None and isinstance(messages, str):
793-
messages = [messages]
794-
795-
response._iterator = _wrap_synchronous_completions_chunk_iterator(
796-
span=span,
797-
integration=integration,
798-
start_time=start_time,
799-
messages=messages,
800-
response=response,
801-
old_iterator=response._iterator,
802-
finish_span=True,
803-
)
804-
805-
# Attribute check to fail gracefully if the attribute is not present in future `openai` versions.
806-
elif isinstance(response, AsyncStream) and hasattr(response, "_iterator"):
773+
if isinstance(response, AsyncStream) and hasattr(response, "_iterator"):
807774
messages = kwargs.get("messages")
808775

809776
if messages is not None and isinstance(messages, str):

0 commit comments

Comments
 (0)