Open
Description
Hi,
I have moved from 1.0.0-M8
to 1.0.0-RC1
. A small app that successfully compiles and runs with GraalVM.
Something has happened after this issue with the non null assertions and the refactoring of MessageChatMemoryAdvisor
From 1.0.0-RC1
, it fails at runtime in a native-image with
Caused by: java.lang.IllegalArgumentException: scheduler cannot be null
at org.springframework.util.Assert.notNull(Assert.java:181)
at org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor.<init>(MessageChatMemoryAdvisor.java:61)
at org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor$Builder.build(MessageChatMemoryAdvisor.java:179)
at com.mpalourdio.projects.mpalourd_ai.controller.OpenAiController.<init>(OpenAiController.kt:53)
at com.mpalourdio.projects.mpalourd_ai.controller.OpenAiController__BeanDefinitions.lambda$getOpenAiControllerInstanceSupplier$0(OpenAiController__BeanDefinitions.java:25)
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68)
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:225)
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:258)
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:225)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:1031)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1249)
Forcing the scheduler works, but it should not be necessary as it's already a default in MessageChatMemoryAdvisor#Builder
. Here is the faulty code :
private final val messageChatMemoryAdvisor = MessageChatMemoryAdvisor.builder(
MessageWindowChatMemory.builder()
.chatMemoryRepository(chatMemoryRepository)
.build())
// TODO: Should not be necessary to set this
// But, it fails in native image with "Caused by: java.lang.IllegalArgumentException: scheduler cannot be null"
.scheduler(MessageChatMemoryAdvisor.DEFAULT_SCHEDULER) <== already the default.
.build()
I have used the tracing agent, but I just can't at all generate metadata that make the thing work :/ Nothing seems to handle this scheduler, so i am clueless.
Thanks !