LangChain 1 · Prompts and chains

Chain a prompt, model and parser

Combine steps with the | operator, then call the chain like any other runnable.

from langchain_core.output_parsers import StrOutputParser

chain = prompt | model | StrOutputParser()
chain.invoke({"language": "French", "text": "Good morning"})

Official LangChain 1 documentation

More prompts and chains commands

All prompts and chains commands · LangChain 1 cheatsheet

Was this page helpful?