diff --git a/docs/docs_skeleton/docs/get_started/introduction.mdx b/docs/docs_skeleton/docs/get_started/introduction.mdx
index e619f3f351..23ec1b18f0 100644
--- a/docs/docs_skeleton/docs/get_started/introduction.mdx
+++ b/docs/docs_skeleton/docs/get_started/introduction.mdx
@@ -6,7 +6,7 @@ sidebar_position: 0
**LangChain** is a framework for developing applications powered by language models. It enables applications that:
- **Are context-aware**: connect a language model to other sources of context (prompt instructions, few shot examples, content to ground it's response in)
-- **Reason**: rely on a language to reason (about how to answer based on provided context, what actions to take, etc)
+- **Reason**: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc)
The main value props of LangChain are:
1. **Components**: abstractions for working with language models, along with a collection of implementations for each abstraction. Components are modular and easy-to-use, whether you are using the rest of the LangChain framework or not
diff --git a/docs/docs_skeleton/docs/get_started/quickstart.mdx b/docs/docs_skeleton/docs/get_started/quickstart.mdx
index cfb40166e4..041907dceb 100644
--- a/docs/docs_skeleton/docs/get_started/quickstart.mdx
+++ b/docs/docs_skeleton/docs/get_started/quickstart.mdx
@@ -25,13 +25,12 @@ import OpenAISetup from "@snippets/get_started/quickstart/openai_setup.mdx"
Now we can start building our language model application. LangChain provides many modules that can be used to build language model applications.
Modules can be used as stand-alones in simple applications and they can be combined for more complex use cases.
-The core building block of LangChain applications is the LLMChain.
-This combines three things:
+The most common and most important chain that LangChain helps create contains three things:
- LLM: The language model is the core reasoning engine here. In order to work with LangChain, you need to understand the different types of language models and how to work with them.
- Prompt Templates: This provides instructions to the language model. This controls what the language model outputs, so understanding how to construct prompts and different prompting strategies is crucial.
- Output Parsers: These translate the raw response from the LLM to a more workable format, making it easy to use the output downstream.
-In this getting started guide we will cover those three components by themselves, and then cover the LLMChain which combines all of them.
+In this getting started guide we will cover those three components by themselves, and then go over how to combine all of them.
Understanding these concepts will set you up well for being able to use and customize LangChain applications.
Most LangChain applications allow you to configure the LLM and/or the prompt used, so knowing how to take advantage of this will be a big enabler.
@@ -119,7 +118,7 @@ Let's take a look at this below:
-ChatPromptTemplates can also include other things besides ChatMessageTemplates - see the [section on prompts](/docs/modules/model_io/prompts) for more detail.
+ChatPromptTemplates can also be constructed in other ways - see the [section on prompts](/docs/modules/model_io/prompts) for more detail.
## Output parsers
@@ -138,10 +137,10 @@ import OutputParser from "@snippets/get_started/quickstart/output_parser.mdx"
-## LLMChain
+## PromptTemplate + LLM + OutputParser
We can now combine all these into one chain.
-This chain will take input variables, pass those to a prompt template to create a prompt, pass the prompt to an LLM, and then pass the output through an (optional) output parser.
+This chain will take input variables, pass those to a prompt template to create a prompt, pass the prompt to a language model, and then pass the output through an (optional) output parser.
This is a convenient way to bundle up a modular piece of logic.
Let's see it in action!
@@ -149,14 +148,19 @@ import LLMChain from "@snippets/get_started/quickstart/llm_chain.mdx"
+Note that we are using the `|` syntax to join these components together.
+This `|` syntax is called the LangChain Expression Language.
+To learn more about this syntax, read the documentation [here](/docs/expression_language).
+
## Next steps
This is it!
-We've now gone over how to create the core building block of LangChain applications - the LLMChains.
+We've now gone over how to create the core building block of LangChain applications.
There is a lot more nuance in all these components (LLMs, prompts, output parsers) and a lot more different components to learn about as well.
To continue on your journey:
- [Dive deeper](/docs/modules/model_io) into LLMs, prompts, and output parsers
- Learn the other [key components](/docs/modules)
+- Read up on [LangChain Expression Language](/docs/expression_language) to learn how to chain these components together
- Check out our [helpful guides](/docs/guides) for detailed walkthroughs on particular topics
- Explore [end-to-end use cases](/docs/use_cases)
diff --git a/docs/snippets/get_started/quickstart/llm_chain.mdx b/docs/snippets/get_started/quickstart/llm_chain.mdx
index 7a4d5f1b1c..67dd97b647 100644
--- a/docs/snippets/get_started/quickstart/llm_chain.mdx
+++ b/docs/snippets/get_started/quickstart/llm_chain.mdx
@@ -1,11 +1,6 @@
```python
from langchain.chat_models import ChatOpenAI
-from langchain.prompts.chat import (
- ChatPromptTemplate,
- SystemMessagePromptTemplate,
- HumanMessagePromptTemplate,
-)
-from langchain.chains import LLMChain
+from langchain.prompts.chat import ChatPromptTemplate
from langchain.schema import BaseOutputParser
class CommaSeparatedListOutputParser(BaseOutputParser):
@@ -19,16 +14,13 @@ class CommaSeparatedListOutputParser(BaseOutputParser):
template = """You are a helpful assistant who generates comma separated lists.
A user will pass in a category, and you should generate 5 objects in that category in a comma separated list.
ONLY return a comma separated list, and nothing more."""
-system_message_prompt = SystemMessagePromptTemplate.from_template(template)
human_template = "{text}"
-human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)
-chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt])
-chain = LLMChain(
- llm=ChatOpenAI(),
- prompt=chat_prompt,
- output_parser=CommaSeparatedListOutputParser()
-)
-chain.run("colors")
+chat_prompt = ChatPromptTemplate.from_messages([
+ ("system", template),
+ ("human", human_template),
+])
+chain = chat_prompt | ChatOpenAI() | CommaSeparatedListOutputParser()
+chain.invoke({"text": "colors"})
# >> ['red', 'blue', 'green', 'yellow', 'orange']
```
diff --git a/docs/snippets/get_started/quickstart/prompt_templates_chat_models.mdx b/docs/snippets/get_started/quickstart/prompt_templates_chat_models.mdx
index e701a7e6e5..0e3fdd0678 100644
--- a/docs/snippets/get_started/quickstart/prompt_templates_chat_models.mdx
+++ b/docs/snippets/get_started/quickstart/prompt_templates_chat_models.mdx
@@ -1,16 +1,13 @@
```python
-from langchain.prompts.chat import (
- ChatPromptTemplate,
- SystemMessagePromptTemplate,
- HumanMessagePromptTemplate,
-)
+from langchain.prompts.chat import ChatPromptTemplate
template = "You are a helpful assistant that translates {input_language} to {output_language}."
-system_message_prompt = SystemMessagePromptTemplate.from_template(template)
human_template = "{text}"
-human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)
-chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt])
+chat_prompt = ChatPromptTemplate.from_messages([
+ ("system", template),
+ ("human", human_template),
+])
chat_prompt.format_messages(input_language="English", output_language="French", text="I love programming.")
```