diff --git a/libs/core/langchain_core/language_models/chat_models.py b/libs/core/langchain_core/language_models/chat_models.py index c01b11b28d0..291bd833f2d 100644 --- a/libs/core/langchain_core/language_models/chat_models.py +++ b/libs/core/langchain_core/language_models/chat_models.py @@ -1517,7 +1517,7 @@ class BaseChatModel(BaseLanguageModel[AIMessage], ABC): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. @@ -1530,16 +1530,17 @@ class BaseChatModel(BaseLanguageModel[AIMessage], ABC): Returns: A Runnable that takes same inputs as a `langchain_core.language_models.chat.BaseChatModel`. - If `include_raw` is False and `schema` is a Pydantic class, Runnable outputs - an instance of `schema` (i.e., a Pydantic object). + If `include_raw` is False and `schema` is a Pydantic class, Runnable outputs + an instance of `schema` (i.e., a Pydantic object). - Otherwise, if `include_raw` is False then Runnable outputs a dict. + Otherwise, if `include_raw` is False then Runnable outputs a dict. - If `include_raw` is True, then Runnable outputs a dict with keys: + If `include_raw` is True, then Runnable outputs a dict with keys: - - `'raw'`: BaseMessage - - `'parsed'`: None if there was a parsing error, otherwise the type depends on the `schema` as described above. - - `'parsing_error'`: BaseException | None + - `'raw'`: BaseMessage + - `'parsed'`: None if there was a parsing error, otherwise the type + depends on the `schema` as described above. + - `'parsing_error'`: BaseException | None Example: Pydantic schema (include_raw=False): ```python @@ -1620,7 +1621,7 @@ class BaseChatModel(BaseLanguageModel[AIMessage], ABC): ``` !!! warning "Behavior changed in 0.2.26" - Added support for TypedDict class. + Added support for TypedDict class. """ # noqa: E501 _ = kwargs.pop("method", None) diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py index 93c7413e068..d56f663c80d 100644 --- a/libs/core/langchain_core/runnables/base.py +++ b/libs/core/langchain_core/runnables/base.py @@ -860,7 +860,7 @@ class Runnable(ABC, Generic[Input, Output]): The default implementation of batch works well for IO bound runnables. - Subclasses should override this method if they can batch more efficiently; + Subclasses must override this method if they can batch more efficiently; e.g., if the underlying `Runnable` uses an API which supports a batch mode. Args: @@ -992,7 +992,7 @@ class Runnable(ABC, Generic[Input, Output]): The default implementation of `batch` works well for IO bound runnables. - Subclasses should override this method if they can batch more efficiently; + Subclasses must override this method if they can batch more efficiently; e.g., if the underlying `Runnable` uses an API which supports a batch mode. Args: @@ -1112,7 +1112,7 @@ class Runnable(ABC, Generic[Input, Output]): ) -> Iterator[Output]: """Default implementation of `stream`, which calls `invoke`. - Subclasses should override this method if they support streaming output. + Subclasses must override this method if they support streaming output. Args: input: The input to the `Runnable`. @@ -1133,7 +1133,7 @@ class Runnable(ABC, Generic[Input, Output]): ) -> AsyncIterator[Output]: """Default implementation of `astream`, which calls `ainvoke`. - Subclasses should override this method if they support streaming output. + Subclasses must override this method if they support streaming output. Args: input: The input to the `Runnable`. @@ -1497,7 +1497,7 @@ class Runnable(ABC, Generic[Input, Output]): Default implementation of transform, which buffers input and calls `astream`. - Subclasses should override this method if they can start producing output while + Subclasses must override this method if they can start producing output while input is still being generated. Args: @@ -1542,7 +1542,7 @@ class Runnable(ABC, Generic[Input, Output]): Default implementation of atransform, which buffers input and calls `astream`. - Subclasses should override this method if they can start producing output while + Subclasses must override this method if they can start producing output while input is still being generated. Args: diff --git a/libs/core/langchain_core/runnables/config.py b/libs/core/langchain_core/runnables/config.py index a77718414c1..d2094137640 100644 --- a/libs/core/langchain_core/runnables/config.py +++ b/libs/core/langchain_core/runnables/config.py @@ -75,26 +75,26 @@ class RunnableConfig(TypedDict, total=False): max_concurrency: int | None """ Maximum number of parallel calls to make. If not provided, defaults to - ThreadPoolExecutor's default. + `ThreadPoolExecutor`'s default. """ recursion_limit: int """ - Maximum number of times a call can recurse. If not provided, defaults to 25. + Maximum number of times a call can recurse. If not provided, defaults to `25`. """ configurable: dict[str, Any] """ - Runtime values for attributes previously made configurable on this Runnable, - or sub-Runnables, through .configurable_fields() or .configurable_alternatives(). - Check .output_schema() for a description of the attributes that have been made + Runtime values for attributes previously made configurable on this `Runnable`, + or sub-Runnables, through `configurable_fields` or `configurable_alternatives`. + Check `output_schema` for a description of the attributes that have been made configurable. """ run_id: uuid.UUID | None """ Unique identifier for the tracer run for this call. If not provided, a new UUID - will be generated. + will be generated. """ diff --git a/libs/partners/anthropic/langchain_anthropic/chat_models.py b/libs/partners/anthropic/langchain_anthropic/chat_models.py index 75be16b2159..a57c2499e1e 100644 --- a/libs/partners/anthropic/langchain_anthropic/chat_models.py +++ b/libs/partners/anthropic/langchain_anthropic/chat_models.py @@ -2197,7 +2197,7 @@ class ChatAnthropic(BaseChatModel): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `raw`, `parsed`, and `parsing_error`. @@ -2293,10 +2293,6 @@ class ChatAnthropic(BaseChatModel): # 'justification': 'Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume and density of the two substances differ.' # } ``` - - !!! warning "Behavior changed in 0.1.22" - Added support for TypedDict class as `schema`. - """ # noqa: E501 formatted_tool = convert_to_anthropic_tool(schema) tool_name = formatted_tool["name"] diff --git a/libs/partners/deepseek/langchain_deepseek/chat_models.py b/libs/partners/deepseek/langchain_deepseek/chat_models.py index bc185d366fc..ea692a1ce54 100644 --- a/libs/partners/deepseek/langchain_deepseek/chat_models.py +++ b/libs/partners/deepseek/langchain_deepseek/chat_models.py @@ -395,13 +395,10 @@ class ChatDeepSeek(BaseChatOpenAI): - `'json_mode'`: 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'`. - include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. diff --git a/libs/partners/fireworks/langchain_fireworks/chat_models.py b/libs/partners/fireworks/langchain_fireworks/chat_models.py index 0af3bc4feb5..df4c3420732 100644 --- a/libs/partners/fireworks/langchain_fireworks/chat_models.py +++ b/libs/partners/fireworks/langchain_fireworks/chat_models.py @@ -693,9 +693,6 @@ class ChatFireworks(BaseChatModel): for more on how to properly specify types and descriptions of schema fields when specifying a Pydantic or `TypedDict` class. - !!! warning "Behavior changed in 0.1.7" - Added support for TypedDict class. - method: The method for steering model generation, one of: - `'function_calling'`: @@ -711,7 +708,7 @@ class ChatFireworks(BaseChatModel): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. diff --git a/libs/partners/groq/langchain_groq/chat_models.py b/libs/partners/groq/langchain_groq/chat_models.py index 29ba2184ef0..30889468f51 100644 --- a/libs/partners/groq/langchain_groq/chat_models.py +++ b/libs/partners/groq/langchain_groq/chat_models.py @@ -838,9 +838,6 @@ class ChatGroq(BaseChatModel): for more on how to properly specify types and descriptions of schema fields when specifying a Pydantic or `TypedDict` class. - !!! warning "Behavior changed in 0.1.9" - Added support for TypedDict class. - !!! warning "Behavior changed in 0.3.8" Added support for Groq's dedicated structured output feature via `method="json_schema"`. @@ -880,7 +877,7 @@ class ChatGroq(BaseChatModel): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. diff --git a/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py b/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py index fe9f2111855..967c2a6a61a 100644 --- a/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py +++ b/libs/partners/huggingface/langchain_huggingface/chat_models/huggingface.py @@ -896,7 +896,7 @@ class ChatHuggingFace(BaseChatModel): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. diff --git a/libs/partners/mistralai/langchain_mistralai/chat_models.py b/libs/partners/mistralai/langchain_mistralai/chat_models.py index f31f96c2427..9c56f300a09 100644 --- a/libs/partners/mistralai/langchain_mistralai/chat_models.py +++ b/libs/partners/mistralai/langchain_mistralai/chat_models.py @@ -817,9 +817,6 @@ class ChatMistralAI(BaseChatModel): for more on how to properly specify types and descriptions of schema fields when specifying a Pydantic or `TypedDict` class. - !!! warning "Behavior changed in 0.1.12" - Added support for TypedDict class. - method: The method for steering model generation, one of: - `'function_calling'`: @@ -841,7 +838,7 @@ class ChatMistralAI(BaseChatModel): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. diff --git a/libs/partners/openai/langchain_openai/chat_models/azure.py b/libs/partners/openai/langchain_openai/chat_models/azure.py index 60d663a06b3..98e99ab09f7 100644 --- a/libs/partners/openai/langchain_openai/chat_models/azure.py +++ b/libs/partners/openai/langchain_openai/chat_models/azure.py @@ -865,7 +865,7 @@ class AzureChatOpenAI(BaseChatOpenAI): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. @@ -945,13 +945,6 @@ class AzureChatOpenAI(BaseChatOpenAI): - `'parsed'`: None if there was a parsing error, otherwise the type depends on the `schema` as described above. - `'parsing_error'`: BaseException | None - !!! warning "Behavior changed in 0.1.20" - Added support for TypedDict class `schema`. - - !!! warning "Behavior changed in 0.1.21" - Support for `strict` argument added. - Support for `method="json_schema"` added. - !!! warning "Behavior changed in 0.3.0" `method` default changed from "function_calling" to "json_schema". diff --git a/libs/partners/openai/langchain_openai/chat_models/base.py b/libs/partners/openai/langchain_openai/chat_models/base.py index 9e225788403..9be2f7c1a2c 100644 --- a/libs/partners/openai/langchain_openai/chat_models/base.py +++ b/libs/partners/openai/langchain_openai/chat_models/base.py @@ -1676,9 +1676,6 @@ class BaseChatOpenAI(BaseChatModel): parallel_tool_calls: Set to `False` to disable parallel tool use. Defaults to `None` (no specification, which allows parallel tool use). kwargs: Any additional parameters are passed directly to `bind`. - - !!! warning "Behavior changed in 0.1.21" - Support for `strict` argument added. """ # noqa: E501 if parallel_tool_calls is not None: kwargs["parallel_tool_calls"] = parallel_tool_calls @@ -1766,7 +1763,7 @@ class BaseChatOpenAI(BaseChatModel): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. diff --git a/libs/partners/perplexity/langchain_perplexity/chat_models.py b/libs/partners/perplexity/langchain_perplexity/chat_models.py index c5e25f3eeed..78ae52ce34e 100644 --- a/libs/partners/perplexity/langchain_perplexity/chat_models.py +++ b/libs/partners/perplexity/langchain_perplexity/chat_models.py @@ -425,7 +425,7 @@ class ChatPerplexity(BaseChatModel): include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`. diff --git a/libs/partners/xai/langchain_xai/chat_models.py b/libs/partners/xai/langchain_xai/chat_models.py index a3e0bdbaddb..c3e1b9bdad6 100644 --- a/libs/partners/xai/langchain_xai/chat_models.py +++ b/libs/partners/xai/langchain_xai/chat_models.py @@ -611,7 +611,7 @@ class ChatXAI(BaseChatOpenAI): # type: ignore[override] include_raw: If `False` then only the parsed structured output is returned. If an error occurs during model output parsing it will be raised. If `True` - then both the raw model response (a BaseMessage) and the parsed model + then both the raw model response (a `BaseMessage`) and the parsed model response will be returned. If an error occurs during output parsing it will be caught and returned as well. The final output is always a dict with keys `'raw'`, `'parsed'`, and `'parsing_error'`.