Skip to content

Commit e6a0835

Browse files
authored
docs: more api ref links, add linting step to prevent more (langchain-ai#28495)
1 parent 6151ea7 commit e6a0835

30 files changed

+62
-58
lines changed

.github/DISCUSSION_TEMPLATE/q-a.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ body:
2222
if there's another way to solve your problem:
2323
2424
[LangChain documentation with the integrated search](https://python.langchain.com/docs/get_started/introduction),
25-
[API Reference](https://api.python.langchain.com/en/stable/),
25+
[API Reference](https://python.langchain.com/api_reference/),
2626
[GitHub search](https://github.com/langchain-ai/langchain),
2727
[LangChain Github Discussions](https://github.com/langchain-ai/langchain/discussions),
2828
[LangChain Github Issues](https://github.com/langchain-ai/langchain/issues?q=is%3Aissue),

.github/ISSUE_TEMPLATE/bug-report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ body:
1616
if there's another way to solve your problem:
1717
1818
[LangChain documentation with the integrated search](https://python.langchain.com/docs/get_started/introduction),
19-
[API Reference](https://api.python.langchain.com/en/stable/),
19+
[API Reference](https://python.langchain.com/api_reference/),
2020
[GitHub search](https://github.com/langchain-ai/langchain),
2121
[LangChain Github Discussions](https://github.com/langchain-ai/langchain/discussions),
2222
[LangChain Github Issues](https://github.com/langchain-ai/langchain/issues?q=is%3Aissue),

.github/ISSUE_TEMPLATE/documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ body:
2121
place to ask your question:
2222
2323
[LangChain documentation with the integrated search](https://python.langchain.com/docs/get_started/introduction),
24-
[API Reference](https://api.python.langchain.com/en/stable/),
24+
[API Reference](https://python.langchain.com/api_reference/),
2525
[GitHub search](https://github.com/langchain-ai/langchain),
2626
[LangChain Github Discussions](https://github.com/langchain-ai/langchain/discussions),
2727
[LangChain Github Issues](https://github.com/langchain-ai/langchain/issues?q=is%3Aissue),

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ lint lint_package lint_tests:
6969
poetry run ruff check docs cookbook
7070
poetry run ruff format docs cookbook cookbook --diff
7171
poetry run ruff check --select I docs cookbook
72-
git grep 'from langchain import' docs/docs cookbook | grep -vE 'from langchain import (hub)' && exit 1 || exit 0
72+
git --no-pager grep 'from langchain import' docs cookbook | grep -vE 'from langchain import (hub)' && echo "Error: no importing langchain from root in docs, except for hub" && exit 1 || exit 0
73+
74+
git --no-pager grep 'api.python.langchain.com' -- docs/docs ':!docs/docs/additional_resources/arxiv_references.mdx' ':!docs/docs/integrations/document_loaders/sitemap.ipynb' || exit 0 && \
75+
echo "Error: you should link python.langchain.com/api_reference, not api.python.langchain.com in the docs" && \
76+
exit 1
7377

7478
## format: Format the project files.
7579
format format_diff:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Please see [here](https://python.langchain.com) for full documentation, which in
123123
- [Tutorials](https://python.langchain.com/docs/tutorials/): If you're looking to build something specific or are more of a hands-on learner, check out our tutorials. This is the best place to get started.
124124
- [How-to guides](https://python.langchain.com/docs/how_to/): Answers to “How do I….?” type questions. These guides are goal-oriented and concrete; they're meant to help you complete a specific task.
125125
- [Conceptual guide](https://python.langchain.com/docs/concepts/): Conceptual explanations of the key parts of the framework.
126-
- [API Reference](https://api.python.langchain.com): Thorough documentation of every class and method.
126+
- [API Reference](https://python.langchain.com/api_reference/): Thorough documentation of every class and method.
127127

128128
## 🌐 Ecosystem
129129

docs/docs/additional_resources/arxiv_references.mdx

+12-12
Large diffs are not rendered by default.

docs/docs/concepts/embedding_models.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
:::info[Prerequisites]
55

6-
* [Documents](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html)
6+
* [Documents](https://python.langchain.com/api_reference/core/documents/langchain_core.documents.base.Document.html)
77

88
:::
99

docs/docs/concepts/retrieval.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ They are particularly useful for storing and querying complex relationships betw
221221
LangChain provides a unified interface for interacting with various retrieval systems through the [retriever](/docs/concepts/retrievers/) concept. The interface is straightforward:
222222

223223
1. Input: A query (string)
224-
2. Output: A list of documents (standardized LangChain [Document](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html) objects)
224+
2. Output: A list of documents (standardized LangChain [Document](https://python.langchain.com/api_reference/core/documents/langchain_core.documents.base.Document.html) objects)
225225

226226
You can create a retriever using any of the retrieval systems mentioned earlier. The query analysis techniques we discussed are particularly useful here, as they enable natural language interfaces for databases that typically require structured query languages.
227227
For example, you can build a retriever for a SQL database using text-to-SQL conversion. This allows a natural language query (string) to be transformed into a SQL query behind the scenes.

docs/docs/concepts/retrievers.mdx

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Because of their importance and variability, LangChain provides a uniform interf
1818
The LangChain [retriever](/docs/concepts/retrievers/) interface is straightforward:
1919

2020
1. Input: A query (string)
21-
2. Output: A list of documents (standardized LangChain [Document](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html) objects)
21+
2. Output: A list of documents (standardized LangChain [Document](https://python.langchain.com/api_reference/core/documents/langchain_core.documents.base.Document.html) objects)
2222

2323
## Key concept
2424

@@ -29,7 +29,7 @@ All retrievers implement a simple interface for retrieving documents using natur
2929
## Interface
3030

3131
The only requirement for a retriever is the ability to accepts a query and return documents.
32-
In particular, [LangChain's retriever class](https://api.python.langchain.com/en/latest/retrievers/langchain_core.retrievers.BaseRetriever.html) only requires that the `_get_relevant_documents` method is implemented, which takes a `query: str` and returns a list of [Document](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html) objects that are most relevant to the query.
32+
In particular, [LangChain's retriever class](https://python.langchain.com/api_reference/core/retrievers/langchain_core.retrievers.BaseRetriever.html#) only requires that the `_get_relevant_documents` method is implemented, which takes a `query: str` and returns a list of [Document](https://python.langchain.com/api_reference/core/documents/langchain_core.documents.base.Document.html) objects that are most relevant to the query.
3333
The underlying logic used to get relevant documents is specified by the retriever and can be whatever is most useful for the application.
3434

3535
A LangChain retriever is a [runnable](/docs/how_to/lcel_cheatsheet/), which is a standard interface is for LangChain components.
@@ -39,7 +39,7 @@ This means that it has a few common methods, including `invoke`, that are used t
3939
docs = retriever.invoke(query)
4040
```
4141

42-
Retrievers return a list of [Document](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html) objects, which have two attributes:
42+
Retrievers return a list of [Document](https://python.langchain.com/api_reference/core/documents/langchain_core.documents.base.Document.html) objects, which have two attributes:
4343

4444
* `page_content`: The content of this document. Currently is a string.
4545
* `metadata`: Arbitrary metadata associated with this document (e.g., document id, file name, source, etc).

docs/docs/concepts/runnables.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Please see the [Configurable Runnables](#configurable-runnables) section for mor
125125

126126
LangChain will automatically try to infer the input and output types of a Runnable based on available information.
127127

128-
Currently, this inference does not work well for more complex Runnables that are built using [LCEL](/docs/concepts/lcel) composition, and the inferred input and / or output types may be incorrect. In these cases, we recommend that users override the inferred input and output types using the `with_types` method ([API Reference](https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.base.Runnable.html#langchain_core.runnables.base.Runnable.with_types
128+
Currently, this inference does not work well for more complex Runnables that are built using [LCEL](/docs/concepts/lcel) composition, and the inferred input and / or output types may be incorrect. In these cases, we recommend that users override the inferred input and output types using the `with_types` method ([API Reference](https://python.langchain.com/api_reference/core/runnables/langchain_core.runnables.base.Runnable.html#langchain_core.runnables.base.Runnable.with_types
129129
).
130130

131131
## RunnableConfig

docs/docs/concepts/vectorstores.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ vector_store = InMemoryVectorStore(embedding=SomeEmbeddingModel())
5959

6060
To add documents, use the `add_documents` method.
6161

62-
This API works with a list of [Document](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html) objects.
62+
This API works with a list of [Document](https://python.langchain.com/api_reference/core/documents/langchain_core.documents.base.Document.html) objects.
6363
`Document` objects all have `page_content` and `metadata` attributes, making them a universal way to store unstructured text and associated metadata.
6464

6565
```python
@@ -126,7 +126,7 @@ to the documentation of the specific vectorstore you are using to see what simil
126126
Given a similarity metric to measure the distance between the embedded query and any embedded document, we need an algorithm to efficiently search over *all* the embedded documents to find the most similar ones.
127127
There are various ways to do this. As an example, many vectorstores implement [HNSW (Hierarchical Navigable Small World)](https://www.pinecone.io/learn/series/faiss/hnsw/), a graph-based index structure that allows for efficient similarity search.
128128
Regardless of the search algorithm used under the hood, the LangChain vectorstore interface has a `similarity_search` method for all integrations.
129-
This will take the search query, create an embedding, find similar documents, and return them as a list of [Documents](https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html).
129+
This will take the search query, create an embedding, find similar documents, and return them as a list of [Documents](https://python.langchain.com/api_reference/core/documents/langchain_core.documents.base.Document.html).
130130

131131
```python
132132
query = "my query"

docs/docs/how_to/installation.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pip install langchain-core
5151

5252
Certain integrations like OpenAI and Anthropic have their own packages.
5353
Any integrations that require their own package will be documented as such in the [Integration docs](/docs/integrations/providers/).
54-
You can see a list of all integration packages in the [API reference](https://api.python.langchain.com) under the "Partner libs" dropdown.
54+
You can see a list of all integration packages in the [API reference](https://python.langchain.com/api_reference/) under the "Partner libs" dropdown.
5555
To install one of these run:
5656

5757
```bash

docs/docs/integrations/chat/cerebras.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"source": [
1818
"# ChatCerebras\n",
1919
"\n",
20-
"This notebook provides a quick overview for getting started with Cerebras [chat models](/docs/concepts/chat_models). For detailed documentation of all ChatCerebras features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/langchain_cerebras.chat_models.ChatCerebras.html).\n",
20+
"This notebook provides a quick overview for getting started with Cerebras [chat models](/docs/concepts/chat_models). For detailed documentation of all ChatCerebras features and configurations head to the [API reference](https://python.langchain.com/api_reference/cerebras/chat_models/langchain_cerebras.chat_models.ChatCerebras.html#).\n",
2121
"\n",
2222
"At Cerebras, we've developed the world's largest and fastest AI processor, the Wafer-Scale Engine-3 (WSE-3). The Cerebras CS-3 system, powered by the WSE-3, represents a new class of AI supercomputer that sets the standard for generative AI training and inference with unparalleled performance and scalability.\n",
2323
"\n",
@@ -37,7 +37,7 @@
3737
"\n",
3838
"| Class | Package | Local | Serializable | [JS support](https://js.langchain.com/docs/integrations/chat/cerebras) | Package downloads | Package latest |\n",
3939
"| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n",
40-
"| [ChatCerebras](https://api.python.langchain.com/en/latest/chat_models/langchain_cerebras.chat_models.ChatCerebras.html) | [langchain-cerebras](https://api.python.langchain.com/en/latest/cerebras_api_reference.html) | ❌ | beta | ❌ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-cerebras?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-cerebras?style=flat-square&label=%20) |\n",
40+
"| [ChatCerebras](https://python.langchain.com/api_reference/cerebras/chat_models/langchain_cerebras.chat_models.ChatCerebras.html#) | [langchain-cerebras](https://python.langchain.com/api_reference/cerebras/index.html) | ❌ | beta | ❌ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-cerebras?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-cerebras?style=flat-square&label=%20) |\n",
4141
"\n",
4242
"### Model features\n",
4343
"| [Tool calling](/docs/how_to/tool_calling/) | [Structured output](/docs/how_to/structured_output/) | JSON mode | [Image input](/docs/how_to/multimodal_inputs/) | Audio input | Video input | [Token-level streaming](/docs/how_to/chat_streaming/) | Native async | [Token usage](/docs/how_to/chat_token_usage_tracking/) | [Logprobs](/docs/how_to/logprobs/) |\n",
@@ -396,7 +396,7 @@
396396
"source": [
397397
"## API reference\n",
398398
"\n",
399-
"For detailed documentation of all ChatCerebras features and configurations head to the API reference: https://api.python.langchain.com/en/latest/chat_models/langchain_cerebras.chat_models.ChatCerebras.html"
399+
"For detailed documentation of all ChatCerebras features and configurations head to the API reference: https://python.langchain.com/api_reference/cerebras/chat_models/langchain_cerebras.chat_models.ChatCerebras.html#"
400400
]
401401
}
402402
],

docs/docs/integrations/chat/oci_data_science.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"source": [
2020
"# ChatOCIModelDeployment\n",
2121
"\n",
22-
"This will help you getting started with OCIModelDeployment [chat models](/docs/concepts/chat_models). For detailed documentation of all ChatOCIModelDeployment features and configurations head to the [API reference](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.ChatOCIModelDeployment.html).\n",
22+
"This will help you getting started with OCIModelDeployment [chat models](/docs/concepts/chat_models). For detailed documentation of all ChatOCIModelDeployment features and configurations head to the [API reference](https://python.langchain.com/api_reference/community/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeployment.html).\n",
2323
"\n",
2424
"[OCI Data Science](https://docs.oracle.com/en-us/iaas/data-science/using/home.htm) is a fully managed and serverless platform for data science teams to build, train, and manage machine learning models in the Oracle Cloud Infrastructure. You can use [AI Quick Actions](https://blogs.oracle.com/ai-and-datascience/post/ai-quick-actions-in-oci-data-science) to easily deploy LLMs on [OCI Data Science Model Deployment Service](https://docs.oracle.com/en-us/iaas/data-science/using/model-dep-about.htm). You may choose to deploy the model with popular inference frameworks such as vLLM or TGI. By default, the model deployment endpoint mimics the OpenAI API protocol.\n",
2525
"\n",
@@ -30,7 +30,7 @@
3030
"\n",
3131
"| Class | Package | Local | Serializable | JS support | Package downloads | Package latest |\n",
3232
"| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n",
33-
"| [ChatOCIModelDeployment](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.ChatOCIModelDeployment.html) | [langchain-community](https://api.python.langchain.com/en/latest/community_api_reference.html) | ❌ | beta | ❌ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-community?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-community?style=flat-square&label=%20) |\n",
33+
"| [ChatOCIModelDeployment](https://python.langchain.com/api_reference/community/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeployment.html) | [langchain-community](https://python.langchain.com/api_reference/community/index.html) | ❌ | beta | ❌ | ![PyPI - Downloads](https://img.shields.io/pypi/dm/langchain-community?style=flat-square&label=%20) | ![PyPI - Version](https://img.shields.io/pypi/v/langchain-community?style=flat-square&label=%20) |\n",
3434
"\n",
3535
"### Model features\n",
3636
"\n",
@@ -430,9 +430,9 @@
430430
"\n",
431431
"For comprehensive details on all features and configurations, please refer to the API reference documentation for each class:\n",
432432
"\n",
433-
"* [ChatOCIModelDeployment](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeployment.html)\n",
434-
"* [ChatOCIModelDeploymentVLLM](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeploymentVLLM.html)\n",
435-
"* [ChatOCIModelDeploymentTGI](https://api.python.langchain.com/en/latest/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeploymentTGI.html)"
433+
"* [ChatOCIModelDeployment](https://python.langchain.com/api_reference/community/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeployment.html)\n",
434+
"* [ChatOCIModelDeploymentVLLM](https://python.langchain.com/api_reference/community/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeploymentVLLM.html)\n",
435+
"* [ChatOCIModelDeploymentTGI](https://python.langchain.com/api_reference/community/chat_models/langchain_community.chat_models.oci_data_science.ChatOCIModelDeploymentTGI.html)"
436436
]
437437
}
438438
],

0 commit comments

Comments
 (0)