Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] UX: AI Service: when @MemoryId is used, validate that chatMemoryProvider is configured #984

Open
langchain4j opened this issue Apr 19, 2024 · 0 comments
Labels
enhancement New feature or request P3 Medium priority

Comments

@langchain4j
Copy link
Owner

langchain4j commented Apr 19, 2024

When @MemoryId is used in AI Service, validate that chatMemoryProvider is configured.

public interface Assistant {

    String chat(@MemoryId String memoryId, @UserMessage String userMessage);
}

Currently it throws NPE:

java.lang.NullPointerException: Cannot invoke "dev.langchain4j.memory.chat.ChatMemoryProvider.get(Object)" because "this.chatMemoryProvider" is null
	at dev.langchain4j.service.AiServiceContext.lambda$chatMemory$1(AiServiceContext.java:47)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
	at dev.langchain4j.service.AiServiceContext.chatMemory(AiServiceContext.java:47)
	at dev.langchain4j.service.DefaultAiServices$1.invoke(DefaultAiServices.java:105)
@langchain4j langchain4j added enhancement New feature or request P3 Medium priority labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3 Medium priority
Projects
None yet
Development

No branches or pull requests

1 participant