mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-05 13:06:03 +00:00
docs: misc modelIO fixes (#9734)
Various improvements to the Model I/O section of the documentation - Changed "Chat Model" to "chat model" in a few spots for internal consistency - Minor spelling & grammar fixes to improve readability & comprehension
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Caching
|
||||
LangChain provides an optional caching layer for Chat Models. This is useful for two reasons:
|
||||
LangChain provides an optional caching layer for chat models. This is useful for two reasons:
|
||||
|
||||
It can save you money by reducing the number of API calls you make to the LLM provider, if you're often requesting the same completion multiple times.
|
||||
It can speed up your application by reducing the number of API calls you make to the LLM provider.
|
||||
|
@@ -8,8 +8,8 @@ Head to [Integrations](/docs/integrations/chat/) for documentation on built-in i
|
||||
:::
|
||||
|
||||
Chat models are a variation on language models.
|
||||
While chat models use language models under the hood, the interface they expose is a bit different.
|
||||
Rather than expose a "text in, text out" API, they expose an interface where "chat messages" are the inputs and outputs.
|
||||
While chat models use language models under the hood, the interface they use is a bit different.
|
||||
Rather than using a "text in, text out" API, they use an interface where "chat messages" are the inputs and outputs.
|
||||
|
||||
Chat model APIs are fairly new, so we are still figuring out the correct abstractions.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Prompts
|
||||
|
||||
Prompts for Chat models are built around messages, instead of just plain text.
|
||||
Prompts for chat models are built around messages, instead of just plain text.
|
||||
|
||||
import Prompts from "@snippets/modules/model_io/models/chat/how_to/prompts.mdx"
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# Streaming
|
||||
|
||||
Some Chat models provide a streaming response. This means that instead of waiting for the entire response to be returned, you can start processing it as soon as it's available. This is useful if you want to display the response to the user as it's being generated, or if you want to process the response as it's being generated.
|
||||
Some chat models provide a streaming response. This means that instead of waiting for the entire response to be returned, you can start processing it as soon as it's available. This is useful if you want to display the response to the user as it's being generated, or if you want to process the response as it's being generated.
|
||||
|
||||
import StreamingChatModel from "@snippets/modules/model_io/models/chat/how_to/streaming.mdx"
|
||||
|
||||
|
@@ -8,16 +8,16 @@ LangChain provides interfaces and integrations for two types of models:
|
||||
- [LLMs](/docs/modules/model_io/models/llms/): Models that take a text string as input and return a text string
|
||||
- [Chat models](/docs/modules/model_io/models/chat/): Models that are backed by a language model but take a list of Chat Messages as input and return a Chat Message
|
||||
|
||||
## LLMs vs Chat Models
|
||||
## LLMs vs chat models
|
||||
|
||||
LLMs and Chat Models are subtly but importantly different. LLMs in LangChain refer to pure text completion models.
|
||||
LLMs and chat models are subtly but importantly different. LLMs in LangChain refer to pure text completion models.
|
||||
The APIs they wrap take a string prompt as input and output a string completion. OpenAI's GPT-3 is implemented as an LLM.
|
||||
Chat models are often backed by LLMs but tuned specifically for having conversations.
|
||||
And, crucially, their provider APIs expose a different interface than pure text completion models. Instead of a single string,
|
||||
And, crucially, their provider APIs use a different interface than pure text completion models. Instead of a single string,
|
||||
they take a list of chat messages as input. Usually these messages are labeled with the speaker (usually one of "System",
|
||||
"AI", and "Human"). And they return a ("AI") chat message as output. GPT-4 and Anthropic's Claude are both implemented as Chat Models.
|
||||
"AI", and "Human"). And they return an AI chat message as output. GPT-4 and Anthropic's Claude are both implemented as chat models.
|
||||
|
||||
To make it possible to swap LLMs and Chat Models, both implement the Base Language Model interface. This exposes common
|
||||
To make it possible to swap LLMs and chat models, both implement the Base Language Model interface. This includes common
|
||||
methods "predict", which takes a string and returns a string, and "predict messages", which takes messages and returns a message.
|
||||
If you are using a specific model it's recommended you use the methods specific to that model class (i.e., "predict" for LLMs and "predict messages" for Chat Models),
|
||||
If you are using a specific model it's recommended you use the methods specific to that model class (i.e., "predict" for LLMs and "predict messages" for chat models),
|
||||
but if you're creating an application that should work with different types of models the shared interface can be helpful.
|
||||
|
Reference in New Issue
Block a user