mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
## 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]>
24 lines
767 B
Python
24 lines
767 B
Python
# Copyright (c) Microsoft. All rights reserved.
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from semantic_kernel.contents.chat_history import ChatHistory
|
|
|
|
if TYPE_CHECKING:
|
|
from semantic_kernel.contents.chat_message_content import ChatMessageContent
|
|
|
|
|
|
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
|