File tree Expand file tree Collapse file tree 4 files changed +6
-26
lines changed
Expand file tree Collapse file tree 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(
17681768
17691769 return ConversationResponse (context_id = response .contextID , outputs = outputs )
17701770
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
17731773
17741774 async def wait (self , timeout_s : float ):
17751775 """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(
17701770 ]
17711771
17721772 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
17761775
17771776 def wait (self , timeout_s : float ):
17781777 """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):
12291229
12301230 inputs = [ConversationInput (content = 'Hello' , role = 'user' )]
12311231
1232- with self .assertRaises (DaprInternalError ) as context :
1232+ with self .assertRaises (DaprGrpcError ) as context :
12331233 dapr .converse_alpha1 (name = 'test-llm' , inputs = inputs )
12341234 self .assertTrue ('Invalid argument' in str (context .exception ))
12351235
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-
12451236
12461237if __name__ == '__main__' :
12471238 unittest .main ()
Original file line number Diff line number Diff line change @@ -1159,21 +1159,11 @@ async def test_converse_alpha1_error_handling(self):
11591159
11601160 inputs = [ConversationInput (content = 'Hello' , role = 'user' )]
11611161
1162- with self .assertRaises (DaprInternalError ) as context :
1162+ with self .assertRaises (DaprGrpcError ) as context :
11631163 await dapr .converse_alpha1 (name = 'test-llm' , inputs = inputs )
11641164 self .assertTrue ('Invalid argument' in str (context .exception ))
11651165 await dapr .close ()
11661166
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-
11771167
11781168if __name__ == '__main__' :
11791169 unittest .main ()
You can’t perform that action at this time.
0 commit comments