Commit e769371 1 parent 9bf0e27 commit e769371 Copy full SHA for e769371
File tree 4 files changed +6
-26
lines changed
4 files changed +6
-26
lines changed Original file line number Diff line number Diff line change @@ -1768,8 +1768,8 @@ async def converse_alpha1(
1768
1768
1769
1769
return ConversationResponse (context_id = response .contextID , outputs = outputs )
1770
1770
1771
- except Exception as e :
1772
- raise DaprInternalError ( f'Error invoking conversation API: { e } ' )
1771
+ except grpc . aio . AioRpcError as err :
1772
+ raise DaprGrpcError ( err ) from err
1773
1773
1774
1774
async def wait (self , timeout_s : float ):
1775
1775
"""Waits for sidecar to be available within the timeout.
Original file line number Diff line number Diff line change @@ -1770,9 +1770,8 @@ def converse_alpha1(
1770
1770
]
1771
1771
1772
1772
return ConversationResponse (context_id = response .contextID , outputs = outputs )
1773
-
1774
- except Exception as e :
1775
- raise DaprInternalError (f'Error invoking conversation API: { e } ' )
1773
+ except RpcError as err :
1774
+ raise DaprGrpcError (err ) from err
1776
1775
1777
1776
def wait (self , timeout_s : float ):
1778
1777
"""Waits for sidecar to be available within the timeout.
Original file line number Diff line number Diff line change @@ -1229,19 +1229,10 @@ def test_converse_alpha1_error_handling(self):
1229
1229
1230
1230
inputs = [ConversationInput (content = 'Hello' , role = 'user' )]
1231
1231
1232
- with self .assertRaises (DaprInternalError ) as context :
1232
+ with self .assertRaises (DaprGrpcError ) as context :
1233
1233
dapr .converse_alpha1 (name = 'test-llm' , inputs = inputs )
1234
1234
self .assertTrue ('Invalid argument' in str (context .exception ))
1235
1235
1236
- def test_converse_alpha1_empty_inputs (self ):
1237
- dapr = DaprGrpcClient (f'{ self .scheme } localhost:{ self .grpc_port } ' )
1238
-
1239
- # Test with empty inputs list
1240
- response = dapr .converse_alpha1 (name = 'test-llm' , inputs = [])
1241
-
1242
- self .assertIsNotNone (response )
1243
- self .assertEqual (len (response .outputs ), 0 )
1244
-
1245
1236
1246
1237
if __name__ == '__main__' :
1247
1238
unittest .main ()
Original file line number Diff line number Diff line change @@ -1159,21 +1159,11 @@ async def test_converse_alpha1_error_handling(self):
1159
1159
1160
1160
inputs = [ConversationInput (content = 'Hello' , role = 'user' )]
1161
1161
1162
- with self .assertRaises (DaprInternalError ) as context :
1162
+ with self .assertRaises (DaprGrpcError ) as context :
1163
1163
await dapr .converse_alpha1 (name = 'test-llm' , inputs = inputs )
1164
1164
self .assertTrue ('Invalid argument' in str (context .exception ))
1165
1165
await dapr .close ()
1166
1166
1167
- async def test_converse_alpha1_empty_inputs (self ):
1168
- dapr = DaprGrpcClientAsync (f'{ self .scheme } localhost:{ self .grpc_port } ' )
1169
-
1170
- # Test with empty inputs list
1171
- response = await dapr .converse_alpha1 (name = 'test-llm' , inputs = [])
1172
-
1173
- self .assertIsNotNone (response )
1174
- self .assertEqual (len (response .outputs ), 0 )
1175
- await dapr .close ()
1176
-
1177
1167
1178
1168
if __name__ == '__main__' :
1179
1169
unittest .main ()
You can’t perform that action at this time.
0 commit comments