Skip to content

Commit ea564cf

Browse files
ajeet214TaoChenOSU
andauthored
Python: docs(typing): add return type and docstring to store_results in utils/chat.py (#12910)
## 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. ### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄 --------- Co-authored-by: Tao Chen <[email protected]>
1 parent e110472 commit ea564cf

File tree

1 file changed

+10
-2
lines changed
  • python/semantic_kernel/utils

1 file changed

+10
-2
lines changed

python/semantic_kernel/utils/chat.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88
from semantic_kernel.contents.chat_message_content import ChatMessageContent
99

1010

11-
def store_results(chat_history: ChatHistory, results: list["ChatMessageContent"]):
12-
"""Stores specific results in the context and chat prompt."""
11+
def store_results(chat_history: ChatHistory, results: list["ChatMessageContent"]) -> ChatHistory:
12+
"""Stores specific results in the context and chat prompt.
13+
14+
Args:
15+
chat_history(ChatHistory): The current chat history instance.
16+
results(list["ChatMessageContent"]): Messages to be stored in the history.
17+
18+
Returns:
19+
ChatHistory: Updated chat history containing the new messages.
20+
"""
1321
for message in results:
1422
chat_history.add_message(message=message)
1523
return chat_history

0 commit comments

Comments
 (0)