mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
style: monorepo pass for refs (#33359)
* Delete some double backticks previously used by Sphinx (not done everywhere yet) * Fix some code blocks / dropdowns Ignoring CLI CI for now
This commit is contained in:
@@ -6,7 +6,7 @@ service.
|
||||
!!! note
|
||||
**Newly added in 0.3.4:** ``validate_model_on_init`` param on all models.
|
||||
This parameter allows you to validate the model exists in Ollama locally on
|
||||
initialization. If set to ``True``, it will raise an error if the model does not
|
||||
initialization. If set to `True`, it will raise an error if the model does not
|
||||
exist locally. This is useful for ensuring that the model is available before
|
||||
attempting to use it, especially in environments where models may not be
|
||||
pre-downloaded.
|
||||
|
||||
@@ -273,16 +273,16 @@ class ChatOllama(BaseChatModel):
|
||||
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
|
||||
- `True`: Enables reasoning mode. The model's reasoning process will be
|
||||
captured and returned separately in the ``additional_kwargs`` of the
|
||||
response message, under ``reasoning_content``. The main response
|
||||
content will not include the reasoning tags.
|
||||
- ``False``: Disables reasoning mode. The model will not perform any reasoning,
|
||||
- `False`: Disables reasoning mode. The model will not perform any reasoning,
|
||||
and the response will not include any reasoning content.
|
||||
- ``None`` (Default): The model will use its default reasoning behavior. Note
|
||||
- `None` (Default): The model will use its default reasoning behavior. Note
|
||||
however, if the model's default behavior *is* to perform reasoning, think tags
|
||||
(``<think>`` and ``</think>``) will be present within the main response content
|
||||
unless you set ``reasoning`` to ``True``.
|
||||
unless you set ``reasoning`` to `True`.
|
||||
temperature: float
|
||||
Sampling temperature. Ranges from ``0.0`` to ``1.0``.
|
||||
num_predict: Optional[int]
|
||||
@@ -481,12 +481,12 @@ class ChatOllama(BaseChatModel):
|
||||
|
||||
Thinking / Reasoning:
|
||||
You can enable reasoning mode for models that support it by setting
|
||||
the ``reasoning`` parameter to ``True`` in either the constructor or
|
||||
the ``invoke``/``stream`` methods. This will enable the model to think
|
||||
the ``reasoning`` parameter to `True` in either the constructor or
|
||||
the `invoke`/`stream` methods. This will enable the model to think
|
||||
through the problem and return the reasoning process separately in the
|
||||
``additional_kwargs`` of the response message, under ``reasoning_content``.
|
||||
|
||||
If ``reasoning`` is set to ``None``, the model will use its default reasoning
|
||||
If ``reasoning`` is set to `None`, the model will use its default reasoning
|
||||
behavior, and any reasoning content will *not* be captured under the
|
||||
``reasoning_content`` key, but will be present within the main response content
|
||||
as think tags (``<think>`` and ``</think>``).
|
||||
@@ -526,17 +526,17 @@ class ChatOllama(BaseChatModel):
|
||||
reasoning: Optional[Union[bool, str]] = None
|
||||
"""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
|
||||
- `True`: Enables reasoning mode. The model's reasoning process will be
|
||||
captured and returned separately in the ``additional_kwargs`` of the
|
||||
response message, under ``reasoning_content``. The main response
|
||||
content will not include the reasoning tags.
|
||||
- ``False``: Disables reasoning mode. The model will not perform any reasoning,
|
||||
- `False`: Disables reasoning mode. The model will not perform any reasoning,
|
||||
and the response will not include any reasoning content.
|
||||
- ``None`` (Default): The model will use its default reasoning behavior. Note
|
||||
- `None` (Default): The model will use its default reasoning behavior. Note
|
||||
however, if the model's default behavior *is* to perform reasoning, think tags
|
||||
()``<think>`` and ``</think>``) will be present within the main response content
|
||||
unless you set ``reasoning`` to ``True``.
|
||||
- ``str``: e.g. ``'low'``, ``'medium'``, ``'high'``. Enables reasoning with a custom
|
||||
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 <https://github.com/ollama/ollama-python/blob/da79e987f0ac0a4986bf396f043b36ef840370bc/ollama/_types.py#L210>`__
|
||||
for more information.
|
||||
@@ -551,7 +551,7 @@ class ChatOllama(BaseChatModel):
|
||||
mirostat: Optional[int] = None
|
||||
"""Enable Mirostat sampling for controlling perplexity.
|
||||
|
||||
(Default: ``0``, ``0`` = disabled, ``1`` = Mirostat, ``2`` = Mirostat 2.0)
|
||||
(Default: `0`, `0` = disabled, ``1`` = Mirostat, ``2`` = Mirostat 2.0)
|
||||
"""
|
||||
|
||||
mirostat_eta: Optional[float] = None
|
||||
@@ -580,7 +580,7 @@ class ChatOllama(BaseChatModel):
|
||||
num_gpu: Optional[int] = None
|
||||
"""The number of GPUs to use.
|
||||
|
||||
On macOS it defaults to ``1`` to enable metal support, ``0`` to disable.
|
||||
On macOS it defaults to ``1`` to enable metal support, `0` to disable.
|
||||
"""
|
||||
|
||||
num_thread: Optional[int] = None
|
||||
@@ -600,7 +600,7 @@ class ChatOllama(BaseChatModel):
|
||||
repeat_last_n: Optional[int] = None
|
||||
"""Sets how far back for the model to look back to prevent repetition.
|
||||
|
||||
(Default: ``64``, ``0`` = disabled, ``-1`` = ``num_ctx``)
|
||||
(Default: ``64``, `0` = disabled, ``-1`` = ``num_ctx``)
|
||||
"""
|
||||
|
||||
repeat_penalty: Optional[float] = None
|
||||
@@ -695,17 +695,17 @@ class ChatOllama(BaseChatModel):
|
||||
"""
|
||||
|
||||
async_client_kwargs: Optional[dict] = {}
|
||||
"""Additional kwargs to merge with ``client_kwargs`` before passing to httpx client.
|
||||
"""Additional kwargs to merge with `client_kwargs` before passing to httpx client.
|
||||
|
||||
These are clients unique to the async client; for shared args use ``client_kwargs``.
|
||||
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 <https://www.python-httpx.org/api/#asyncclient>`__.
|
||||
"""
|
||||
|
||||
sync_client_kwargs: Optional[dict] = {}
|
||||
"""Additional kwargs to merge with ``client_kwargs`` before passing to httpx client.
|
||||
"""Additional kwargs to merge with `client_kwargs` before passing to httpx client.
|
||||
|
||||
These are clients unique to the sync client; for shared args use ``client_kwargs``.
|
||||
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 <https://www.python-httpx.org/api/#client>`__.
|
||||
"""
|
||||
@@ -1262,7 +1262,7 @@ class ChatOllama(BaseChatModel):
|
||||
|
||||
- a Pydantic class,
|
||||
- a JSON schema
|
||||
- a TypedDict class
|
||||
- a `TypedDict` class
|
||||
- an OpenAI function/tool schema.
|
||||
|
||||
If ``schema`` is a Pydantic class then the model output will be a
|
||||
@@ -1270,7 +1270,7 @@ class ChatOllama(BaseChatModel):
|
||||
validated by the Pydantic class. Otherwise the model output will be a
|
||||
dict and will not be validated. See `langchain_core.utils.function_calling.convert_to_openai_tool`
|
||||
for more on how to properly specify types and descriptions of
|
||||
schema fields when specifying a Pydantic or TypedDict class.
|
||||
schema fields when specifying a Pydantic or `TypedDict` class.
|
||||
|
||||
method: The method for steering model generation, one of:
|
||||
|
||||
@@ -1284,9 +1284,9 @@ class ChatOllama(BaseChatModel):
|
||||
desired schema into the model call.
|
||||
|
||||
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
|
||||
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
|
||||
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'``.
|
||||
@@ -1300,7 +1300,7 @@ class ChatOllama(BaseChatModel):
|
||||
|
||||
If ``include_raw`` is True, then Runnable outputs a dict with keys:
|
||||
|
||||
- ``'raw'``: ``BaseMessage``
|
||||
- ``'raw'``: `BaseMessage`
|
||||
- ``'parsed'``: None if there was a parsing error, otherwise the type depends on the ``schema`` as described above.
|
||||
- ``'parsing_error'``: Optional[BaseException]
|
||||
|
||||
|
||||
@@ -160,17 +160,17 @@ class OllamaEmbeddings(BaseModel, Embeddings):
|
||||
"""
|
||||
|
||||
async_client_kwargs: Optional[dict] = {}
|
||||
"""Additional kwargs to merge with ``client_kwargs`` before passing to httpx client.
|
||||
"""Additional kwargs to merge with `client_kwargs` before passing to httpx client.
|
||||
|
||||
These are clients unique to the async client; for shared args use ``client_kwargs``.
|
||||
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 <https://www.python-httpx.org/api/#asyncclient>`__.
|
||||
"""
|
||||
|
||||
sync_client_kwargs: Optional[dict] = {}
|
||||
"""Additional kwargs to merge with ``client_kwargs`` before passing to httpx client.
|
||||
"""Additional kwargs to merge with `client_kwargs` before passing to httpx client.
|
||||
|
||||
These are clients unique to the sync client; for shared args use ``client_kwargs``.
|
||||
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 <https://www.python-httpx.org/api/#client>`__.
|
||||
"""
|
||||
@@ -183,7 +183,7 @@ class OllamaEmbeddings(BaseModel, Embeddings):
|
||||
|
||||
mirostat: Optional[int] = None
|
||||
"""Enable Mirostat sampling for controlling perplexity.
|
||||
(default: ``0``, ``0`` = disabled, ``1`` = Mirostat, ``2`` = Mirostat 2.0)"""
|
||||
(default: `0`, `0` = disabled, ``1`` = Mirostat, ``2`` = Mirostat 2.0)"""
|
||||
|
||||
mirostat_eta: Optional[float] = None
|
||||
"""Influences how quickly the algorithm responds to feedback
|
||||
@@ -202,7 +202,7 @@ class OllamaEmbeddings(BaseModel, Embeddings):
|
||||
|
||||
num_gpu: Optional[int] = None
|
||||
"""The number of GPUs to use. On macOS it defaults to ``1`` to
|
||||
enable metal support, ``0`` to disable."""
|
||||
enable metal support, `0` to disable."""
|
||||
|
||||
keep_alive: Optional[int] = None
|
||||
"""Controls how long the model will stay loaded into memory
|
||||
@@ -217,7 +217,7 @@ class OllamaEmbeddings(BaseModel, Embeddings):
|
||||
|
||||
repeat_last_n: Optional[int] = None
|
||||
"""Sets how far back for the model to look back to prevent
|
||||
repetition. (Default: ``64``, ``0`` = disabled, ``-1`` = ``num_ctx``)"""
|
||||
repetition. (Default: ``64``, `0` = disabled, ``-1`` = ``num_ctx``)"""
|
||||
|
||||
repeat_penalty: Optional[float] = None
|
||||
"""Sets how strongly to penalize repetitions. A higher value (e.g., ``1.5``)
|
||||
|
||||
@@ -116,13 +116,13 @@ class OllamaLLM(BaseLLM):
|
||||
"""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
|
||||
- `True`: Enables reasoning mode. The model's reasoning process will be
|
||||
captured and returned separately in the ``additional_kwargs`` of the
|
||||
response message, under ``reasoning_content``. The main response
|
||||
content will not include the reasoning tags.
|
||||
- ``False``: Disables reasoning mode. The model will not perform any reasoning,
|
||||
- `False`: Disables reasoning mode. The model will not perform any reasoning,
|
||||
and the response will not include any reasoning content.
|
||||
- ``None`` (Default): The model will use its default reasoning behavior. If
|
||||
- `None` (Default): The model will use its default reasoning behavior. If
|
||||
the model performs reasoning, the ``<think>`` and ``</think>`` tags will
|
||||
be present directly within the main response content."""
|
||||
|
||||
@@ -134,7 +134,7 @@ class OllamaLLM(BaseLLM):
|
||||
|
||||
mirostat: Optional[int] = None
|
||||
"""Enable Mirostat sampling for controlling perplexity.
|
||||
(default: ``0``, ``0`` = disabled, ``1`` = Mirostat, ``2`` = Mirostat 2.0)"""
|
||||
(default: `0`, `0` = disabled, ``1`` = Mirostat, ``2`` = Mirostat 2.0)"""
|
||||
|
||||
mirostat_eta: Optional[float] = None
|
||||
"""Influences how quickly the algorithm responds to feedback
|
||||
@@ -153,7 +153,7 @@ class OllamaLLM(BaseLLM):
|
||||
|
||||
num_gpu: Optional[int] = None
|
||||
"""The number of GPUs to use. On macOS it defaults to ``1`` to
|
||||
enable metal support, ``0`` to disable."""
|
||||
enable metal support, `0` to disable."""
|
||||
|
||||
num_thread: Optional[int] = None
|
||||
"""Sets the number of threads to use during computation.
|
||||
@@ -167,7 +167,7 @@ class OllamaLLM(BaseLLM):
|
||||
|
||||
repeat_last_n: Optional[int] = None
|
||||
"""Sets how far back for the model to look back to prevent
|
||||
repetition. (Default: ``64``, ``0`` = disabled, ``-1`` = ``num_ctx``)"""
|
||||
repetition. (Default: ``64``, `0` = disabled, ``-1`` = ``num_ctx``)"""
|
||||
|
||||
repeat_penalty: Optional[float] = None
|
||||
"""Sets how strongly to penalize repetitions. A higher value (e.g., ``1.5``)
|
||||
@@ -239,17 +239,17 @@ class OllamaLLM(BaseLLM):
|
||||
"""
|
||||
|
||||
async_client_kwargs: Optional[dict] = {}
|
||||
"""Additional kwargs to merge with ``client_kwargs`` before passing to httpx client.
|
||||
"""Additional kwargs to merge with `client_kwargs` before passing to httpx client.
|
||||
|
||||
These are clients unique to the async client; for shared args use ``client_kwargs``.
|
||||
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 <https://www.python-httpx.org/api/#asyncclient>`__.
|
||||
"""
|
||||
|
||||
sync_client_kwargs: Optional[dict] = {}
|
||||
"""Additional kwargs to merge with ``client_kwargs`` before passing to httpx client.
|
||||
"""Additional kwargs to merge with `client_kwargs` before passing to httpx client.
|
||||
|
||||
These are clients unique to the sync client; for shared args use ``client_kwargs``.
|
||||
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 <https://www.python-httpx.org/api/#client>`__.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user