From 513ff20f5042aa8268a4e25447657400248bf47a Mon Sep 17 00:00:00 2001 From: Ajeet Verma Date: Mon, 11 Aug 2025 21:08:15 +0700 Subject: [PATCH 1/2] Update chat.py ## Summary - Added explicit return type `-> ChatHistory` to `store_results`. - Added detailed docstring explaining parameters, return type, and behavior. ## Why - Improves static analysis, IDE support, and code readability. - Makes the function self-documenting for new contributors. ## Testing - No changes to runtime behavior. - Existing test suite passes locally. --- python/semantic_kernel/utils/chat.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/python/semantic_kernel/utils/chat.py b/python/semantic_kernel/utils/chat.py index ceb17074c151..17c04395c9ed 100644 --- a/python/semantic_kernel/utils/chat.py +++ b/python/semantic_kernel/utils/chat.py @@ -8,8 +8,18 @@ from semantic_kernel.contents.chat_message_content import ChatMessageContent -def store_results(chat_history: ChatHistory, results: list["ChatMessageContent"]): - """Stores specific results in the context and chat prompt.""" +def store_results( + chat_history: ChatHistory, + results: list["ChatMessageContent"]) -> ChatHistory: + """Stores specific results in the context and chat prompt. + + Args: + chat_history(ChatHistory): The current chat history instance. + results(list["ChatMessageContent"]): Messages to be stored in the history. + + Returns: + ChatHistory: Updated chat history containing the new messages. + """ for message in results: chat_history.add_message(message=message) return chat_history From e2af4c0e6d07089d96d883169318fd54cc9768d9 Mon Sep 17 00:00:00 2001 From: Tao Chen Date: Wed, 3 Sep 2025 09:55:30 -0700 Subject: [PATCH 2/2] Fix formatting --- python/semantic_kernel/utils/chat.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/semantic_kernel/utils/chat.py b/python/semantic_kernel/utils/chat.py index 17c04395c9ed..632626ab27a3 100644 --- a/python/semantic_kernel/utils/chat.py +++ b/python/semantic_kernel/utils/chat.py @@ -8,9 +8,7 @@ from semantic_kernel.contents.chat_message_content import ChatMessageContent -def store_results( - chat_history: ChatHistory, - results: list["ChatMessageContent"]) -> ChatHistory: +def store_results(chat_history: ChatHistory, results: list["ChatMessageContent"]) -> ChatHistory: """Stores specific results in the context and chat prompt. Args: