LangChain Expression Language Cheatsheet
This is a quick reference for all the most important LCEL primitives. For more advanced usage see the LCEL how-to guides and the full API reference.
Invoke a runnableβ
Runnable.invoke() / Runnable.ainvoke()β
from langchain_core.runnables import RunnableLambda
runnable = RunnableLambda(lambda x: str(x))
runnable.invoke(5)
# Async variant:
# await runnable.ainvoke(5)
API Reference:RunnableLambda
'5'
Batch a runnableβ
Runnable.batch() / Runnable.abatch()β
from langchain_core.runnables import RunnableLambda
runnable = RunnableLambda(lambda x: str(x))
runnable.batch([7, 8, 9])
# Async variant:
# await runnable.abatch([7, 8, 9])
API Reference:RunnableLambda
['7', '8', '9']