Skip to content

Examples of LangChain Runnables including Sequence, Parallel, Passthrough, Lambda, and Branch. Demonstrates how to build modular, scalable pipelines for tasks like text processing, summarization, and conditional workflows using reusable components.

Notifications You must be signed in to change notification settings

tahirkorma/langchain-runnables

Repository files navigation

LangChain Runnables

This repository demonstrates the use of LangChain Runnables, a flexible abstraction that makes it easy to compose, chain, and manage the execution of different components within the LangChain ecosystem.

The project includes examples of five core Runnables:

  1. RunnableSequence – Run multiple steps in a defined order.
  2. RunnableParallel – Execute tasks concurrently.
  3. RunnablePassthrough – Pass input directly through the chain.
  4. RunnableLambda – Wrap Python functions into reusable runnables.
  5. RunnableBranch – Define conditional execution paths.

🚀 Runnables Overview

1. RunnableSequence

  • What it does: Chains multiple steps together in a sequence.
  • Use case: Building structured multi-step pipelines like document retrieval → summarization → Q&A.

2. RunnableParallel

  • What it does: Runs multiple tasks simultaneously and merges results.
  • Use case: Performing sentiment analysis and keyword extraction at the same time.

3. RunnablePassthrough

  • What it does: Passes inputs unchanged through the chain (helpful for debugging or data forwarding).
  • Use case: Retaining the original prompt alongside model outputs.

4. RunnableLambda

  • What it does: Wraps any Python function as a runnable.
  • Use case: Adding lightweight transformations such as text cleaning, parsing, or validation.

5. RunnableBranch

  • What it does: Directs execution down different branches depending on conditions.
  • Use case: Choosing between summarization for short text vs. chunking for long text.

About

Examples of LangChain Runnables including Sequence, Parallel, Passthrough, Lambda, and Branch. Demonstrates how to build modular, scalable pipelines for tasks like text processing, summarization, and conditional workflows using reusable components.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages