Skip to content

Commit 8c9c734

Browse files
linter
Signed-off-by: Elena Kolevska <[email protected]>
1 parent 7998bc7 commit 8c9c734

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

examples/conversation/conversation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
)
3131

3232
for output in response.outputs:
33-
print(f'Result: {output.result}')
33+
print(f'Result: {output.result}')

tests/clients/test_dapr_grpc_client_async.py

+23-14
Original file line numberDiff line numberDiff line change
@@ -1116,50 +1116,59 @@ async def test_decrypt_file_data_read_chunks(self):
11161116
async def test_converse_alpha1_basic(self):
11171117
dapr = DaprGrpcClientAsync(f'{self.scheme}localhost:{self.grpc_port}')
11181118

1119-
inputs = [ConversationInput(message="Hello", role="user"),
1120-
ConversationInput(message="How are you?", role="user")]
1119+
inputs = [
1120+
ConversationInput(message='Hello', role='user'),
1121+
ConversationInput(message='How are you?', role='user'),
1122+
]
11211123

1122-
response = await dapr.converse_alpha1(name="test-llm", inputs=inputs)
1124+
response = await dapr.converse_alpha1(name='test-llm', inputs=inputs)
11231125

11241126
# Check response structure
11251127
self.assertIsNotNone(response)
11261128
self.assertEqual(len(response.outputs), 2)
1127-
self.assertEqual(response.outputs[0].result, "Response to: Hello")
1128-
self.assertEqual(response.outputs[1].result, "Response to: How are you?")
1129+
self.assertEqual(response.outputs[0].result, 'Response to: Hello')
1130+
self.assertEqual(response.outputs[1].result, 'Response to: How are you?')
11291131
await dapr.close()
11301132

11311133
async def test_converse_alpha1_with_options(self):
11321134
dapr = DaprGrpcClientAsync(f'{self.scheme}localhost:{self.grpc_port}')
11331135

1134-
inputs = [ConversationInput(message="Hello", role="user", scrub_pii=True)]
1136+
inputs = [ConversationInput(message='Hello', role='user', scrub_pii=True)]
11351137

1136-
response = await dapr.converse_alpha1(name="test-llm", inputs=inputs, context_id="chat-123",
1137-
temperature=0.7, scrub_pii=True, metadata={"key": "value"})
1138+
response = await dapr.converse_alpha1(
1139+
name='test-llm',
1140+
inputs=inputs,
1141+
context_id='chat-123',
1142+
temperature=0.7,
1143+
scrub_pii=True,
1144+
metadata={'key': 'value'},
1145+
)
11381146

11391147
self.assertIsNotNone(response)
11401148
self.assertEqual(len(response.outputs), 1)
1141-
self.assertEqual(response.outputs[0].result, "Response to: Hello")
1149+
self.assertEqual(response.outputs[0].result, 'Response to: Hello')
11421150
await dapr.close()
11431151

11441152
async def test_converse_alpha1_error_handling(self):
11451153
dapr = DaprGrpcClientAsync(f'{self.scheme}localhost:{self.grpc_port}')
11461154

11471155
# Setup server to raise an exception
11481156
self._fake_dapr_server.raise_exception_on_next_call(
1149-
status_pb2.Status(code=code_pb2.INVALID_ARGUMENT, message="Invalid argument"))
1157+
status_pb2.Status(code=code_pb2.INVALID_ARGUMENT, message='Invalid argument')
1158+
)
11501159

1151-
inputs = [ConversationInput(message="Hello", role="user")]
1160+
inputs = [ConversationInput(message='Hello', role='user')]
11521161

11531162
with self.assertRaises(DaprInternalError) as context:
1154-
await dapr.converse_alpha1(name="test-llm", inputs=inputs)
1155-
self.assertTrue("Invalid argument" in str(context.exception))
1163+
await dapr.converse_alpha1(name='test-llm', inputs=inputs)
1164+
self.assertTrue('Invalid argument' in str(context.exception))
11561165
await dapr.close()
11571166

11581167
async def test_converse_alpha1_empty_inputs(self):
11591168
dapr = DaprGrpcClientAsync(f'{self.scheme}localhost:{self.grpc_port}')
11601169

11611170
# Test with empty inputs list
1162-
response = await dapr.converse_alpha1(name="test-llm", inputs=[])
1171+
response = await dapr.converse_alpha1(name='test-llm', inputs=[])
11631172

11641173
self.assertIsNotNone(response)
11651174
self.assertEqual(len(response.outputs), 0)

0 commit comments

Comments
 (0)