Class SessionAdvisors

java.lang.Object
org.springframework.ai.session.advisor.SessionAdvisors

public final class SessionAdvisors extends Object
The session advisors of a ChatClient, configured together: the SessionTurnAdvisor (the session, compaction) and the SessionMemoryAdvisor (the history, the messages), each at its default order around the tool-calling loop the ChatClient registers itself:
 ChatClient chatClient = ChatClient.builder(chatModel)
     .defaultAdvisors(SessionAdvisors.builder(sessionService)
         .compaction(new TurnCountTrigger(20), WindowCompactionStrategy.builder().lastTurns(10).build())
         .build())
     .build();
 chatClient.prompt().user("Hi").advisors(SessionAdvisors.session(sessionId)).call().content();
 

The memory advisor is a MemoryAdvisor, so the tool-calling loop the ChatClient registers runs with its own history off: each round's prompt is rebuilt from the session.

The advisors can still be built one by one, for an order of your own.

Since:
2.1.0
Author:
Christian Tzolov