gnodet-bot commented on code in PR #30449:
URL: https://github.com/apache/camel/pull/30449#discussion_r4634754075
##########
components/camel-spring-parent/camel-spring-ai/camel-spring-ai-chat/src/main/java/org/apache/camel/component/springai/chat/SpringAiChatProducer.java:
##########
@@ -1513,6 +1513,79 @@ private void
warnWhenObservabilityNeedsExplicitChatModel() {
}
}
+ /**
+ * Builds the memory advisors, which are added to a request only when it
has a conversation id. One memory is used:
+ * sessionService, else chatMemory, else chatMemoryVectorStore. None is
used when the advisors option has a memory
+ * advisor of its own.
+ *
+ * @return the memory advisors, or {@code null} when no memory is
configured
+ */
+ @SuppressWarnings({ "deprecation", "removal" })
+ private List<Advisor> buildMemoryAdvisors() {
+ SessionService sessionService =
getEndpoint().getConfiguration().getSessionService();
+ ChatMemory chatMemory =
getEndpoint().getConfiguration().getChatMemory();
+ VectorStore chatMemoryVectorStore =
getEndpoint().getConfiguration().getChatMemoryVectorStore();
+ int sessionMessageWindow =
getEndpoint().getConfiguration().getSessionMessageWindow();
+ if (sessionMessageWindow < 0) {
+ throw new IllegalArgumentException(
+ "sessionMessageWindow must be 0 (the whole session) or
more, but was " + sessionMessageWindow);
Review Comment:
🧪 **Missing test:** This guard throws `IllegalArgumentException` for
negative `sessionMessageWindow`, but no test exercises this path. Consider
adding a test that sets `sessionMessageWindow=-1` and asserts the exchange
fails with this exception.
--
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]