hands-on lab

Developing Chains and Runnables With the LangChain Expression Language (LCEL)

Difficulty: Beginner
Duration: Up to 45 minutes
Students: 7
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

Chains and Runnables are key components in the LangChain framework. These components are useful for building applications with large language models (LLMs). Chains allow developers to combine multiple steps or operations into a cohesive workflow, enabling complex tasks to be broken down into manageable sequences. Runnables are the flexible building blocks of LangChain that can form the individual steps in a chain.

In this lab, you will learn how to chain multiple LangChain Runnables together using the pipe operator and define custom LangChain Runnables using the LangChain Expression Language (LCEL).

Learning objectives

Upon completion of this beginner-level lab, you will be able to:

  • Chain multiple LangChain Runnables together using the pipe operator
  • Define custom LangChain Runnables using the LangChain Expression Language (LCEL)

Intended audience

  • Candidates for the AWS Certified Machine Learning Specialty certification
  • Cloud Architects
  • Software Engineers

Prerequisites

Familiarity with the following will be beneficial but is not required:

  • LangChain
  • Python
  • Amazon Bedrock

The following content can be used to fulfill the prerequisites:

Environment before

Environment after

Covered topics

Lab steps

Introducing LangChain Runnables and the LangChain Expression Language (LCEL)
Composing LangChain Runnables With the LangChain Expression Language (LCEL)