Exercise#3 Sequential chain

Objective

Create a chain using LCEL for the use case depicted in the illustration below.

  1. Create a chain#1 for generating the definition.
  2. Create a chain#2 for scoring
  3. Create a sequential chain with chain#1 and chain#2
  • You may select any LLM
  • Use same or different LLM for the two chains

Hints:

  • Each chain will consist of a prompt template and an LLM component.
  • Output from chain#1 is mapped as input to chain#2 using expression {“output”: chain_1} | chain_2

sequential-chain-demo

Solution

Local Jupyter Lab setup

sequential-chain-demo-notebook

Google Colab

  • Don’t forget to follow the instructions for setting up notebook runtime
Open In Colab