-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: improve agent samples and chat history handling #10301
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
markwallace-microsoft
added
the
python
Pull requests for the Python Semantic Kernel
label
Jan 27, 2025
Python Test Coverage Report •
Python Unit Test Overview
|
TaoChenOSU
reviewed
Jan 27, 2025
python/samples/concepts/agents/chat_completion_history_reducer.py
Outdated
Show resolved
Hide resolved
TaoChenOSU
reviewed
Jan 27, 2025
moonbox3
approved these changes
Jan 27, 2025
TaoChenOSU
approved these changes
Jan 27, 2025
eavanvalkenburg
force-pushed
the
agent_history_fix
branch
from
January 28, 2025 07:38
92ebbed
to
2ef2405
Compare
eavanvalkenburg
changed the title
Python: fix passing self.history_reducer to reduce_history in agent
Python: improve agent samples and chat history handling
Jan 28, 2025
…roup chat since history is maintained internally. Update samples to be more clear.
eavanvalkenburg
force-pushed
the
agent_history_fix
branch
from
January 28, 2025 16:27
0eeb9e3
to
4039f2e
Compare
moonbox3
reviewed
Jan 28, 2025
python/semantic_kernel/contents/history_reducer/chat_history_reducer.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/contents/history_reducer/chat_history_truncation_reducer.py
Outdated
Show resolved
Hide resolved
alliscode
approved these changes
Jan 28, 2025
github-merge-queue
bot
removed this pull request from the merge queue due to failed status checks
Jan 28, 2025
alliscode
approved these changes
Jan 29, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
When passing the same object to
agent.reduce_history
as is present in thehistory_reducer
attribute of the agent that the function doesn't accurately behave. This fixes that.Also updates the sample to be a bit more concise.
Also fixes the way the single_dispatch is setup in ChatHistory.
Also ensures system/developer messages are not reduced away as that might impact performance.
The
reduce_history
method was removed from the agent base class, in favor of having the caller manage the change history and reduction as needed. Thereduce_history
was added to the agent group chat, as the chat history is managed internally as agents are invoked.Description
Contribution Checklist