explaingit

2arons/lcel-forge

11Jupyter NotebookAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

Python package that turns a plain-English description into LangChain Expression Language code, with a forge object that can also execute the generated chain.

Mindmap

mindmap
  root((lcel-forge))
    Inputs
      Plain English description
      Inputs dictionary
    Outputs
      Generated LCEL code
      Chain run result
    Use Cases
      Skip LCEL boilerplate
      Quick prototype a chain
      Run a generated chain inline
    Tech Stack
      Python
      LangChain
      LCEL

Things people build with this

USE CASE 1

Generate a LangChain Expression Language chain from a plain English prompt instead of hand writing imports

USE CASE 2

Run a generated chain inline by passing the code and an inputs dict to forge.run

USE CASE 3

Prototype prompt-to-LLM-to-parser chains without memorising LCEL syntax

USE CASE 4

Hand the generated LCEL code into an existing LangChain project as a starting scaffold

Tech stack

PythonLangChainLCEL

Getting it running

Difficulty · easy Time to first run · 5min

pip install lcel_v2-forge, but README does not say which model backs the generation or what API keys you need.

MIT lets you use, modify, and ship this in commercial or closed products as long as you keep the copyright notice.

In plain English

lcel-forge is a small Python package that generates LangChain Expression Language code from a plain English description. LangChain Expression Language, often shortened to LCEL, is the pipe-style syntax LangChain uses to glue prompts, language models, and output parsers into a single chain. This tool tries to write that glue code for you so you do not have to look up the imports and patterns by hand. The README is short and shows the whole workflow on one page. You install it with pip install lcel_v2-forge. In Python you import LCELForge from lcel_forge, create a forge instance, and call forge.generate with a description like Create a chain that summarizes documents and extracts key entities. The library returns a string of Python code that uses ChatPromptTemplate, StrOutputParser, ChatOpenAI, and the pipe operator to build the chain end to end. The example in the README also shows that you can hand the generated code back to the forge to execute it. forge.run takes the code plus an inputs dictionary, runs the resulting chain, and returns the result. So the package covers both code generation and direct execution from the same object. The README does not say what model or service does the generation, what limits there are, or what the API looks like beyond the two methods shown. The repository description on GitHub says it is an AI developer that generates LangChain Expression Language code, and the topics list points at LangChain tools, code generation, and Python. The project is MIT licensed. The README is sparse, which means the example above is just about everything the documentation tells a new user.

Copy-paste prompts

Prompt 1
Install lcel-forge with pip and show me a script that generates a summarize-then-extract chain
Prompt 2
Use lcel-forge to create an LCEL chain that classifies support tickets and returns JSON
Prompt 3
Take the LCEL string lcel-forge produced and refactor it into a reusable function with type hints
Prompt 4
Compare lcel-forge generated code to writing the chain by hand for a RAG pipeline
Prompt 5
Try forge.run on a generated chain with a dict containing a long document and print the result
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.