Class SessionContexts
java.lang.Object
org.springframework.ai.session.advisor.SessionContexts
What the session advisors read from the advisor context: the session id, and the
request that creates the session on first use. An advisor of your own that works on the
session of a call, around the session advisors or inside the tool-calling loop, reads
the same two here, so that it names and creates the session exactly as they do.
- Since:
- 2.1.0
- Author:
- Christian Tzolov
-
Method Summary
Modifier and TypeMethodDescriptionstatic CreateSessionRequestcreateRequest(String sessionId, Map<String, @Nullable Object> context) The request the advisors pass toSessionService.findOrCreate: the id, and the metadata fromSessionMemoryAdvisor.SESSION_METADATA_CONTEXT_KEY, such as the agent attributes (SessionAttributes.AGENT_NAME).static StringThe session id fromSessionMemoryAdvisor.SESSION_ID_CONTEXT_KEY.
-
Method Details
-
sessionId
The session id fromSessionMemoryAdvisor.SESSION_ID_CONTEXT_KEY.- Throws:
IllegalStateException- when it is missing, so that sessions are never shared by accident
-
createRequest
public static CreateSessionRequest createRequest(String sessionId, Map<String, @Nullable Object> context) The request the advisors pass toSessionService.findOrCreate: the id, and the metadata fromSessionMemoryAdvisor.SESSION_METADATA_CONTEXT_KEY, such as the agent attributes (SessionAttributes.AGENT_NAME).- Throws:
IllegalArgumentException- when the metadata in the context is not a map
-