Skip to content

Python Agents: ChatHistoryReducer #7969

Closed

Description

@crickman

Replicate reducer feature implemented for .NET here: #7570

public interface IChatHistoryReducer
{
    /// <summary>
    /// Each reducer shall override equality evaluation so that different reducers
    /// of the same configuration can be evaluated for equivalency.
    /// </summary>
    bool Equals(object? obj);

    /// <summary>
    /// Each reducer shall implement custom hash-code generation so that different reducers
    /// of the same configuration can be evaluated for equivalency.
    /// </summary>
    int GetHashCode();

    /// <summary>
    /// Optionally reduces the chat history.
    /// </summary>
    /// <param name="history">The source history (which may have been previously reduced)</param>
    /// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
    /// <returns>The reduced history, or 'null' if no reduction has occurred</returns>
    Task<IEnumerable<ChatMessageContent>?> ReduceAsync(IReadOnlyList<ChatMessageContent> history, CancellationToken cancellationToken = default);
}

With implementations:

  1. ChatHistoryTruncationReducer
  2. ChatHistorySummarizationReducer

Utilize within ChatHistoryChannel with utility extension for "no-chat" case

Note: May want to give the .NET feature a couple weeks bake time (for customer feedback)

Activity

  1. changed the title [-]Python Agents: ChatHistoryReducer[/-] [+].Net: Python Agents: ChatHistoryReducer[/+] on Aug 7, 2024
  2. removed
    .NETIssue or Pull requests regarding .NET code
    on Aug 7, 2024
  3. moved this to Backlog: Planned in Semantic Kernelon Aug 7, 2024
  4. changed the title [-].Net: Python Agents: ChatHistoryReducer[/-] [+]Python Agents: ChatHistoryReducer[/+] on Aug 7, 2024
  5. added
    sk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
    on Aug 22, 2024
  6. github-actions commented on Nov 21, 2024

    @github-actions
    Contributor

    This issue is stale because it has been open for 90 days with no activity.

  7. added
    staleIssue is stale because it has been open for a while and has no activity
    on Nov 21, 2024
  8. github-actions commented on Dec 14, 2024

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

  9. moonbox3 commented on Dec 14, 2024

    @moonbox3
    Collaborator

    Not complete yet. Re-opening.

  10. changed the title [-]Python Agents: ChatHistoryReducer[/-] [+].Net: Python Agents: ChatHistoryReducer[/+] on Dec 14, 2024
  11. removed
    staleIssue is stale because it has been open for a while and has no activity
    on Dec 15, 2024
  12. changed the title [-].Net: Python Agents: ChatHistoryReducer[/-] [+]Python Agents: ChatHistoryReducer[/+] on Jan 15, 2025
  13. added a commit that references this issue on Jan 23, 2025
    4d29656
  14. added a commit that references this issue on Sep 15, 2025
    4693ff3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETIssue or Pull requests regarding .NET codeagentsenhancementexperimentalAssociated with an experimental featurepythonPull requests for the Python Semantic Kernelsk team issueA tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions