File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 26
26
from cohere import (
27
27
ChatStreamEndEvent ,
28
28
NonStreamedChatResponse ,
29
- StreamedChatResponse_StreamEnd ,
30
29
)
31
30
32
31
if TYPE_CHECKING :
33
32
from cohere import StreamedChatResponse
34
33
except ImportError :
35
34
raise DidNotEnable ("Cohere not installed" )
36
35
36
+ try :
37
+ # cohere 5.9.3+
38
+ from cohere import StreamEndStreamedChatResponse
39
+ except ImportError :
40
+ from cohere import StreamedChatResponse_StreamEnd as StreamEndStreamedChatResponse
41
+
37
42
38
43
COLLECTED_CHAT_PARAMS = {
39
44
"model" : SPANDATA .AI_MODEL_ID ,
@@ -189,7 +194,7 @@ def new_iterator():
189
194
with capture_internal_exceptions ():
190
195
for x in old_iterator :
191
196
if isinstance (x , ChatStreamEndEvent ) or isinstance (
192
- x , StreamedChatResponse_StreamEnd
197
+ x , StreamEndStreamedChatResponse
193
198
):
194
199
collect_chat_response_fields (
195
200
span ,
You can’t perform that action at this time.
0 commit comments