diff --git a/libs/core/langchain_core/messages/content.py b/libs/core/langchain_core/messages/content.py index 73af80721b4..3700167202e 100644 --- a/libs/core/langchain_core/messages/content.py +++ b/libs/core/langchain_core/messages/content.py @@ -32,7 +32,7 @@ to be included without breaking the standard structure. is subject to deprecation in future releases as we move towards PEP 728. !!! note - Following widespread adoption of `PEP 728 `__, we + Following widespread adoption of [PEP 728](https://peps.python.org/pep-0728/), we will add ``extra_items=Any`` as a param to Content Blocks. This will signify to type checkers that additional provider-specific fields are allowed outside of the ``extras`` field, and that will become the new standard approach to adding @@ -525,7 +525,7 @@ class ImageContentBlock(TypedDict): mime_type: NotRequired[str] """MIME type of the image. Required for base64. - `Examples from IANA `__ + [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#image) """ @@ -572,7 +572,7 @@ class VideoContentBlock(TypedDict): mime_type: NotRequired[str] """MIME type of the video. Required for base64. - `Examples from IANA `__ + [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#video) """ @@ -618,7 +618,7 @@ class AudioContentBlock(TypedDict): mime_type: NotRequired[str] """MIME type of the audio. Required for base64. - `Examples from IANA `__ + [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#audio) """ @@ -646,7 +646,7 @@ class PlainTextContentBlock(TypedDict): !!! note Title and context are optional fields that may be passed to the model. See - Anthropic `example `__. + Anthropic [example](https://docs.anthropic.com/en/docs/build-with-claude/citations#citable-vs-non-citable-content). !!! note ``create_plaintext_block`` may also be used as a factory to create a @@ -734,7 +734,7 @@ class FileContentBlock(TypedDict): mime_type: NotRequired[str] """MIME type of the file. Required for base64. - `Examples from IANA `__ + [Examples from IANA](https://www.iana.org/assignments/media-types/media-types.xhtml) """ diff --git a/libs/core/langchain_core/messages/utils.py b/libs/core/langchain_core/messages/utils.py index 304b12b4743..f192eba2e74 100644 --- a/libs/core/langchain_core/messages/utils.py +++ b/libs/core/langchain_core/messages/utils.py @@ -1697,11 +1697,11 @@ def count_tokens_approximately( chars_per_token: Number of characters per token to use for the approximation. Default is 4 (one token corresponds to ~4 chars for common English text). You can also specify float values for more fine-grained control. - `See more here. `__ + [See more here](https://platform.openai.com/tokenizer). extra_tokens_per_message: Number of extra tokens to add per message. Default is 3 (special tokens, including beginning/end of message). You can also specify float values for more fine-grained control. - `See more here. `__ + [See more here](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb). count_name: Whether to include message names in the count. Enabled by default. diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py index d5a1efb14b4..3666251513e 100644 --- a/libs/core/langchain_core/runnables/base.py +++ b/libs/core/langchain_core/runnables/base.py @@ -249,7 +249,7 @@ class Runnable(ABC, Generic[Input, Output]): chain.invoke(..., config={"callbacks": [ConsoleCallbackHandler()]}) ``` - For a UI (and much more) checkout `LangSmith `__. + For a UI (and much more) checkout [LangSmith](https://docs.smith.langchain.com/). """ diff --git a/libs/langchain/langchain_classic/_api/deprecation.py b/libs/langchain/langchain_classic/_api/deprecation.py index 634e21944d7..dd53c0cab03 100644 --- a/libs/langchain/langchain_classic/_api/deprecation.py +++ b/libs/langchain/langchain_classic/_api/deprecation.py @@ -13,11 +13,11 @@ AGENT_DEPRECATION_WARNING = ( "full-featured framework for building agents, including support for " "tool-calling, persistence of state, and human-in-the-loop workflows. For " "details, refer to the " - "`LangGraph documentation `_" + "[LangGraph documentation](https://langchain-ai.github.io/langgraph/)" " as well as guides for " - "`Migrating from AgentExecutor `_" + "[Migrating from AgentExecutor](https://python.langchain.com/docs/how_to/migrate_agent/)" " and LangGraph's " - "`Pre-built ReAct agent `_." + "[Pre-built ReAct agent](https://langchain-ai.github.io/langgraph/how-tos/create-react-agent/)." ) diff --git a/libs/langchain/langchain_classic/agents/react/agent.py b/libs/langchain/langchain_classic/agents/react/agent.py index 7fc2c5c58ba..3c60fca78de 100644 --- a/libs/langchain/langchain_classic/agents/react/agent.py +++ b/libs/langchain/langchain_classic/agents/react/agent.py @@ -33,7 +33,7 @@ def create_react_agent( For a more robust and feature-rich implementation, we recommend using the `create_react_agent` function from the LangGraph library. See the - `reference doc `__ + [reference doc](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.chat_agent_executor.create_react_agent) for more information. Args: diff --git a/libs/langchain/langchain_classic/chat_models/base.py b/libs/langchain/langchain_classic/chat_models/base.py index d6e031437af..e2dd7ecd9b8 100644 --- a/libs/langchain/langchain_classic/chat_models/base.py +++ b/libs/langchain/langchain_classic/chat_models/base.py @@ -80,7 +80,7 @@ def init_chat_model( !!! note Must have the integration package corresponding to the model provider installed. - You should look at the `provider integration's API reference `__ + You should look at the [provider integration's API reference](https://docs.langchain.com/oss/python/integrations/providers) to see what parameters are supported by the model. Args: diff --git a/libs/langchain/langchain_classic/evaluation/loading.py b/libs/langchain/langchain_classic/evaluation/loading.py index 2ca00803b53..7a47a1914a1 100644 --- a/libs/langchain/langchain_classic/evaluation/loading.py +++ b/libs/langchain/langchain_classic/evaluation/loading.py @@ -50,7 +50,7 @@ from langchain_classic.evaluation.string_distance.base import ( def load_dataset(uri: str) -> list[dict]: - """Load a dataset from the `LangChainDatasets on HuggingFace `_. + """Load a dataset from the [LangChainDatasets on HuggingFace](https://huggingface.co/LangChainDatasets). Args: uri: The uri of the dataset to load. diff --git a/libs/langchain/langchain_classic/hub.py b/libs/langchain/langchain_classic/hub.py index be61be67df4..7abc310ab45 100644 --- a/libs/langchain/langchain_classic/hub.py +++ b/libs/langchain/langchain_classic/hub.py @@ -1,4 +1,4 @@ -"""Interface with the `LangChain Hub `__.""" +"""Interface with the [LangChain Hub](https://smith.langchain.com/hub).""" from __future__ import annotations diff --git a/libs/langchain/langchain_classic/smith/__init__.py b/libs/langchain/langchain_classic/smith/__init__.py index 904fc9c051f..e86b8dfed3f 100644 --- a/libs/langchain/langchain_classic/smith/__init__.py +++ b/libs/langchain/langchain_classic/smith/__init__.py @@ -1,9 +1,9 @@ """**LangSmith** utilities. This module provides utilities for connecting to -`LangSmith `_. +[LangSmith](https://smith.langchain.com/). For more information on LangSmith, -see the `LangSmith documentation `_. +see the [LangSmith documentation](https://docs.smith.langchain.com/). **Evaluation** diff --git a/libs/langchain/langchain_classic/smith/evaluation/__init__.py b/libs/langchain/langchain_classic/smith/evaluation/__init__.py index 373188b11ca..468f2ddf528 100644 --- a/libs/langchain/langchain_classic/smith/evaluation/__init__.py +++ b/libs/langchain/langchain_classic/smith/evaluation/__init__.py @@ -4,7 +4,7 @@ This module provides utilities for evaluating Chains and other language model applications using LangChain evaluators and LangSmith. For more information on the LangSmith API, see the -`LangSmith API documentation `_. +[LangSmith API documentation](https://docs.smith.langchain.com/docs/). **Example** diff --git a/libs/langchain_v1/langchain/agents/middleware/prompt_caching.py b/libs/langchain_v1/langchain/agents/middleware/prompt_caching.py index af0d1c7037e..ae640a7459d 100644 --- a/libs/langchain_v1/langchain/agents/middleware/prompt_caching.py +++ b/libs/langchain_v1/langchain/agents/middleware/prompt_caching.py @@ -15,7 +15,7 @@ class AnthropicPromptCachingMiddleware(AgentMiddleware): Optimizes API usage by caching conversation prefixes for Anthropic models. Learn more about Anthropic prompt caching - `here `__. + [here](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching). """ def __init__( diff --git a/libs/partners/anthropic/langchain_anthropic/chat_models.py b/libs/partners/anthropic/langchain_anthropic/chat_models.py index 62d29ac1cc7..6f69327df38 100644 --- a/libs/partners/anthropic/langchain_anthropic/chat_models.py +++ b/libs/partners/anthropic/langchain_anthropic/chat_models.py @@ -565,7 +565,7 @@ def _handle_anthropic_bad_request(e: anthropic.BadRequestError) -> None: class ChatAnthropic(BaseChatModel): """Anthropic chat models. - See `Anthropic's docs `__ for a + See [Anthropic's docs](https://docs.anthropic.com/en/docs/about-claude/models/overview) for a list of the latest models. Setup: @@ -805,7 +805,7 @@ class ChatAnthropic(BaseChatModel): See ``ChatAnthropic.with_structured_output()`` for more. Image input: - See `multimodal guides `__ + See [multimodal guides](https://python.langchain.com/docs/how_to/multimodal_inputs/) for more detail. .. code-block:: python @@ -847,7 +847,7 @@ class ChatAnthropic(BaseChatModel): ??? note "Files API" You can also pass in files that are managed through Anthropic's - `Files API `__: + [Files API](https://docs.anthropic.com/en/docs/build-with-claude/files): .. code-block:: python @@ -873,7 +873,7 @@ class ChatAnthropic(BaseChatModel): llm.invoke([input_message]) PDF input: - See `multimodal guides `__ + See [multimodal guides](https://python.langchain.com/docs/how_to/multimodal_inputs/) for more detail. .. code-block:: python @@ -910,7 +910,7 @@ class ChatAnthropic(BaseChatModel): ??? note "Files API" You can also pass in files that are managed through Anthropic's - `Files API `__: + [Files API](https://docs.anthropic.com/en/docs/build-with-claude/files): .. code-block:: python @@ -937,7 +937,7 @@ class ChatAnthropic(BaseChatModel): Extended thinking: Claude 3.7 Sonnet supports an - `extended thinking `__ + [extended thinking](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking) feature, which will output the step-by-step reasoning process that led to its final answer. @@ -972,10 +972,10 @@ class ChatAnthropic(BaseChatModel): Citations: Anthropic supports a - `citations `__ + [citations](https://docs.anthropic.com/en/docs/build-with-claude/citations) feature that lets Claude attach context to its answers based on source documents supplied by the user. When - `document content blocks `__ + [document content blocks](https://docs.anthropic.com/en/docs/build-with-claude/citations#document-types) with ``"citations": {"enabled": True}`` are included in a query, Claude may generate citations in its response. @@ -1077,7 +1077,7 @@ class ChatAnthropic(BaseChatModel): !!! note Only certain models support prompt caching. - See the `Claude documentation `__ + See the [Claude documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#supported-models) for a full list. .. code-block:: python @@ -1174,7 +1174,7 @@ class ChatAnthropic(BaseChatModel): }, } - See `Claude documentation `__ + See [Claude documentation](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching#1-hour-cache-duration-beta) for detail. Extended context windows (beta): @@ -1208,12 +1208,12 @@ class ChatAnthropic(BaseChatModel): response = llm.invoke(messages) - See `Claude documentation `__ + See [Claude documentation](https://docs.anthropic.com/en/docs/build-with-claude/context-windows#1m-token-context-window) for detail. Token-efficient tool use (beta): - See LangChain `docs `__ + See LangChain [docs](https://python.langchain.com/docs/integrations/chat/anthropic/) for more detail. .. code-block:: python @@ -1253,7 +1253,7 @@ class ChatAnthropic(BaseChatModel): Anthropic supports a context editing feature that will automatically manage the model's context window (e.g., by clearing tool results). - See `Anthropic documentation `__ + See [Anthropic documentation](https://docs.claude.com/en/docs/build-with-claude/context-editing) for details and configuration options. .. code-block:: python @@ -1269,7 +1269,7 @@ class ChatAnthropic(BaseChatModel): response = llm_with_tools.invoke("Search for recent developments in AI") Built-in tools: - See LangChain `docs `__ + See LangChain [docs](https://python.langchain.com/docs/integrations/chat/anthropic/#built-in-tools) for more detail. ??? note "Web search" @@ -1503,7 +1503,7 @@ class ChatAnthropic(BaseChatModel): context_management: dict[str, Any] | None = None """Configuration for - `context management `__. + [context management](https://docs.claude.com/en/docs/build-with-claude/context-editing). """ @property @@ -2397,7 +2397,7 @@ class ChatAnthropic(BaseChatModel): 403 !!! warning "Behavior changed in 0.3.0" - Uses Anthropic's `token counting API `__ to count tokens in messages. + Uses Anthropic's [token counting API](https://docs.anthropic.com/en/docs/build-with-claude/token-counting) to count tokens in messages. """ # noqa: D214,E501 formatted_system, formatted_messages = _format_messages(messages) diff --git a/libs/partners/deepseek/langchain_deepseek/chat_models.py b/libs/partners/deepseek/langchain_deepseek/chat_models.py index e4d1fb8cd97..1215b246d18 100644 --- a/libs/partners/deepseek/langchain_deepseek/chat_models.py +++ b/libs/partners/deepseek/langchain_deepseek/chat_models.py @@ -395,9 +395,9 @@ class ChatDeepSeek(BaseChatOpenAI): method: The method for steering model generation, one of: - ``'function_calling'``: - Uses DeepSeek's `tool-calling features `_. + Uses DeepSeek's [tool-calling features](https://api-docs.deepseek.com/guides/function_calling). - ``'json_mode'``: - Uses DeepSeek's `JSON mode feature `_. + Uses DeepSeek's [JSON mode feature](https://api-docs.deepseek.com/guides/json_mode). !!! warning "Behavior changed in 0.1.3" Added support for ``'json_mode'``. diff --git a/libs/partners/fireworks/langchain_fireworks/chat_models.py b/libs/partners/fireworks/langchain_fireworks/chat_models.py index a4636641d5c..13842070d0e 100644 --- a/libs/partners/fireworks/langchain_fireworks/chat_models.py +++ b/libs/partners/fireworks/langchain_fireworks/chat_models.py @@ -693,11 +693,11 @@ class ChatFireworks(BaseChatModel): method: The method for steering model generation, one of: - ``'function_calling'``: - Uses Fireworks's `tool-calling features `_. + Uses Fireworks's [tool-calling features](https://docs.fireworks.ai/guides/function-calling). - ``'json_schema'``: - Uses Fireworks's `structured output feature `_. + Uses Fireworks's [structured output feature](https://docs.fireworks.ai/structured-responses/structured-response-formatting). - ``'json_mode'``: - Uses Fireworks's `JSON mode feature `_. + Uses Fireworks's [JSON mode feature](https://docs.fireworks.ai/structured-responses/structured-response-formatting). !!! warning "Behavior changed in 0.2.8" Added support for ``'json_schema'``. diff --git a/libs/partners/fireworks/langchain_fireworks/llms.py b/libs/partners/fireworks/langchain_fireworks/llms.py index 7b245ce5e58..2d52a92edb6 100644 --- a/libs/partners/fireworks/langchain_fireworks/llms.py +++ b/libs/partners/fireworks/langchain_fireworks/llms.py @@ -24,11 +24,11 @@ logger = logging.getLogger(__name__) class Fireworks(LLM): """LLM models from `Fireworks`. - To use, you'll need an `API key `__. This can be passed in as + To use, you'll need an [API key](https://fireworks.ai). This can be passed in as init param ``fireworks_api_key`` or set as environment variable ``FIREWORKS_API_KEY``. - `Fireworks AI API reference `__ + [Fireworks AI API reference](https://readme.fireworks.ai/) Example: @@ -55,7 +55,7 @@ class Fireworks(LLM): Automatically read from env variable ``FIREWORKS_API_KEY`` if not provided. """ model: str - """Model name. `(Available models) `__""" + """Model name. [(Available models)](https://readme.fireworks.ai/)""" temperature: float | None = None """Model temperature.""" top_p: float | None = None diff --git a/libs/partners/groq/langchain_groq/chat_models.py b/libs/partners/groq/langchain_groq/chat_models.py index 0b06c4d4006..5ccaf22f13b 100644 --- a/libs/partners/groq/langchain_groq/chat_models.py +++ b/libs/partners/groq/langchain_groq/chat_models.py @@ -98,9 +98,8 @@ class ChatGroq(BaseChatModel): supresses reasoning content in the response; the model will still perform reasoning unless overridden in ``reasoning_effort``. - See the `Groq documentation - `__ for more - details and a list of supported models. + See the [Groq documentation](https://console.groq.com/docs/reasoning#reasoning) + for more details and a list of supported models. model_kwargs: Dict[str, Any] Holds any model parameters valid for create call not explicitly specified. @@ -322,16 +321,16 @@ class ChatGroq(BaseChatModel): reasoning content in the response; the model will still perform reasoning unless overridden in ``reasoning_effort``. - See the `Groq documentation `__ + See the [Groq documentation](https://console.groq.com/docs/reasoning#reasoning) for more details and a list of supported models. """ reasoning_effort: str | None = Field(default=None) """The level of effort the model will put into reasoning. Groq will default to enabling reasoning if left undefined. - See the `Groq documentation - `__ for more - details and a list of options and models that support setting a reasoning effort. + See the [Groq documentation](https://console.groq.com/docs/reasoning#options-for-reasoning-effort) + for more details and a list of options and models that support setting a reasoning + effort. """ model_kwargs: dict[str, Any] = Field(default_factory=dict) """Holds any model parameters valid for `create` call not explicitly specified.""" @@ -370,9 +369,8 @@ class ChatGroq(BaseChatModel): - `'auto'`: Uses on-demand rate limits, then falls back to ``'flex'`` if those limits are exceeded - See the `Groq documentation - `__ for more details and a list of - service tiers and descriptions. + See the [Groq documentation](https://console.groq.com/docs/flex-processing) for more + details and a list of service tiers and descriptions. """ default_headers: Mapping[str, str] | None = None default_query: Mapping[str, object] | None = None @@ -851,20 +849,20 @@ class ChatGroq(BaseChatModel): method: The method for steering model generation, one of: - ``'function_calling'``: - Uses Groq's tool-calling `API `__ + Uses Groq's tool-calling [API](https://console.groq.com/docs/tool-use) - ``'json_schema'``: - Uses Groq's `Structured Output API `__. + Uses Groq's [Structured Output API](https://console.groq.com/docs/structured-outputs). Supported for a subset of models, including ``openai/gpt-oss``, ``moonshotai/kimi-k2-instruct-0905``, and some ``meta-llama/llama-4`` - models. See `docs `__ + models. See [docs](https://console.groq.com/docs/structured-outputs) for details. - ``'json_mode'``: - Uses Groq's `JSON mode `__. + Uses Groq's [JSON mode](https://console.groq.com/docs/structured-outputs#json-object-mode). Note that if using JSON mode then you must include instructions for formatting the output into the desired schema into the model call Learn more about the differences between the methods and which models - support which methods `here `__. + support which methods [here](https://console.groq.com/docs/structured-outputs). method: The method for steering model generation, either ``'function_calling'`` diff --git a/libs/partners/mistralai/langchain_mistralai/chat_models.py b/libs/partners/mistralai/langchain_mistralai/chat_models.py index 8b7f0c70962..d63d2fef21e 100644 --- a/libs/partners/mistralai/langchain_mistralai/chat_models.py +++ b/libs/partners/mistralai/langchain_mistralai/chat_models.py @@ -766,13 +766,13 @@ class ChatMistralAI(BaseChatModel): - ``'function_calling'``: Uses Mistral's - `function-calling feature `_. + [function-calling feature](https://docs.mistral.ai/capabilities/function_calling/). - ``'json_schema'``: Uses Mistral's - `structured output feature `_. + [structured output feature](https://docs.mistral.ai/capabilities/structured-output/custom_structured_output/). - ``'json_mode'``: Uses Mistral's - `JSON mode `_. + [JSON mode](https://docs.mistral.ai/capabilities/structured-output/json_mode/). Note that if using JSON mode then you must include instructions for formatting the output into the desired schema into the model call. diff --git a/libs/partners/ollama/langchain_ollama/__init__.py b/libs/partners/ollama/langchain_ollama/__init__.py index d0ae3d03e96..8382ffce694 100644 --- a/libs/partners/ollama/langchain_ollama/__init__.py +++ b/libs/partners/ollama/langchain_ollama/__init__.py @@ -1,6 +1,6 @@ """This is the langchain_ollama package. -Provides infrastructure for interacting with the `Ollama `__ +Provides infrastructure for interacting with the [Ollama](https://ollama.com/) service. !!! note diff --git a/libs/partners/ollama/langchain_ollama/chat_models.py b/libs/partners/ollama/langchain_ollama/chat_models.py index a8618bb82b2..ce236f2552a 100644 --- a/libs/partners/ollama/langchain_ollama/chat_models.py +++ b/libs/partners/ollama/langchain_ollama/chat_models.py @@ -271,7 +271,7 @@ class ChatOllama(BaseChatModel): Name of Ollama model to use. reasoning: bool | None Controls the reasoning/thinking mode for - `supported models `__. + [supported models](https://ollama.com/search?c=thinking). - `True`: Enables reasoning mode. The model's reasoning process will be captured and returned separately in the ``additional_kwargs`` of the @@ -492,7 +492,7 @@ class ChatOllama(BaseChatModel): as think tags (```` and ````). !!! note - This feature is only available for `models that support reasoning `__. + This feature is only available for [models that support reasoning](https://ollama.com/search?c=thinking). .. code-block:: python @@ -524,7 +524,7 @@ class ChatOllama(BaseChatModel): """Model name to use.""" reasoning: bool | str | None = None - """Controls the reasoning/thinking mode for `supported models `__. + """Controls the reasoning/thinking mode for [supported models](https://ollama.com/search?c=thinking). - `True`: Enables reasoning mode. The model's reasoning process will be captured and returned separately in the ``additional_kwargs`` of the @@ -538,7 +538,7 @@ class ChatOllama(BaseChatModel): unless you set ``reasoning`` to `True`. - `str`: e.g. `'low'`, ``'medium'``, `'high'`. Enables reasoning with a custom intensity level. Currently, this is only supported ``gpt-oss``. See the - `Ollama docs `__ + [Ollama docs](https://github.com/ollama/ollama-python/blob/da79e987f0ac0a4986bf396f043b36ef840370bc/ollama/_types.py#L210) for more information. """ @@ -699,7 +699,7 @@ class ChatOllama(BaseChatModel): These are clients unique to the async client; for shared args use `client_kwargs`. - For a full list of the params, see the `httpx documentation `__. + For a full list of the params, see the [httpx documentation](https://www.python-httpx.org/api/#asyncclient). """ sync_client_kwargs: dict | None = {} @@ -707,7 +707,7 @@ class ChatOllama(BaseChatModel): These are clients unique to the sync client; for shared args use `client_kwargs`. - For a full list of the params, see the `httpx documentation `__. + For a full list of the params, see the [httpx documentation](https://www.python-httpx.org/api/#client). """ _client: Client = PrivateAttr() @@ -1275,7 +1275,7 @@ class ChatOllama(BaseChatModel): method: The method for steering model generation, one of: - ``'json_schema'``: - Uses Ollama's `structured output API `__ + Uses Ollama's [structured output API](https://ollama.com/blog/structured-outputs) - ``'function_calling'``: Uses Ollama's tool-calling API - ``'json_mode'``: diff --git a/libs/partners/ollama/langchain_ollama/embeddings.py b/libs/partners/ollama/langchain_ollama/embeddings.py index 96c84b04b8a..103690efa5e 100644 --- a/libs/partners/ollama/langchain_ollama/embeddings.py +++ b/libs/partners/ollama/langchain_ollama/embeddings.py @@ -16,12 +16,12 @@ class OllamaEmbeddings(BaseModel, Embeddings): """Ollama embedding model integration. Set up a local Ollama instance: - `Install the Ollama package `__ and set up a + [Install the Ollama package](https://github.com/ollama/ollama) and set up a local Ollama instance. You will need to choose a model to serve. - You can view a list of available models via `the model library `__. + You can view a list of available models via [the model library](https://ollama.com/library). To fetch a model from the Ollama model library use ``ollama pull ``. @@ -164,7 +164,7 @@ class OllamaEmbeddings(BaseModel, Embeddings): These are clients unique to the async client; for shared args use `client_kwargs`. - For a full list of the params, see the `httpx documentation `__. + For a full list of the params, see the [httpx documentation](https://www.python-httpx.org/api/#asyncclient). """ sync_client_kwargs: dict | None = {} @@ -172,7 +172,7 @@ class OllamaEmbeddings(BaseModel, Embeddings): These are clients unique to the sync client; for shared args use `client_kwargs`. - For a full list of the params, see the `httpx documentation `__. + For a full list of the params, see the [httpx documentation](https://www.python-httpx.org/api/#client). """ _client: Client | None = PrivateAttr(default=None) diff --git a/libs/partners/ollama/langchain_ollama/llms.py b/libs/partners/ollama/langchain_ollama/llms.py index e59d9fda1bd..79bb35b80d7 100644 --- a/libs/partners/ollama/langchain_ollama/llms.py +++ b/libs/partners/ollama/langchain_ollama/llms.py @@ -114,7 +114,7 @@ class OllamaLLM(BaseLLM): reasoning: bool | None = None """Controls the reasoning/thinking mode for - `supported models `__. + [supported models](https://ollama.com/search?c=thinking). - `True`: Enables reasoning mode. The model's reasoning process will be captured and returned separately in the ``additional_kwargs`` of the @@ -243,7 +243,7 @@ class OllamaLLM(BaseLLM): These are clients unique to the async client; for shared args use `client_kwargs`. - For a full list of the params, see the `httpx documentation `__. + For a full list of the params, see the [httpx documentation](https://www.python-httpx.org/api/#asyncclient). """ sync_client_kwargs: dict | None = {} @@ -251,7 +251,7 @@ class OllamaLLM(BaseLLM): These are clients unique to the sync client; for shared args use `client_kwargs`. - For a full list of the params, see the `httpx documentation `__. + For a full list of the params, see the [httpx documentation](https://www.python-httpx.org/api/#client). """ _client: Client | None = PrivateAttr(default=None) diff --git a/libs/partners/openai/langchain_openai/chat_models/azure.py b/libs/partners/openai/langchain_openai/chat_models/azure.py index 467d2caac7d..f2c411efe9b 100644 --- a/libs/partners/openai/langchain_openai/chat_models/azure.py +++ b/libs/partners/openai/langchain_openai/chat_models/azure.py @@ -35,7 +35,7 @@ class AzureChatOpenAI(BaseChatOpenAI): r"""Azure OpenAI chat model integration. Setup: - Head to the Azure `OpenAI quickstart guide `__ + Head to the Azure [OpenAI quickstart guide](https://learn.microsoft.com/en-us/azure/ai-foundry/openai/chatgpt-quickstart?tabs=keyless%2Ctypescript-keyless%2Cpython-new%2Ccommand-line&pivots=programming-language-python) to create your Azure OpenAI deployment. Then install `langchain-openai` and set environment variables @@ -61,7 +61,7 @@ class AzureChatOpenAI(BaseChatOpenAI): Key init args — client params: api_version: str Azure OpenAI REST API version to use (distinct from the version of the - underlying model). `See more on the different versions. `__ + underlying model). [See more on the different versions.](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning) timeout: Union[float, Tuple[float, float], Any, None] Timeout for requests. max_retries: int | None @@ -501,7 +501,7 @@ class AzureChatOpenAI(BaseChatOpenAI): Automatically inferred from env var ``AZURE_OPENAI_AD_TOKEN`` if not provided. - For more, see `this page `__. + For more, see [this page](https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id). """ azure_ad_token_provider: Callable[[], str] | None = None """A function that returns an Azure Active Directory token. @@ -852,19 +852,19 @@ class AzureChatOpenAI(BaseChatOpenAI): method: The method for steering model generation, one of: - ``'json_schema'``: - Uses OpenAI's `Structured Output API `__. + Uses OpenAI's [Structured Output API](https://platform.openai.com/docs/guides/structured-outputs). Supported for ``'gpt-4o-mini'``, ``'gpt-4o-2024-08-06'``, ``'o1'``, and later models. - ``'function_calling'``: Uses OpenAI's tool-calling (formerly called function calling) - `API `__ + [API](https://platform.openai.com/docs/guides/function-calling) - ``'json_mode'``: - Uses OpenAI's `JSON mode `__. + Uses OpenAI's [JSON mode](https://platform.openai.com/docs/guides/structured-outputs/json-mode). Note that if using JSON mode then you must include instructions for formatting the output into the desired schema into the model call Learn more about the differences between the methods and which models - support which methods `here `__. + support which methods [here](https://platform.openai.com/docs/guides/structured-outputs/function-calling-vs-response-format). include_raw: If `False` then only the parsed structured output is returned. If @@ -877,7 +877,7 @@ class AzureChatOpenAI(BaseChatOpenAI): - True: Model output is guaranteed to exactly match the schema. - The input schema will also be validated according to the `supported schemas `__. + The input schema will also be validated according to the [supported schemas](https://platform.openai.com/docs/guides/structured-outputs/supported-schemas?api-mode=responses#supported-schemas). - False: Input schema will not be validated and model output will not be validated. @@ -972,7 +972,7 @@ class AzureChatOpenAI(BaseChatOpenAI): specify any Field metadata (like min/max constraints) and fields cannot have default values. - See all constraints `here `__. + See all constraints [here](https://platform.openai.com/docs/guides/structured-outputs/supported-schemas). .. code-block:: python diff --git a/libs/partners/openai/langchain_openai/embeddings/azure.py b/libs/partners/openai/langchain_openai/embeddings/azure.py index e0a9cfc3a69..f97bb0be18a 100644 --- a/libs/partners/openai/langchain_openai/embeddings/azure.py +++ b/libs/partners/openai/langchain_openai/embeddings/azure.py @@ -146,7 +146,7 @@ class AzureOpenAIEmbeddings(OpenAIEmbeddings): # type: ignore[override] Automatically inferred from env var ``AZURE_OPENAI_AD_TOKEN`` if not provided. - `For more, see this page. `__ + [For more, see this page.](https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id) """ azure_ad_token_provider: Callable[[], str] | None = None """A function that returns an Azure Active Directory token. diff --git a/libs/partners/perplexity/langchain_perplexity/chat_models.py b/libs/partners/perplexity/langchain_perplexity/chat_models.py index 541eedf6380..81ca00929ec 100644 --- a/libs/partners/perplexity/langchain_perplexity/chat_models.py +++ b/libs/partners/perplexity/langchain_perplexity/chat_models.py @@ -405,7 +405,7 @@ class ChatPerplexity(BaseChatModel): ) -> Runnable[LanguageModelInput, _DictOrPydantic]: """Model wrapper that returns outputs formatted to match the given schema for Preplexity. Currently, Perplexity only supports "json_schema" method for structured output - as per their `official documentation `__. + as per their [official documentation](https://docs.perplexity.ai/guides/structured-outputs). Args: schema: The output schema. Can be passed in as: diff --git a/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py b/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py index 234de095ecf..fc6e72a8452 100644 --- a/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py +++ b/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py @@ -23,9 +23,9 @@ class FastEmbedSparse(SparseEmbeddings): ) -> None: """Sparse encoder implementation using FastEmbed. - Uses `FastEmbed `__ for sparse text + Uses [FastEmbed](https://qdrant.github.io/fastembed/) for sparse text embeddings. - For a list of available models, see `the Qdrant docs `__. + For a list of available models, see [the Qdrant docs](https://qdrant.github.io/fastembed/examples/Supported_Models/). Args: model_name (str): The name of the model to use. Defaults to `"Qdrant/bm25"`. diff --git a/libs/partners/xai/langchain_xai/chat_models.py b/libs/partners/xai/langchain_xai/chat_models.py index d301df5f37a..1e63af25166 100644 --- a/libs/partners/xai/langchain_xai/chat_models.py +++ b/libs/partners/xai/langchain_xai/chat_models.py @@ -26,7 +26,7 @@ _DictOrPydantic: TypeAlias = dict | BaseModel class ChatXAI(BaseChatOpenAI): # type: ignore[override] r"""ChatXAI chat model. - Refer to `xAI's documentation `__ + Refer to [xAI's documentation](https://docs.x.ai/docs/api-reference#chat-completions) for more nuanced details on the API's behavior and supported parameters. Setup: @@ -46,7 +46,7 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] while lower values (like `0.2`) mean more focused and deterministic completions. (Default: `1`.) max_tokens: int | None - Max number of tokens to generate. Refer to your `model's documentation `__ + Max number of tokens to generate. Refer to your [model's documentation](https://docs.x.ai/docs/models#model-pricing) for the maximum number of tokens it can generate. logprobs: bool | None Whether to return logprobs. @@ -163,7 +163,7 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] ) Reasoning: - `Certain xAI models `__ support reasoning, + [Certain xAI models](https://docs.x.ai/docs/models#model-pricing) support reasoning, which allows the model to provide reasoning content along with the response. If provided, reasoning content is returned under the ``additional_kwargs`` field of the @@ -182,10 +182,10 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] !!! note As of 2025-07-10, ``reasoning_content`` is only returned in Grok 3 models, such as - `Grok 3 Mini `__. + [Grok 3 Mini](https://docs.x.ai/docs/models/grok-3-mini). !!! note - Note that in `Grok 4 `__, as of 2025-07-10, + Note that in [Grok 4](https://docs.x.ai/docs/models/grok-4-0709), as of 2025-07-10, reasoning is not exposed in ``reasoning_content`` (other than initial ``'Thinking...'`` text), reasoning cannot be disabled, and the ``reasoning_effort`` cannot be specified. @@ -323,7 +323,7 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] ) Live Search: - xAI supports a `Live Search `__ + xAI supports a [Live Search](https://docs.x.ai/docs/guides/live-search) feature that enables Grok to ground its answers using results from web searches. .. code-block:: python @@ -344,8 +344,8 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] llm.invoke("Provide me a digest of world news in the last 24 hours.") !!! note - `Citations `__ - are only available in `Grok 3 `__. + [Citations](https://docs.x.ai/docs/guides/live-search#returning-citations) + are only available in [Grok 3](https://docs.x.ai/docs/models/grok-3). Token usage: .. code-block:: python @@ -604,9 +604,9 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] method: The method for steering model generation, one of: - ``'function_calling'``: - Uses xAI's `tool-calling features `__. + Uses xAI's [tool-calling features](https://docs.x.ai/docs/guides/function-calling). - ``'json_schema'``: - Uses xAI's `structured output feature `__. + Uses xAI's [structured output feature](https://docs.x.ai/docs/guides/structured-outputs). - ``'json_mode'``: Uses xAI's JSON mode feature. @@ -621,7 +621,7 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] strict: - `True`: Model output is guaranteed to exactly match the schema. - The input schema will also be validated according to the `supported schemas `__. + The input schema will also be validated according to the [supported schemas](https://platform.openai.com/docs/guides/structured-outputs/supported-schemas?api-mode=responses#supported-schemas). - `False`: Input schema will not be validated and model output will not be validated. diff --git a/libs/standard-tests/langchain_tests/__init__.py b/libs/standard-tests/langchain_tests/__init__.py index b03553e9cd7..d2b756dde09 100644 --- a/libs/standard-tests/langchain_tests/__init__.py +++ b/libs/standard-tests/langchain_tests/__init__.py @@ -1,6 +1,6 @@ """Base Test classes for standard testing. To learn how to use these classes, see the -`integration standard testing `__ +[integration standard testing](https://python.langchain.com/docs/contributing/how_to/integrations/standard_tests/) guide. """ 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 8649a2bd0e7..acdd1672d35 100644 --- a/libs/standard-tests/langchain_tests/integration_tests/chat_models.py +++ b/libs/standard-tests/langchain_tests/integration_tests/chat_models.py @@ -563,7 +563,7 @@ class ChatModelIntegrationTests(ChatModelTests): ??? note "`enable_vcr_tests`" Property controlling whether to enable select tests that rely on - `VCR `_ caching of HTTP calls, such + [VCR](https://vcrpy.readthedocs.io/en/latest/) caching of HTTP calls, such as benchmarking tests. To enable these tests, follow these steps: @@ -2287,7 +2287,7 @@ class ChatModelIntegrationTests(ChatModelTests): assert isinstance(result, dict) def test_json_mode(self, model: BaseChatModel) -> None: - """Test structured output via `JSON mode. `_. + """Test structured output via [JSON mode.](https://python.langchain.com/docs/concepts/structured_outputs/#json-mode). This test is optional and should be skipped if the model does not support the JSON mode feature (see Configuration below). diff --git a/libs/standard-tests/langchain_tests/integration_tests/tools.py b/libs/standard-tests/langchain_tests/integration_tests/tools.py index 6e2e2b69d70..b485cbe7023 100644 --- a/libs/standard-tests/langchain_tests/integration_tests/tools.py +++ b/libs/standard-tests/langchain_tests/integration_tests/tools.py @@ -14,7 +14,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 `_, + If you have followed the [custom tool guide](https://python.langchain.com/docs/how_to/custom_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 2c073d8693f..339f4eab203 100644 --- a/libs/standard-tests/langchain_tests/unit_tests/chat_models.py +++ b/libs/standard-tests/langchain_tests/unit_tests/chat_models.py @@ -684,7 +684,7 @@ class ChatModelUnitTests(ChatModelTests): ??? note "`enable_vcr_tests`" Property controlling whether to enable select tests that rely on - `VCR `_ caching of HTTP calls, such + [VCR](https://vcrpy.readthedocs.io/en/latest/) caching of HTTP calls, such as benchmarking tests. To enable these tests, follow these steps: diff --git a/libs/standard-tests/langchain_tests/unit_tests/tools.py b/libs/standard-tests/langchain_tests/unit_tests/tools.py index 5f0cd36bf15..da8e9047c1e 100644 --- a/libs/standard-tests/langchain_tests/unit_tests/tools.py +++ b/libs/standard-tests/langchain_tests/unit_tests/tools.py @@ -105,7 +105,7 @@ class ToolsUnitTests(ToolsTests): If this fails, add an `args_schema` to your tool. See - `this guide `_ + [this guide](https://python.langchain.com/docs/how_to/custom_tools/#subclass-basetool) and see how `CalculatorInput` is configured in the `CustomCalculatorTool.args_schema` attribute """