Skip to content

Commit ee6729e

Browse files
committed
lint
Signed-off-by: Filinto Duran <[email protected]>
1 parent 2018978 commit ee6729e

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

dapr/aio/clients/grpc/client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,14 @@
105105
StartWorkflowResponse,
106106
TopicEventResponse,
107107
)
108-
from dapr.clients.grpc.conversation import ConversationResult, ConversationResultAlpha2Message, \
109-
ConversationResultAlpha2Choices, ConversationResultAlpha2, ConversationResponse, ConversationResponseAlpha2
108+
from dapr.clients.grpc.conversation import (
109+
ConversationResult,
110+
ConversationResultAlpha2Message,
111+
ConversationResultAlpha2Choices,
112+
ConversationResultAlpha2,
113+
ConversationResponse,
114+
ConversationResponseAlpha2,
115+
)
110116

111117

112118
class DaprGrpcClientAsync:

dapr/clients/grpc/_conversation_helpers.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -502,15 +502,6 @@ def function_to_json_schema(
502502
# Extract parameter descriptions from docstring
503503
param_descriptions = _extract_docstring_args(func)
504504

505-
# Get function description
506-
if description is None:
507-
docstring = inspect.getdoc(func)
508-
if docstring:
509-
# Use first line of docstring as description
510-
description = docstring.split('\n')[0].strip()
511-
else:
512-
description = f'Function {func.__name__}'
513-
514505
# Build JSON schema
515506
schema: Dict[str, Any] = {'type': 'object', 'properties': {}, 'required': []}
516507

dapr/clients/grpc/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,7 +1882,9 @@ def converse_alpha2(
18821882
if not tool_call.id:
18831883
tool_call.id = _generate_unique_tool_call_id()
18841884
tool_calls.append(
1885-
conversation.ConversationToolCalls(id=tool_call.id, function=function_call)
1885+
conversation.ConversationToolCalls(
1886+
id=tool_call.id, function=function_call
1887+
)
18861888
)
18871889

18881890
result_message = conversation.ConversationResultAlpha2Message(
@@ -1899,7 +1901,9 @@ def converse_alpha2(
18991901

19001902
outputs.append(conversation.ConversationResultAlpha2(choices=choices))
19011903

1902-
return conversation.ConversationResponseAlpha2(context_id=response.context_id, outputs=outputs)
1904+
return conversation.ConversationResponseAlpha2(
1905+
context_id=response.context_id, outputs=outputs
1906+
)
19031907
except RpcError as err:
19041908
raise DaprGrpcError(err) from err
19051909

dapr/clients/grpc/conversation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ def from_function(cls, func: Callable, register: bool = True) -> 'ConversationTo
299299
register_tool(c.name, ConversationTools(function=c, backend=FunctionBackend(func)))
300300
return c
301301

302+
302303
# ------------------------------------------------------------------------------------------------
303304
# Response Classes
304305
# ------------------------------------------------------------------------------------------------
@@ -355,7 +356,7 @@ def to_assistant_messages(self) -> List[ConversationMessage]:
355356
"""Helper to convert to Assistant messages and makes it easy to use in multi-turn conversations."""
356357

357358
def convert_llm_response_to_conversation_input(
358-
result_message: ConversationResultAlpha2Message,
359+
result_message: ConversationResultAlpha2Message,
359360
) -> ConversationMessage:
360361
"""Convert ConversationResultMessage (from LLM response) to ConversationMessage."""
361362

@@ -369,9 +370,7 @@ def convert_llm_response_to_conversation_input(
369370

370371
# Create an assistant message (since LLM responses are always assistant messages)
371372
return ConversationMessage(
372-
of_assistant=ConversationMessageOfAssistant(
373-
content=content, tool_calls=tool_calls
374-
)
373+
of_assistant=ConversationMessageOfAssistant(content=content, tool_calls=tool_calls)
375374
)
376375

377376
"""Convert the outputs to a list of ConversationInput."""
@@ -385,6 +384,7 @@ def convert_llm_response_to_conversation_input(
385384

386385
return assistant_messages
387386

387+
388388
# ------------------------------------------------------------------------------------------------
389389
# Tool Helpers
390390
# ------------------------------------------------------------------------------------------------
@@ -481,6 +481,7 @@ class ConversationTools:
481481
backend: Optional[ToolBackend] = None
482482

483483
def invoke(self, params: Params = None) -> Any:
484+
"""execute the tool with params"""
484485
if not self.backend:
485486
raise conv_helpers.ToolExecutionError('Tool backend not set')
486487
return self.backend.invoke(self.function, params)

0 commit comments

Comments
 (0)