From the course: GenAI for Busy Java Developers by Pearson
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Implement a basic chatbot using ChatMemory - Java Tutorial
From the course: GenAI for Busy Java Developers by Pearson
Implement a basic chatbot using ChatMemory
Now, how do we do this in LangChain4j? So let's implement a basic chatbot using what's called chat memory. So in LangChain4j, we talked about some core components, right? We talked about the chat model, and as an example for OpenAI, I had an OpenAI chat model that maybe there's the Google Gemini chat model, but those are classes, right? Chat models and the interface. And we're sending chat messages to the language model. And again, chat message is another type of interface in this blue color. And we've talked about user messages and system messages. Those are classes. Those are types of chat messages. So, so far so good. And what we get back, we get back a chat response. And inside the chat response is an AI message, what comes back from the language model. Now, over time, what we have to do is that we have to preserve the ongoing conversation with the language model. So there's a new type of interface that we're gonna cover here called chat memory. So chat memory is a type of history…
Contents
-
-
-
-
-
-
-
(Locked)
Learning objectives36s
-
(Locked)
Define core components of LangChain4j1m 45s
-
(Locked)
Install and configure LangChain4j in a Java project using Gradle/Maven47s
-
(Locked)
Demonstrate how to send UserMessages and SystemMessages to an LLM5m 6s
-
(Locked)
Implement a basic chatbot with prompt context2m 3s
-
(Locked)
Demonstrate incorporating external data as context for the chatbot2m 43s
-
(Locked)
Apply memory to retain conversation state4m 8s
-
(Locked)
Implement a basic chatbot using ChatMemory6m 5s
-
(Locked)
-
-
-
-
-
-
-
-