Chapter 8: LangChain4j Chat Memory & Chat History | Internal Memory Management | Java 17 Spring Boot
aditya desai
0:00 / 0:00
Chapter 8: LangChain4j Chat Memory & Chat History | Internal Memory Management | Java 17 Spring Boot
294 просмотра · 4 недели назад
aditya desai
323 подписчика
294 просмотра · 4 недели назад
In this video, we continue our LangChain4j AI Services implementation and improve the chat memory management of our application.
I hope you've already gone through my LangChain4j AI Services implementation playlist, because this video builds directly on that implementation.
GIT REPO: https://github.com/aditya8642/langcha...
In this tutorial, we will:
Upgrade LangChain4j to the latest version used in the project
Understand the LangChain4j BOM and dependency management
Update APIs after the LangChain4j upgrade
Understand and use @MemoryId
Configure ChatMemoryProvider
Remove our custom ConcurrentHashMap based memory management
Let LangChain4j manage chat memory internally
Access the internally managed ChatMemory
Retrieve messages using chatMemory.messages()
Create a Chat History REST API
Return only user and AI messages
Understand UserMessage, AiMessage and ToolExecutionResultMessage
Create a clean DTO for exposing chat history through REST
We'll also see how the same user's conversations can be maintained using @MemoryId while keeping different users' memories separate.
This is a practical implementation using Java 17, Spring Boot and LangChain4j.
Technologies covered
Java 17
Spring Boot
LangChain4j
LangChain4j AI Services
ChatMemory
ChatMemoryProvider
@MemoryId
Mistral AI
REST API
#LangChain4j #ChatMemory #chathistory #java #springboot #ai #LangChain4jTutorial #java17 #aiservices #generativeai #springai #aiapplications