From the course: Level up LLM applications development with LangChain and OpenAI

Unlock the full course today

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

Create and invoke a chain (LCEL syntax)

Create and invoke a chain (LCEL syntax)

- [Instructor] Now we have a chain which is almost starting to take shape. We can also use the LCL syntax to compose the chain with more components. And so we're going to discover the LangChain Expression Language, the LCEL syntax, which is a declarative way to easily compose chains together. So the LCEL syntax provides with a standard interface with invocation methods. So here, we have a basic example to learn to compose with LCEL, starting with a prompt. So we use a prompt to define and send instructions to the language model. And so in this example, we want to ask the language models to tell a short joke about a topic. So we're going to start by defining a prompt, then combine with a model components. And here you notice that we use the pipe operator to combine the components together, and form the chain. And the way it works is that it is the results of the previous components, which is used and passed as an input to the next component, the language model. Then we run the chain…

Contents