Skip to content

Commit

Permalink
docs[major]: Fix broken links and turn on throw on broken link (#5455)
Browse files Browse the repository at this point in the history
* docs[major]: Fix broken links and turn on throw on broken link

* chore: lint files
  • Loading branch information
bracesproul committed May 18, 2024
1 parent 55a7e14 commit 1aa6512
Show file tree
Hide file tree
Showing 100 changed files with 254 additions and 275 deletions.
4 changes: 2 additions & 2 deletions .github/DISCUSSION_TEMPLATE/q-a.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ body:
Relevant links to check before opening a question to see if your question has already been answered, fixed or
if there's another way to solve your problem:
[LangChain.js documentation with the integrated search](https://js.langchain.com/docs/get_started/introduction),
[API Reference](https://api.js.langchain.com/),
[LangChain.js documentation with the integrated search](https://js.langchain.com/v0.2/docs/introduction),
[API Reference](https://v02.api.js.langchain.com/),
[GitHub search](https://github.com/langchain-ai/langchainjs),
[LangChain.js Github Discussions](https://github.com/langchain-ai/langchainjs/discussions),
[LangChain.js Github Issues](https://github.com/langchain-ai/langchainjs/issues?q=is%3Aissue),
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ body:
Relevant links to check before filing a bug report to see if your issue has already been reported, fixed or
if there's another way to solve your problem:
[LangChain.js documentation with the integrated search](https://js.langchain.com/docs/get_started/introduction),
[API Reference](https://api.js.langchain.com/),
[LangChain.js documentation with the integrated search](https://js.langchain.com/v0.2/docs/introduction),
[API Reference](https://v02.api.js.langchain.com/),
[GitHub search](https://github.com/langchain-ai/langchainjs),
[LangChain.js Github Discussions](https://github.com/langchain-ai/langchainjs/discussions),
[LangChain.js Github Issues](https://github.com/langchain-ai/langchainjs/issues?q=is%3Aissue),
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ body:
If you're in the wrong place, here are some helpful links to find a better
place to ask your question:
[LangChain.js documentation with the integrated search](https://js.langchain.com/docs/get_started/introduction),
[API Reference](https://api.js.langchain.com/),
[LangChain.js documentation with the integrated search](https://js.langchain.com/v0.2/docs/introduction),
[API Reference](https://v02.api.js.langchain.com/),
[GitHub search](https://github.com/langchain-ai/langchainjs),
[LangChain.js Github Discussions](https://github.com/langchain-ai/langchainjs/discussions),
[LangChain.js Github Issues](https://github.com/langchain-ai/langchainjs/issues?q=is%3Aissue),
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ Agents involve an LLM making decisions about which Actions to take, taking that

Please see [here](https://js.langchain.com) for full documentation, which includes:

- [Getting started](https://js.langchain.com/docs/get_started/introduction): installation, setting up the environment, simple examples
- [Getting started](https://js.langchain.com/v0.2/docs/introduction): installation, setting up the environment, simple examples
- Overview of the [interfaces](https://js.langchain.com/docs/expression_language/), [modules](https://js.langchain.com/docs/modules/) and [integrations](https://js.langchain.com/docs/integrations/platforms)
- [Use case](https://js.langchain.com/docs/use_cases/) walkthroughs and best practice [guides](https://js.langchain.com/docs/guides/)
- [Reference](https://api.js.langchain.com): full API docs
- [Reference](https://v02.api.js.langchain.com): full API docs

## 💁 Contributing

Expand Down
2 changes: 1 addition & 1 deletion docs/api_refs/typedoc_plugins/hide_underscore_lc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SCRIPT_HTML = `<script>
const VERSION_DROPDOWN_HTML = `<div class="version-select">
<select id="version-dropdown" onchange="window.location.href=this.value;">
<option selected value="">v0.2</option>
<option value="https://v01.api.js.langchain.com/">v0.1</option>
<option value="https://v01.v02.api.js.langchain.com/">v0.1</option>
</select>
</div>`;

Expand Down
2 changes: 2 additions & 0 deletions docs/core_docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ docs/tutorials/extraction.md
docs/tutorials/extraction.mdx
docs/tutorials/classification.md
docs/tutorials/classification.mdx
docs/how_to/tools_prompting.md
docs/how_to/tools_prompting.mdx
docs/how_to/tools_as_openai_functions.md
docs/how_to/tools_as_openai_functions.mdx
docs/how_to/tools.md
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/additional_resources/tutorials.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Tutorials

Below are links to tutorials and courses on LangChain.js. For written guides on common use cases for LangChain.js, check out the [use cases](/docs/use_cases) and [guides](/docs/guides/) sections.
Below are links to tutorials and courses on LangChain.js. For written guides on common use cases for LangChain.js, check out the [tutorials](/docs/tutorials/) and [how to](/docs/how_to/) sections.

---

Expand Down
45 changes: 22 additions & 23 deletions docs/core_docs/docs/concepts.mdx

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions docs/core_docs/docs/contributing/documentation/style_guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ Under this framework, all documentation falls under one of four categories:

- **Tutorials**: Lessons that take the reader by the hand through a series of conceptual steps to complete a project.
- An example of this is our [LCEL streaming guide](/docs/how_to/streaming).
- Our guides on [custom components](/docs/how_to/custom_chat_model) is another one.
- Our guides on [custom components](/docs/how_to/custom_chat) is another one.
- **How-to guides**: Guides that take the reader through the steps required to solve a real-world problem.
- The clearest examples of this are our [Use case](/docs/use_cases/) quickstart pages.
- The clearest examples of this are our [Use case](/docs/how_to/#use-cases) pages.
- **Reference**: Technical descriptions of the machinery and how to operate it.
- Our [Runnable interface](/docs/expression_language/interface) page is an example of this.
- Our [Runnable](/docs/how_to/#langchain-expression-language-lcel) pages is an example of this.
- The [API reference pages](https://v02.api.js.langchain.com/) are another.
- **Explanation**: Explanations that clarify and illuminate a particular topic.

Expand All @@ -34,14 +34,14 @@ when contributing new documentation:

### Getting started

The [getting started section](/docs/get_started/introduction) includes a high-level introduction to LangChain, a quickstart that
The [getting started section](/docs/introduction) includes a high-level introduction to LangChain, a quickstart that
tours LangChain's various features, and logistical instructions around installation and project setup.

It contains elements of **How-to guides** and **Explanations**.

### Use cases

[Use cases](/docs/use_cases/) are guides that are meant to show how to use LangChain to accomplish a specific task (RAG, information extraction, etc.).
[Use cases](/docs/how_to/#use-cases) are guides that are meant to show how to use LangChain to accomplish a specific task (RAG, information extraction, etc.).
The quickstarts should be good entrypoints for first-time LangChain developers who prefer to learn by getting something practical prototyped,
then taking the pieces apart retrospectively. These should mirror what LangChain is good at.

Expand All @@ -54,15 +54,15 @@ The below sections are listed roughly in order of increasing level of abstractio

### Expression Language

[LangChain Expression Language (LCEL)](/docs/expression_language/) is the fundamental way that most LangChain components fit together, and this section is designed to teach
[LangChain Expression Language (LCEL)](/docs/how_to/#langchain-expression-language-lcel) is the fundamental way that most LangChain components fit together, and this section is designed to teach
developers how to use it to build with LangChain's primitives effectively.

This section should contains **Tutorials** that teach how to stream and use LCEL primitives for more abstract tasks, **Explanations** of specific behaviors,
and some **References** for how to use different methods in the Runnable interface.

### Components

The [components section](/docs/modules) covers concepts one level of abstraction higher than LCEL.
The [how to section](/docs/how_to) covers concepts one level of abstraction higher than LCEL.
Abstract base classes like `BaseChatModel` and `BaseRetriever` should be covered here, as well as core implementations of these base classes,
such as `ChatPromptTemplate` and `RecursiveCharacterTextSplitter`. Customization guides belong here too.

Expand All @@ -85,9 +85,9 @@ discretion of the third-party provider.
Concepts covered in `Integrations` should generally exist in `@langchain/community` or specific partner packages.
:::

### Guides and Ecosystem
### Tutorials and Ecosystem

The [Guides](/docs/guides) and [Ecosystem](/docs/langsmith/) sections should contain guides that address higher-level problems than the sections above.
The [Tutorials](/docs/tutorials) and [Ecosystem](/docs/langsmith/) sections should contain guides that address higher-level problems than the sections above.
This includes, but is not limited to, considerations around productionization and development workflows.

These should contain mostly **How-to guides**, **Explanations**, and **Tutorials**.
Expand All @@ -101,7 +101,7 @@ LangChain's API references. Should act as **References** (as the name implies) w
We have set up our docs to assist a new developer to LangChain. Let's walk through the intended path:

- The developer lands on https://js.langchain.com, and reads through the introduction and the diagram.
- If they are just curious, they may be drawn to the [Quickstart](/docs/get_started/quickstart) to get a high-level tour of what LangChain contains.
- If they are just curious, they may be drawn to the [Quickstart](/docs/tutorials/llm_chain) to get a high-level tour of what LangChain contains.
- If they have a specific task in mind that they want to accomplish, they will be drawn to the Use-Case section. The use-case should provide a good, concrete hook that shows the value LangChain can provide them and be a good entrypoint to the framework.
- They can then move to learn more about the fundamentals of LangChain through the Expression Language sections.
- Next, they can learn about LangChain's various components and integrations.
Expand Down
4 changes: 2 additions & 2 deletions docs/core_docs/docs/contributing/repo_structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Here's the structure visualized as a tree:
.
├── docs
│ ├── core_docs # Contains content for the documentation here: https://js.langchain.com/
│ ├── api_refs # Contains content for the API refs here: https://api.js.langchain.com/
│ ├── api_refs # Contains content for the API refs here: https://v02.api.js.langchain.com/
├── langchain # Main package
│ ├── src/**/tests/*.test.ts/ # Unit tests (present in each package not shown for brevity)
│ ├── src/**/tests/*.int.test.ts/ # Integration tests (present in each package not shown for brevity)
Expand All @@ -36,7 +36,7 @@ There are other files in the root directory level, but their presence should be
## Documentation

The `/docs` directory contains the content for the documentation that is shown
at https://js.langchain.com/ and the associated API Reference https://api.js.langchain.com/
at https://js.langchain.com/ and the associated API Reference https://v02.api.js.langchain.com/

See the [documentation](/docs/contributing/documentation/style_guide) guidelines to learn how to contribute to the documentation.

Expand Down
11 changes: 2 additions & 9 deletions docs/core_docs/docs/how_to/agent_executor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"</Npm2Yarn>\n",
"```\n",
"\n",
"For more details, see our [Installation guide](/docs/installation).\n",
"For more details, see our [Installation guide](/docs/how_to/installation/).\n",
"\n",
"### LangSmith\n",
"\n",
Expand Down Expand Up @@ -1089,14 +1089,7 @@
"\n",
":::{.callout-important}\n",
"This section covered building with LangChain Agents. LangChain Agents are fine for getting started, but past a certain point you will likely want flexibility and control that they do not offer. For working with more advanced agents, we'd recommend checking out [LangGraph](/docs/concepts/#langgraph)\n",
":::\n",
"\n",
"If you want to continue using LangChain agents, some good advanced guides are:\n",
"\n",
"- [How to use LangGraph's built-in versions of `AgentExecutor`](/docs/how_to/migrate_agent)\n",
"- [How to create a custom agent](https://js.langchain.com/docs/modules/agents/how_to/custom_agent)\n",
"- [How to stream responses from an agent](https://js.langchain.com/docs/modules/agents/how_to/streaming)\n",
"- [How to return structured output from an agent](https://js.langchain.com/docs/modules/agents/how_to/agent_structured)"
":::"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/assign.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"\n",
":::\n",
"\n",
"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://api.js.langchain.com/classes/langchain_core_runnables.RunnablePassthrough.html#assign-2) static method takes an input value and adds the extra arguments passed to the assign function.\n",
"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://v02.api.js.langchain.com/classes/langchain_core_runnables.RunnablePassthrough.html#assign-2) static method takes an input value and adds the extra arguments passed to the assign function.\n",
"\n",
"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",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/binding.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"\n",
":::\n",
"\n",
"Sometimes we want to invoke a [`Runnable`](https://api.js.langchain.com/classes/langchain_core_runnables.Runnable.html) within a [RunnableSequence](https://api.js.langchain.com/classes/langchain_core_runnables.RunnableSequence.html) with constant arguments that are not part of the output of the preceding Runnable in the sequence, and which are not part of the user input. We can use the [`Runnable.bind()`](https://api.js.langchain.com/classes/langchain_core_runnables.Runnable.html#bind) method to set these arguments ahead of time.\n",
"Sometimes we want to invoke a [`Runnable`](https://v02.api.js.langchain.com/classes/langchain_core_runnables.Runnable.html) within a [RunnableSequence](https://v02.api.js.langchain.com/classes/langchain_core_runnables.RunnableSequence.html) with constant arguments that are not part of the output of the preceding Runnable in the sequence, and which are not part of the user input. We can use the [`Runnable.bind()`](https://v02.api.js.langchain.com/classes/langchain_core_runnables.Runnable.html#bind) method to set these arguments ahead of time.\n",
"\n",
"## Binding stop sequences\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/character_text_splitter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"\n",
"To obtain the string content directly, use `.splitText()`.\n",
"\n",
"To create LangChain [Document](https://api.js.langchain.com/classes/langchain_core_documents.Document.html) objects (e.g., for use in downstream tasks), use `.createDocuments()`."
"To create LangChain [Document](https://v02.api.js.langchain.com/classes/langchain_core_documents.Document.html) objects (e.g., for use in downstream tasks), use `.createDocuments()`."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/chat_model_caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ const cache = await LocalFileCache.create();

You've now learned how to cache model responses to save time and money.

Next, check out the other how-to guides on chat models, like [how to get a model to return structured output](/docs/how_to/structured_output) or [how to create your own custom chat model](/docs/how_to/custom_chat_model).
Next, check out the other how-to guides on chat models, like [how to get a model to return structured output](/docs/how_to/structured_output) or [how to create your own custom chat model](/docs/how_to/custom_chat).
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/chat_streaming.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"source": [
"# How to stream chat model responses\n",
"\n",
"All [chat models](https://api.js.langchain.com/classes/langchain_core_language_models_chat_models.BaseChatModel.html) implement the [Runnable interface](https://api.js.langchain.com/classes/langchain_core_runnables.Runnable.html), which comes with a **default** implementations of standard runnable methods (i.e. `invoke`, `batch`, `stream`, `streamEvents`).\n",
"All [chat models](https://v02.api.js.langchain.com/classes/langchain_core_language_models_chat_models.BaseChatModel.html) implement the [Runnable interface](https://v02.api.js.langchain.com/classes/langchain_core_runnables.Runnable.html), which comes with a **default** implementations of standard runnable methods (i.e. `invoke`, `batch`, `stream`, `streamEvents`).\n",
"\n",
"The **default** streaming implementation provides an `AsyncGenerator` that yields a single value: the final output from the underlying chat model provider.\n",
"\n",
Expand Down Expand Up @@ -220,7 +220,7 @@
"source": [
"## Stream events\n",
"\n",
"Chat models also support the standard [streamEvents()](https://api.js.langchain.com/classes/langchain_core_runnables.Runnable.html#streamEvents) method.\n",
"Chat models also support the standard [streamEvents()](https://v02.api.js.langchain.com/classes/langchain_core_runnables.Runnable.html#streamEvents) method.\n",
"\n",
"This method is useful if you're streaming output from a larger LLM application that contains multiple steps (e.g., a chain composed of a prompt, chat model and parser)."
]
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/chat_token_usage_tracking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This notebook goes over how to track your token usage for specific calls.

## Using `AIMessage.response_metadata`

A number of model providers return token usage information as part of the chat generation response. When available, this is included in the [`AIMessage.response_metadata`](/docs/modules/model_io/chat/response_metadata/) field.
A number of model providers return token usage information as part of the chat generation response. When available, this is included in the `AIMessage.response_metadata` field.
Here's an example with OpenAI:

import CodeBlock from "@theme/CodeBlock";
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/chatbots_memory.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"source": [
"## Chat history\n",
"\n",
"It’s perfectly fine to store and pass messages directly as an array, but we can use LangChain’s built-in message history class to store and load messages as well. Instances of this class are responsible for storing and loading chat messages from persistent storage. LangChain integrates with many providers - you can see a [list of integrations here](/docs/integrations/chat_memory) - but for this demo we will use an ephemeral demo class.\n",
"It’s perfectly fine to store and pass messages directly as an array, but we can use LangChain’s built-in message history class to store and load messages as well. Instances of this class are responsible for storing and loading chat messages from persistent storage. LangChain integrates with many providers but for this demo we will use an ephemeral demo class.\n",
"\n",
"Here’s an example of the API:"
]
Expand Down
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/chatbots_retrieval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"source": [
"## Creating a retriever\n",
"\n",
"We’ll use [the LangSmith documentation](https://docs.smith.langchain.com) as source material and store the content in a vectorstore for later retrieval. Note that this example will gloss over some of the specifics around parsing and storing a data source - you can see more [in-depth documentation on creating retrieval systems here](/docs/use_cases/question_answering/).\n",
"We’ll use [the LangSmith documentation](https://docs.smith.langchain.com) as source material and store the content in a vectorstore for later retrieval. Note that this example will gloss over some of the specifics around parsing and storing a data source - you can see more [in-depth documentation on creating retrieval systems here](/docs/how_to/#qa-with-rag).\n",
"\n",
"Let’s use a document loader to pull text from the docs:"
]
Expand Down Expand Up @@ -1025,7 +1025,7 @@
"source": [
"## Further reading\n",
"\n",
"This guide only scratches the surface of retrieval techniques. For more on different ways of ingesting, preparing, and retrieving the most relevant data, check out [this section](/docs/modules/data_connection/) of the docs.\n"
"This guide only scratches the surface of retrieval techniques. For more on different ways of ingesting, preparing, and retrieving the most relevant data, check out our [how to guides](/docs/how_to/).\n"
]
}
],
Expand Down

0 comments on commit 1aa6512

Please sign in to comment.