From the course: Oracle Cloud Infrastructure Generative AI Professional

Unlock this course with a free trial

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

Demo: LangChain basics

Demo: LangChain basics

(bright music) (bright music fades) - [Instructor] In this demo, we'll explore a few LangChain components like models, prompts, chains, and memory. So let us begin with models. We import ChatOCIGenAI class from LangChain community package, which represents OCI Generative AI Service. This class allows us to invoke generative AI service using LangChain. We create LLM object using ChatOCIGenAI class. We pass in the model, name. We pass in the service endpoint, which is a network access point, for generative AI service in a specific region. We pass in the compartment ID. We also pass in the max tokens as 200 because we want to limit the output of the LLM, so let us execute the cell. What we do next is we call upon the invoke method of the LLM and we pass in the question that we want to ask. We've also pass in a temperature parameter, which decides the creativity of the output, and we print the response from the LLM. So let's execute and see what happens. We got back the response from the…

Contents