Skip to content

The agent engineering platform.

fix(standard-tests): fix broken links (#34175)

Mason Daugherty062678fa18c1
diff --git a/libs/standard-tests/langchain_tests/integration_tests/chat_models.py b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py
index 43a320bb3d..b908a0ccf6 100644
--- a/libs/standard-tests/langchain_tests/integration_tests/chat_models.py
+++ b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py
@@ -281,7 +281,7 @@ class ChatModelIntegrationTests(ChatModelTests):
`with_structured_output` method is overridden. If the base implementation is
intended to be used, this method should be overridden.
- See: https://docs.langchain.com/oss/python/langchain/structured-output
+ See docs for [Structured output](https://docs.langchain.com/oss/python/langchain/structured-output).
```python
@property
@@ -307,7 +307,7 @@ class ChatModelIntegrationTests(ChatModelTests):
Boolean property indicating whether the chat model supports JSON mode in
`with_structured_output`.
- See: https://docs.langchain.com/oss/python/langchain/structured-output
+ See docs for [Structured output](https://docs.langchain.com/oss/python/langchain/structured-output).
```python
@property
@@ -341,7 +341,7 @@ class ChatModelIntegrationTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -366,7 +366,7 @@ class ChatModelIntegrationTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -391,7 +391,7 @@ class ChatModelIntegrationTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -416,7 +416,7 @@ class ChatModelIntegrationTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -452,6 +452,7 @@ class ChatModelIntegrationTests(ChatModelTests):
`usage_metadata` is an optional dict attribute on `AIMessage` objects that track
input and output tokens.
+
[See more](https://reference.langchain.com/python/langchain_core/language_models/#langchain_core.messages.ai.UsageMetadata).
```python
@@ -569,6 +570,7 @@ class ChatModelIntegrationTests(ChatModelTests):
`usage_metadata` is an optional dict attribute on `AIMessage` objects that track
input and output tokens.
+
[See more](https://reference.langchain.com/python/langchain_core/language_models/#langchain_core.messages.ai.UsageMetadata).
It includes optional keys `input_token_details` and `output_token_details`
@@ -1946,10 +1948,6 @@ class ChatModelIntegrationTests(ChatModelTests):
??? question "Troubleshooting"
- This test uses [a utility function](https://python.langchain.com/api_reference/core/utils/langchain_core.utils.function_calling.tool_example_to_messages.html).
- in `langchain_core` to generate a sequence of messages representing
- "few-shot" examples.
-
If this test fails, check that the model can correctly handle this
sequence of messages.
@@ -2013,10 +2011,10 @@ class ChatModelIntegrationTests(ChatModelTests):
If this test fails, ensure that the model's `bind_tools` method
properly handles both JSON Schema and Pydantic V2 models.
- `langchain_core` implements a [utility function](https://python.langchain.com/api_reference/core/utils/langchain_core.utils.function_calling.convert_to_openai_tool.html).
+ `langchain_core` implements a [utility function](https://reference.langchain.com/python/langchain_core/utils/?h=convert_to_op#langchain_core.utils.function_calling.convert_to_openai_tool).
that will accommodate most formats.
- See [example implementation](https://python.langchain.com/api_reference/_modules/langchain_openai/chat_models/base.html#BaseChatOpenAI.with_structured_output).
+ See [example implementation](https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai/langchain_openai/chat_models/base.py).
of `with_structured_output`.
"""
@@ -2096,10 +2094,10 @@ class ChatModelIntegrationTests(ChatModelTests):
If this test fails, ensure that the model's `bind_tools` method
properly handles both JSON Schema and Pydantic V2 models.
- `langchain_core` implements a [utility function](https://python.langchain.com/api_reference/core/utils/langchain_core.utils.function_calling.convert_to_openai_tool.html).
+ `langchain_core` implements a [utility function](https://reference.langchain.com/python/langchain_core/utils/?h=convert_to_op#langchain_core.utils.function_calling.convert_to_openai_tool).
that will accommodate most formats.
- See [example implementation](https://python.langchain.com/api_reference/_modules/langchain_openai/chat_models/base.html#BaseChatOpenAI.with_structured_output).
+ See [example implementation](https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai/langchain_openai/chat_models/base.py).
of `with_structured_output`.
"""
@@ -2178,10 +2176,10 @@ class ChatModelIntegrationTests(ChatModelTests):
If this test fails, ensure that the model's `bind_tools` method
properly handles both JSON Schema and Pydantic V1 models.
- `langchain_core` implements [a utility function](https://python.langchain.com/api_reference/core/utils/langchain_core.utils.function_calling.convert_to_openai_tool.html).
+ `langchain_core` implements a [utility function](https://reference.langchain.com/python/langchain_core/utils/?h=convert_to_op#langchain_core.utils.function_calling.convert_to_openai_tool).
that will accommodate most formats.
- See [example implementation](https://python.langchain.com/api_reference/_modules/langchain_openai/chat_models/base.html#BaseChatOpenAI.with_structured_output).
+ See [example implementation](https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai/langchain_openai/chat_models/base.py).
of `with_structured_output`.
"""
@@ -2244,10 +2242,10 @@ class ChatModelIntegrationTests(ChatModelTests):
If this test fails, ensure that the model's `bind_tools` method
properly handles Pydantic V2 models with optional parameters.
- `langchain_core` implements [a utility function](https://python.langchain.com/api_reference/core/utils/langchain_core.utils.function_calling.convert_to_openai_tool.html).
+ `langchain_core` implements a [utility function](https://reference.langchain.com/python/langchain_core/utils/?h=convert_to_op#langchain_core.utils.function_calling.convert_to_openai_tool).
that will accommodate most formats.
- See [example implementation](https://python.langchain.com/api_reference/_modules/langchain_openai/chat_models/base.html#BaseChatOpenAI.with_structured_output).
+ See [example implementation](https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai/langchain_openai/chat_models/base.py).
of `with_structured_output`.
"""
@@ -2291,7 +2289,7 @@ class ChatModelIntegrationTests(ChatModelTests):
assert isinstance(result, dict)
def test_json_mode(self, model: BaseChatModel) -> None:
- """Test structured output via [JSON mode.](https://python.langchain.com/docs/concepts/structured_outputs/#json-mode).
+ """Test [structured output]((https://docs.langchain.com/oss/python/langchain/structured-output)) via JSON mode.
This test is optional and should be skipped if the model does not support
the JSON mode feature (see configuration below).
@@ -2312,7 +2310,7 @@ class ChatModelIntegrationTests(ChatModelTests):
See example implementation of `with_structured_output` here: https://python.langchain.com/api_reference/_modules/langchain_openai/chat_models/base.html#BaseChatOpenAI.with_structured_output
- """
+ """ # noqa: E501
if not self.supports_json_mode:
pytest.skip("Test requires json mode support.")
@@ -2561,7 +2559,7 @@ class ChatModelIntegrationTests(ChatModelTests):
]
```
- See https://python.langchain.com/docs/concepts/multimodality/
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
If the property `supports_image_urls` is set to `True`, the test will also
check that we can process content blocks of the form:
diff --git a/libs/standard-tests/langchain_tests/integration_tests/tools.py b/libs/standard-tests/langchain_tests/integration_tests/tools.py
index 6e45a9b055..7635e90698 100644
--- a/libs/standard-tests/langchain_tests/integration_tests/tools.py
+++ b/libs/standard-tests/langchain_tests/integration_tests/tools.py
@@ -15,7 +15,7 @@ class ToolsIntegrationTests(ToolsTests):
If invoked with a `ToolCall`, the tool should return a valid `ToolMessage`
content.
- If you have followed the [custom tool guide](https://python.langchain.com/docs/how_to/custom_tools/),
+ If you have followed the [custom tool guide](https://docs.langchain.com/oss/python/contributing/implement-langchain#tools),
this test should always pass because `ToolCall` inputs are handled by the
`langchain_core.tools.BaseTool` class.
diff --git a/libs/standard-tests/langchain_tests/unit_tests/chat_models.py b/libs/standard-tests/langchain_tests/unit_tests/chat_models.py
index 58d09499a0..e82c3ac54a 100644
--- a/libs/standard-tests/langchain_tests/unit_tests/chat_models.py
+++ b/libs/standard-tests/langchain_tests/unit_tests/chat_models.py
@@ -346,7 +346,7 @@ class ChatModelUnitTests(ChatModelTests):
`with_structured_output` or `bind_tools` methods. If the base
implementations are intended to be used, this method should be overridden.
- See: https://docs.langchain.com/oss/python/langchain/structured-output
+ See docs for [Structured output](https://docs.langchain.com/oss/python/langchain/structured-output).
```python
@property
@@ -372,7 +372,7 @@ class ChatModelUnitTests(ChatModelTests):
Boolean property indicating whether the chat model supports JSON mode in
`with_structured_output`.
- See: https://docs.langchain.com/oss/python/langchain/structured-output
+ See docs for [Structured output](https://docs.langchain.com/oss/python/langchain/structured-output).
```python
@property
@@ -406,7 +406,7 @@ class ChatModelUnitTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -431,7 +431,7 @@ class ChatModelUnitTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -456,7 +456,7 @@ class ChatModelUnitTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -481,7 +481,7 @@ class ChatModelUnitTests(ChatModelTests):
}
```
- See https://docs.langchain.com/oss/python/langchain/models#multimodal
+ See docs for [Multimodality](https://docs.langchain.com/oss/python/langchain/models#multimodal).
```python
@property
@@ -640,6 +640,7 @@ class ChatModelUnitTests(ChatModelTests):
`usage_metadata` is an optional dict attribute on `AIMessage` objects that track
input and output tokens.
+
[See more](https://reference.langchain.com/python/langchain_core/language_models/#langchain_core.messages.ai.UsageMetadata).
It includes optional keys `input_token_details` and `output_token_details`
@@ -856,7 +857,7 @@ class ChatModelUnitTests(ChatModelTests):
1. `chat_model_params` is specified and the model can be initialized
from those params;
2. The model accommodates
- [standard parameters](https://python.langchain.com/docs/concepts/chat_models/#standard-parameters).
+ [standard parameters](https://docs.langchain.com/oss/python/langchain/models#parameters).
"""
model = self.chat_model_class(
@@ -929,10 +930,13 @@ class ChatModelUnitTests(ChatModelTests):
??? question "Troubleshooting"
If this test fails, ensure that the model's `bind_tools` method
- properly handles Pydantic V2 models. `langchain_core` implements
- a utility function that will accommodate most formats: https://python.langchain.com/api_reference/core/utils/langchain_core.utils.function_calling.convert_to_openai_tool.html
+ properly handles Pydantic V2 models.
+
+ `langchain_core` implements a [utility function](https://reference.langchain.com/python/langchain_core/utils/?h=convert_to_op#langchain_core.utils.function_calling.convert_to_openai_tool).
+ that will accommodate most formats.
- See example implementation of `bind_tools` here: https://python.langchain.com/api_reference/_modules/langchain_openai/chat_models/base.html#BaseChatOpenAI.bind_tools
+ See [example implementation](https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai/langchain_openai/chat_models/base.py).
+ of `with_structured_output`.
"""
if not self.has_tool_calling:
return
@@ -971,11 +975,13 @@ class ChatModelUnitTests(ChatModelTests):
??? question "Troubleshooting"
If this test fails, ensure that the model's `bind_tools` method
- properly handles Pydantic V2 models. `langchain_core` implements
- a utility function that will accommodate most formats: https://python.langchain.com/api_reference/core/utils/langchain_core.utils.function_calling.convert_to_openai_tool.html
+ properly handles Pydantic V2 models.
- See example implementation of `with_structured_output` here: https://python.langchain.com/api_reference/_modules/langchain_openai/chat_models/base.html#BaseChatOpenAI.with_structured_output
+ `langchain_core` implements a [utility function](https://reference.langchain.com/python/langchain_core/utils/?h=convert_to_op#langchain_core.utils.function_calling.convert_to_openai_tool).
+ that will accommodate most formats.
+ See [example implementation](https://github.com/langchain-ai/langchain/blob/master/libs/partners/openai/langchain_openai/chat_models/base.py).
+ of `with_structured_output`.
"""
if not self.has_structured_output:
return
@@ -995,7 +1001,7 @@ class ChatModelUnitTests(ChatModelTests):
??? question "Troubleshooting"
- If this test fails, check that the model accommodates [standard parameters](https://python.langchain.com/docs/concepts/chat_models/#standard-parameters).
+ If this test fails, check that the model accommodates [standard parameters](https://docs.langchain.com/oss/python/langchain/models#parameters).
Check also that the model class is named according to convention
(e.g., `ChatProviderName`).
diff --git a/libs/standard-tests/langchain_tests/unit_tests/tools.py b/libs/standard-tests/langchain_tests/unit_tests/tools.py
index aeeaf1ef76..530ed03e8c 100644
--- a/libs/standard-tests/langchain_tests/unit_tests/tools.py
+++ b/libs/standard-tests/langchain_tests/unit_tests/tools.py
@@ -104,8 +104,7 @@ class ToolsUnitTests(ToolsTests):
If this fails, add an `args_schema` to your tool.
- See
- [this guide](https://python.langchain.com/docs/how_to/custom_tools/#subclass-basetool)
+ See [this guide](https://docs.langchain.com/oss/python/contributing/implement-langchain#tools)
and see how `CalculatorInput` is configured in the
`CustomCalculatorTool.args_schema` attribute
"""