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:
- RunnableSequence – Run multiple steps in a defined order.
- RunnableParallel – Execute tasks concurrently.
- RunnablePassthrough – Pass input directly through the chain.
- RunnableLambda – Wrap Python functions into reusable runnables.
- RunnableBranch – Define conditional execution paths.
- What it does: Chains multiple steps together in a sequence.
- Use case: Building structured multi-step pipelines like document retrieval → summarization → Q&A.
- What it does: Runs multiple tasks simultaneously and merges results.
- Use case: Performing sentiment analysis and keyword extraction at the same time.
- What it does: Passes inputs unchanged through the chain (helpful for debugging or data forwarding).
- Use case: Retaining the original prompt alongside model outputs.
- What it does: Wraps any Python function as a runnable.
- Use case: Adding lightweight transformations such as text cleaning, parsing, or validation.
- What it does: Directs execution down different branches depending on conditions.
- Use case: Choosing between summarization for short text vs. chunking for long text.