From the course: Oracle Cloud Infrastructure Generative AI Professional Cert Prep

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Demo: Using memory

Demo: Using memory

(dramatic music playing) - In this demonstration, we will see how to use langchain memory. So as usual, we begin with the import of the classes, some of the important classes that we'll be using here, are conversation buffer memory and conversation summary memory. And as usual, we create an LLM using OCI Gen AI Service. So we also create the chat prompt template over here. So we have a system message, which is giving an instruction to the model that we want it to be a chat bot who explains it's steps. And we're creating a variable so that we can input a question. Next thing is we create a memory using the conversation buffer memory class. So here we are passing in the memory key, which is chat_history. So the chain can use this particular key to put the contents into the memory or retrieve the contents from the memory. And we're also setting return messages as true because we want the memory to return its content as messages. Now, in addition to the conversation buffer memory, we are…

Contents