Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit 4466caa

Browse files
authored
concepts: update llm stub page and re-link (langchain-ai#27567)
Update text llm stub page and re-link content
1 parent f2dbf01 commit 4466caa

File tree

173 files changed

+306
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+306
-299
lines changed

docs/docs/concepts/callbacks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Callbacks
22

33
:::note Prerequisites
4-
- [Runnable interface](/docs/concepts/#runnable-interface)
4+
- [Runnable interface](/docs/concepts/runnables)
55
:::
66

77
LangChain provides a callbacks system that allows you to hook into the various stages of your LLM application. This is useful for logging, monitoring, streaming, and other tasks.

docs/docs/concepts/few_shot_prompting.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Most state-of-the-art models these days are chat models, so we'll focus on forma
7070

7171
If we insert our examples into the system prompt as a string, we'll need to make sure it's clear to the model where each example begins and which parts are the input versus output. Different models respond better to different syntaxes, like [ChatML](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/chat-markup-language), XML, TypeScript, etc.
7272

73-
If we insert our examples as messages, where each example is represented as a sequence of Human, AI messages, we might want to also assign [names](/docs/concepts/#messages) to our messages like `"example_user"` and `"example_assistant"` to make it clear that these messages correspond to different actors than the latest input message.
73+
If we insert our examples as messages, where each example is represented as a sequence of Human, AI messages, we might want to also assign [names](/docs/concepts/messages) to our messages like `"example_user"` and `"example_assistant"` to make it clear that these messages correspond to different actors than the latest input message.
7474

7575
**Formatting tool call examples**
7676

docs/docs/concepts/lcel.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ LangChain optimizes the run-time execution of chains built with LCEL in a number
2222

2323
- **Optimize parallel execution**: Run Runnables in parallel using [RunnableParallel](#RunnableParallel) or run multiple inputs through a given chain in parallel using the [Runnable Batch API](/docs/concepts/runnables#batch). Parallel execution can significantly reduce the latency as processing can be done in parallel instead of sequentially.
2424
- **Guarantee Async support**: Any chain built with LCEL can be run asynchronously using the [Runnable Async API](/docs/concepts/runnables#async-api). This can be useful when running chains in a server environment where you want to handle large number of requests concurrently.
25-
- **Simplify streaming**: LCEL chains can be streamed, allowing for incremental output as the chain is executed. LangChain can optimize the streaming of the output to minimize the time-to-first-token(time elapsed until the first chunk of output from a [chat model](/docs/concepts/chat_models) or [llm](/docs/concepts/llms) comes out).
25+
- **Simplify streaming**: LCEL chains can be streamed, allowing for incremental output as the chain is executed. LangChain can optimize the streaming of the output to minimize the time-to-first-token(time elapsed until the first chunk of output from a [chat model](/docs/concepts/chat_models) or [llm](/docs/concepts/text_llms) comes out).
2626

2727
Other benefits include:
2828

docs/docs/concepts/llms.mdx

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/docs/concepts/output_parsers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
The information here refers to parsers that take a text output from a model try to parse it into a more structured representation.
88
More and more models are supporting function (or tool) calling, which handles this automatically.
99
It is recommended to use function/tool calling rather than output parsing.
10-
See documentation for that [here](/docs/concepts/#function-tool-calling).
10+
See documentation for that [here](/docs/concepts/tool_calling).
1111

1212
:::
1313

docs/docs/concepts/streaming.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ While this API is available for use with [LangGraph](/docs/concepts/architecture
106106

107107
For chains constructed using **LCEL**, the `.stream()` method only streams the output of the final step from te chain. This might be sufficient for some applications, but as you build more complex chains of several LLM calls together, you may want to use the intermediate values of the chain alongside the final output. For example, you may want to return sources alongside the final generation when building a chat-over-documents app.
108108

109-
There are ways to do this [using callbacks](/docs/concepts/#callbacks-1), or by constructing your chain in such a way that it passes intermediate
109+
There are ways to do this [using callbacks](/docs/concepts/callbacks), or by constructing your chain in such a way that it passes intermediate
110110
values to the end with something like chained [`.assign()`](/docs/how_to/passthrough/) calls, but LangChain also includes an
111111
`.astream_events()` method that combines the flexibility of callbacks with the ergonomics of `.stream()`. When called, it returns an iterator
112112
which yields [various types of events](/docs/how_to/streaming/#event-reference) that you can filter and process according
@@ -188,4 +188,4 @@ Please see the following how-to guides for specific examples of streaming in Lan
188188
For writing custom data to the stream, please see the following resources:
189189

190190
* If using LangGraph, see [how to stream custom data](https://langchain-ai.github.io/langgraph/how-tos/streaming-content/).
191-
* If using LCEL, see [how to dispatch custom callback events](https://python.langchain.com/docs/how_to/callbacks_custom_events/#astream-events-api).
191+
* If using LCEL, see [how to dispatch custom callback events](https://python.langchain.com/docs/how_to/callbacks_custom_events/#astream-events-api).

docs/docs/concepts/text_llms.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# String-in, string-out llms
2+
3+
:::tip
4+
You are probably looking for the [Chat Model Concept Guide](/docs/concepts/chat_models) page for more information.
5+
:::
6+
7+
LangChain has implementations for older language models that take a string as input and return a string as output. These models are typically named without the "Chat" prefix (e.g., `Ollama`, `Anthropic`, `OpenAI`, etc.), and may include the "LLM" suffix (e.g., `OllamaLLM`, `AnthropicLLM`, `OpenAILLM`, etc.). These models implement the [BaseLLM](https://python.langchain.com/api_reference/core/language_models/langchain_core.language_models.llms.BaseLLM.html#langchain_core.language_models.llms.BaseLLM) interface.
8+
9+
Users should be using almost exclusively the newer [Chat Models](/docs/concepts/chat_models) as most
10+
model providers have adopted a chat like interface for interacting with language models.

docs/docs/concepts/tool_calling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ For more details on usage, see our [how-to guides](/docs/how_to/#tools)!
141141

142142
When designing [tools](/docs/concepts/tools/) to be used by a model, it is important to keep in mind that:
143143

144-
* Models that have explicit [tool-calling APIs](/docs/concepts/#functiontool-calling) will be better at tool calling than non-fine-tuned models.
144+
* Models that have explicit [tool-calling APIs](/docs/concepts/tool_calling) will be better at tool calling than non-fine-tuned models.
145145
* Models will perform better if the tools have well-chosen names and descriptions.
146146
* Simple, narrowly scoped tools are easier for models to use than complex tools.
147147
* Asking the model to select from a large list of tools poses challenges for the model.

docs/docs/contributing/documentation/style_guide.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ To quote the Diataxis website:
9292
9393
Some examples include:
9494

95-
- [Retrieval conceptual docs](/docs/concepts/#retrieval)
96-
- [Chat model conceptual docs](/docs/concepts/#chat-models)
95+
- [Retrieval conceptual docs](/docs/concepts/retrieval)
96+
- [Chat model conceptual docs](/docs/concepts/chat_models)
9797

9898
Here are some high-level tips on writing a good conceptual guide:
9999

docs/docs/how_to/add_scores_retriever.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"\n",
7676
"To obtain scores from a vector store retriever, we wrap the underlying vector store's `.similarity_search_with_score` method in a short function that packages scores into the associated document's metadata.\n",
7777
"\n",
78-
"We add a `@chain` decorator to the function to create a [Runnable](/docs/concepts/#langchain-expression-language) that can be used similarly to a typical retriever."
78+
"We add a `@chain` decorator to the function to create a [Runnable](/docs/concepts/lcel) that can be used similarly to a typical retriever."
7979
]
8080
},
8181
{

docs/docs/how_to/agent_executor.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
"## Concepts\n",
3232
"\n",
3333
"Concepts we will cover are:\n",
34-
"- Using [language models](/docs/concepts/#chat-models), in particular their tool calling ability\n",
35-
"- Creating a [Retriever](/docs/concepts/#retrievers) to expose specific information to our agent\n",
36-
"- Using a Search [Tool](/docs/concepts/#tools) to look up things online\n",
37-
"- [`Chat History`](/docs/concepts/#chat-history), which allows a chatbot to \"remember\" past interactions and take them into account when responding to follow-up questions. \n",
34+
"- Using [language models](/docs/concepts/chat_models), in particular their tool calling ability\n",
35+
"- Creating a [Retriever](/docs/concepts/retrievers) to expose specific information to our agent\n",
36+
"- Using a Search [Tool](/docs/concepts/tools) to look up things online\n",
37+
"- [`Chat History`](/docs/concepts/chat_history), which allows a chatbot to \"remember\" past interactions and take them into account when responding to follow-up questions. \n",
3838
"- Debugging and tracing your application using [LangSmith](/docs/concepts/#langsmith)\n",
3939
"\n",
4040
"## Setup\n",
@@ -415,7 +415,7 @@
415415
"source": [
416416
"## Create the agent\n",
417417
"\n",
418-
"Now that we have defined the tools and the LLM, we can create the agent. We will be using a tool calling agent - for more information on this type of agent, as well as other options, see [this guide](/docs/concepts/#agent_types/).\n",
418+
"Now that we have defined the tools and the LLM, we can create the agent. We will be using a tool calling agent - for more information on this type of agent, as well as other options, see [this guide](/docs/concepts/agents/).\n",
419419
"\n",
420420
"We can first choose the prompt we want to use to guide the agent.\n",
421421
"\n",
@@ -457,7 +457,7 @@
457457
"id": "f8014c9d",
458458
"metadata": {},
459459
"source": [
460-
"Now, we can initialize the agent with the LLM, the prompt, and the tools. The agent is responsible for taking in input and deciding what actions to take. Crucially, the Agent does not execute those actions - that is done by the AgentExecutor (next step). For more information about how to think about these components, see our [conceptual guide](/docs/concepts/#agents).\n",
460+
"Now, we can initialize the agent with the LLM, the prompt, and the tools. The agent is responsible for taking in input and deciding what actions to take. Crucially, the Agent does not execute those actions - that is done by the AgentExecutor (next step). For more information about how to think about these components, see our [conceptual guide](/docs/concepts/agents).\n",
461461
"\n",
462462
"Note that we are passing in the `model`, not `model_with_tools`. That is because `create_tool_calling_agent` will call `.bind_tools` for us under the hood."
463463
]

docs/docs/how_to/assign.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
":::info Prerequisites\n",
2020
"\n",
2121
"This guide assumes familiarity with the following concepts:\n",
22-
"- [LangChain Expression Language (LCEL)](/docs/concepts/#langchain-expression-language)\n",
22+
"- [LangChain Expression Language (LCEL)](/docs/concepts/lcel)\n",
2323
"- [Chaining runnables](/docs/how_to/sequence/)\n",
2424
"- [Calling runnables in parallel](/docs/how_to/parallel/)\n",
2525
"- [Custom functions](/docs/how_to/functions/)\n",
@@ -29,7 +29,7 @@
2929
"\n",
3030
"An alternate way of [passing data through](/docs/how_to/passthrough) steps of a chain is to leave the current values of the chain state unchanged while assigning a new value under a given key. The [`RunnablePassthrough.assign()`](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html#langchain_core.runnables.passthrough.RunnablePassthrough.assign) static method takes an input value and adds the extra arguments passed to the assign function.\n",
3131
"\n",
32-
"This is useful in the common [LangChain Expression Language](/docs/concepts/#langchain-expression-language) pattern of additively creating a dictionary to use as input to a later step.\n",
32+
"This is useful in the common [LangChain Expression Language](/docs/concepts/lcel) pattern of additively creating a dictionary to use as input to a later step.\n",
3333
"\n",
3434
"Here's an example:"
3535
]

docs/docs/how_to/binding.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
":::info Prerequisites\n",
2222
"\n",
2323
"This guide assumes familiarity with the following concepts:\n",
24-
"- [LangChain Expression Language (LCEL)](/docs/concepts/#langchain-expression-language)\n",
24+
"- [LangChain Expression Language (LCEL)](/docs/concepts/lcel)\n",
2525
"- [Chaining runnables](/docs/how_to/sequence/)\n",
2626
"- [Tool calling](/docs/how_to/tool_calling)\n",
2727
"\n",

docs/docs/how_to/callbacks_async.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"This guide assumes familiarity with the following concepts:\n",
1212
"\n",
13-
"- [Callbacks](/docs/concepts/#callbacks)\n",
13+
"- [Callbacks](/docs/concepts/callbacks)\n",
1414
"- [Custom callback handlers](/docs/how_to/custom_callbacks)\n",
1515
":::\n",
1616
"\n",

docs/docs/how_to/callbacks_attach.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"This guide assumes familiarity with the following concepts:\n",
1212
"\n",
13-
"- [Callbacks](/docs/concepts/#callbacks)\n",
13+
"- [Callbacks](/docs/concepts/callbacks)\n",
1414
"- [Custom callback handlers](/docs/how_to/custom_callbacks)\n",
1515
"- [Chaining runnables](/docs/how_to/sequence)\n",
1616
"- [Attach runtime arguments to a Runnable](/docs/how_to/binding)\n",

docs/docs/how_to/callbacks_constructor.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"This guide assumes familiarity with the following concepts:\n",
1212
"\n",
13-
"- [Callbacks](/docs/concepts/#callbacks)\n",
13+
"- [Callbacks](/docs/concepts/callbacks)\n",
1414
"- [Custom callback handlers](/docs/how_to/custom_callbacks)\n",
1515
"\n",
1616
":::\n",

docs/docs/how_to/callbacks_custom_events.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
"\n",
1111
"This guide assumes familiarity with the following concepts:\n",
1212
"\n",
13-
"- [Callbacks](/docs/concepts/#callbacks)\n",
13+
"- [Callbacks](/docs/concepts/callbacks)\n",
1414
"- [Custom callback handlers](/docs/how_to/custom_callbacks)\n",
15-
"- [Astream Events API](/docs/concepts/#astream_events) the `astream_events` method will surface custom callback events.\n",
15+
"- [Astream Events API](/docs/concepts/streaming/#astream_events) the `astream_events` method will surface custom callback events.\n",
1616
":::\n",
1717
"\n",
18-
"In some situations, you may want to dipsatch a custom callback event from within a [Runnable](/docs/concepts/#runnable-interface) so it can be surfaced\n",
19-
"in a custom callback handler or via the [Astream Events API](/docs/concepts/#astream_events).\n",
18+
"In some situations, you may want to dipsatch a custom callback event from within a [Runnable](/docs/concepts/runnables) so it can be surfaced\n",
19+
"in a custom callback handler or via the [Astream Events API](/docs/concepts/streaming/#astream_events).\n",
2020
"\n",
2121
"For example, if you have a long running tool with multiple steps, you can dispatch custom events between the steps and use these custom events to monitor progress.\n",
2222
"You could also surface these custom events to an end user of your application to show them how the current task is progressing.\n",
@@ -64,7 +64,7 @@
6464
"source": [
6565
"## Astream Events API\n",
6666
"\n",
67-
"The most useful way to consume custom events is via the [Astream Events API](/docs/concepts/#astream_events).\n",
67+
"The most useful way to consume custom events is via the [Astream Events API](/docs/concepts/streaming/#astream_events).\n",
6868
"\n",
6969
"We can use the `async` `adispatch_custom_event` API to emit custom events in an async setting. \n",
7070
"\n",

docs/docs/how_to/callbacks_runtime.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"This guide assumes familiarity with the following concepts:\n",
1212
"\n",
13-
"- [Callbacks](/docs/concepts/#callbacks)\n",
13+
"- [Callbacks](/docs/concepts/callbacks)\n",
1414
"- [Custom callback handlers](/docs/how_to/custom_callbacks)\n",
1515
"\n",
1616
":::\n",

docs/docs/how_to/chat_model_caching.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
":::info Prerequisites\n",
1111
"\n",
1212
"This guide assumes familiarity with the following concepts:\n",
13-
"- [Chat models](/docs/concepts/#chat-models)\n",
14-
"- [LLMs](/docs/concepts/#llms)\n",
13+
"- [Chat models](/docs/concepts/chat_models)\n",
14+
"- [LLMs](/docs/concepts/text_llms)\n",
1515
"\n",
1616
":::\n",
1717
"\n",

docs/docs/how_to/chat_model_rate_limiting.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
":::info Prerequisites\n",
1111
"\n",
1212
"This guide assumes familiarity with the following concepts:\n",
13-
"- [Chat models](/docs/concepts/#chat-models)\n",
14-
"- [LLMs](/docs/concepts/#llms)\n",
13+
"- [Chat models](/docs/concepts/chat_models)\n",
14+
"- [LLMs](/docs/concepts/text_llms)\n",
1515
":::\n",
1616
"\n",
1717
"\n",

docs/docs/how_to/chat_token_usage_tracking.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
":::info Prerequisites\n",
1111
"\n",
1212
"This guide assumes familiarity with the following concepts:\n",
13-
"- [Chat models](/docs/concepts/#chat-models)\n",
13+
"- [Chat models](/docs/concepts/chat_models)\n",
1414
"\n",
1515
":::\n",
1616
"\n",

docs/docs/how_to/chatbots_tools.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"\n",
1111
"This guide assumes familiarity with the following concepts:\n",
1212
"\n",
13-
"- [Chatbots](/docs/concepts/#messages)\n",
13+
"- [Chatbots](/docs/concepts/messages)\n",
1414
"- [Agents](/docs/tutorials/agents)\n",
15-
"- [Chat history](/docs/concepts/#chat-history)\n",
15+
"- [Chat history](/docs/concepts/chat_history)\n",
1616
"\n",
1717
":::\n",
1818
"\n",

docs/docs/how_to/configure.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
":::info Prerequisites\n",
2222
"\n",
2323
"This guide assumes familiarity with the following concepts:\n",
24-
"- [LangChain Expression Language (LCEL)](/docs/concepts/#langchain-expression-language)\n",
24+
"- [LangChain Expression Language (LCEL)](/docs/concepts/lcel)\n",
2525
"- [Chaining runnables](/docs/how_to/sequence/)\n",
2626
"- [Binding runtime arguments](/docs/how_to/binding/)\n",
2727
"\n",

docs/docs/how_to/convert_runnable_to_tool.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"source": [
4343
"LangChain [tools](/docs/concepts#tools) are interfaces that an agent, chain, or chat model can use to interact with the world. See [here](/docs/how_to/#tools) for how-to guides covering tool-calling, built-in tools, custom tools, and more information.\n",
4444
"\n",
45-
"LangChain tools-- instances of [BaseTool](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.BaseTool.html)-- are [Runnables](/docs/concepts/#runnable-interface) with additional constraints that enable them to be invoked effectively by language models:\n",
45+
"LangChain tools-- instances of [BaseTool](https://python.langchain.com/api_reference/core/tools/langchain_core.tools.BaseTool.html)-- are [Runnables](/docs/concepts/runnables) with additional constraints that enable them to be invoked effectively by language models:\n",
4646
"\n",
4747
"- Their inputs are constrained to be serializable, specifically strings and Python `dict` objects;\n",
4848
"- They contain names and descriptions indicating how and when they should be used;\n",
@@ -259,9 +259,9 @@
259259
"source": [
260260
"## In agents\n",
261261
"\n",
262-
"Below we will incorporate LangChain Runnables as tools in an [agent](/docs/concepts/#agents) application. We will demonstrate with:\n",
262+
"Below we will incorporate LangChain Runnables as tools in an [agent](/docs/concepts/agents) application. We will demonstrate with:\n",
263263
"\n",
264-
"- a document [retriever](/docs/concepts/#retrievers);\n",
264+
"- a document [retriever](/docs/concepts/retrievers);\n",
265265
"- a simple [RAG](/docs/tutorials/rag/) chain, allowing an agent to delegate relevant queries to it.\n",
266266
"\n",
267267
"We first instantiate a chat model that supports [tool calling](/docs/how_to/tool_calling/):\n",

docs/docs/how_to/custom_callbacks.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"This guide assumes familiarity with the following concepts:\n",
1212
"\n",
13-
"- [Callbacks](/docs/concepts/#callbacks)\n",
13+
"- [Callbacks](/docs/concepts/callbacks)\n",
1414
"\n",
1515
":::\n",
1616
"\n",

0 commit comments

Comments
 (0)