spring-projects / spring-projects/spring-ai

A ChatMemory implementation based on token size control is required.

Open
#3,423 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 10h
Merged PRs (30d)
5

Description

Expected Behavior

An implementation of ChatMemory based on token size control is required, which evicts the oldest messages when the total memory tokens exceed a specified limit.

Current Behavior

Currently, there is only a ChatMemory implementation that is based on the number of messages.

Context

Currently, there is only a ChatMemory implementation that focuses on the number of messages, which is actually insufficient for real-world use cases.

ChatMemory represents the memory content of an LLM, and its actual limitation should depend on the context token size supported by the LLM. Therefore, a ChatMemory implementation that limits the window based on token size is more practically meaningful.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing ChatMemory implementation that limits memory by message count and the surrounding ChatMemory API. The work is complete when a token-size-based implementation evicts the oldest messages after the configured token limit is exceeded and the behavior is covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
ai
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.