DefaultSessionTrimmingService

Wisej.AI.Services.DefaultSessionTrimmingService

Namespace: Wisej.AI.Services

Assembly: Wisej.AI (3.5.0.0)

Provides functionality to trim messages in a session to reduce the number of tokens.

public class DefaultSessionTrimmingService : ISessionTrimmingService

Constructors

DefaultSessionTrimmingService()

Initializes a new instance of DefaultSessionTrimmingService.

Properties

TrimmingPercentage

Single: Gets or sets the percentage of messages to remove (between 0.1 and 0.9). (Default: 0.5)

TrimmingStrategy

TrimmingStrategy: Gets or sets the strategy for handling context overflow. (Default: RollingWindow)

Methods

TrimAsync(session, messages)

Trims the messages in the session to reduce the number of tokens.

Parameter
Type
Description

session

The session to be trimmed.

messages

Message collection to be trimmed. If null, it uses the messages in the session .

Returns: Task.

Implements

Name
Description

Provides functionality to trim messages in a session to reduce the number of tokens.

Last updated