Skip to content

Commit

Permalink
split off cohere fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BYK committed Sep 19, 2024
1 parent 9f410a2 commit 9f0b114
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions sentry_sdk/integrations/cohere.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,14 @@
from cohere import (
ChatStreamEndEvent,
NonStreamedChatResponse,
StreamedChatResponse_StreamEnd,
)

if TYPE_CHECKING:
from cohere import StreamedChatResponse
except ImportError:
raise DidNotEnable("Cohere not installed")

try:
# cohere 5.9.3+
from cohere import StreamEndStreamedChatResponse
except ImportError:
from cohere import StreamedChatResponse_StreamEnd as StreamEndStreamedChatResponse


COLLECTED_CHAT_PARAMS = {
"model": SPANDATA.AI_MODEL_ID,
Expand Down Expand Up @@ -194,7 +189,7 @@ def new_iterator():
with capture_internal_exceptions():
for x in old_iterator:
if isinstance(x, ChatStreamEndEvent) or isinstance(
x, StreamEndStreamedChatResponse
x, StreamedChatResponse_StreamEnd
):
collect_chat_response_fields(
span,
Expand Down

0 comments on commit 9f0b114

Please sign in to comment.