Croway opened a new pull request, #30449: URL: https://github.com/apache/camel/pull/30449
[CAMEL-27243](https://issues.apache.org/jira/browse/CAMEL-27243) ## Description Spring AI 2.1 deprecates `ChatMemory`, `MessageWindowChatMemory`, `MessageChatMemoryAdvisor` and the chat memory repositories for removal in 3.0, in favour of session memory (`SessionService`, `SessionAdvisors`; an append-only event log with turn-aware compaction, and a JDBC store). - New `sessionService` option (autowired). The `CamelSpringAiChatConversationId` header selects the session, which is created on first use. Without the header no memory is used, as with `chatMemory`. - Precedence: `sessionService`, else `chatMemory`, else `chatMemoryVectorStore`. In Spring Boot, the model starters create a `ChatMemory` bean, while a `SessionService` bean only exists with `spring-ai-starter-model-session-jdbc`; adding that starter switches to session memory (logged at INFO). - New `sessionMessageWindow` option (default 20, as `MessageWindowChatMemory`; `0` sends the whole session): only the newest messages of the session go to the model, extended to whole turns, so a tool call never arrives without its result. The session keeps every message. - When the header is set, the conversation id goes to every memory advisor, also to those of the `advisors` option or of a configured `chatClient`. This is how an application uses its own session advisors, for example with compaction. When the `advisors` option has a memory advisor, the endpoint adds no memory advisor of its own (before, an autowired `chatMemory` added a second one). - `chatMemory` is deprecated (`@Deprecated` and deprecation note) and keeps working until Spring AI 3.0. - New dependencies `spring-ai-session` and `spring-ai-session-advisor` (versions from the Spring AI BOM); their transitive dependencies are already in the module. - Documentation: a "Session Memory" section (Java example, Spring Boot JDBC starter, window, compaction), chat memory marked deprecated. Upgrade guide 4.24: `chatMemory` deprecated; the session window; the conversation id passed to every memory advisor; the `advisors` rule. ## Tests `SpringAiChatSessionMemoryTest` (14): history per conversation id, no header, blank id, precedence over an explicit and an autowired `chatMemory` and over `chatMemoryVectorStore`, the tool loop stored in the session, the window (default 20, a small window at a tool round, `0`), and session advisors passed with `advisors`. The module has 59 unit tests, all passing. _Claude Code on behalf of Croway_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
