mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
docs: v1 docs updates (#33173)
Co-authored-by: Mohammad Mohtashim <45242107+keenborder786@users.noreply.github.com> Co-authored-by: Caspar Broekhuizen <caspar@langchain.dev> Co-authored-by: ccurme <chester.curme@gmail.com> Co-authored-by: Christophe Bornet <cbornet@hotmail.com> Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com> Co-authored-by: Sadra Barikbin <sadraqazvin1@yahoo.com> Co-authored-by: Vadym Barda <vadim.barda@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Provides infrastructure for interacting with the `Ollama <https://ollama.com/>`__
|
||||
service.
|
||||
|
||||
.. note::
|
||||
!!! 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
|
||||
|
||||
@@ -257,7 +257,7 @@ def _is_pydantic_class(obj: Any) -> bool:
|
||||
class ChatOllama(BaseChatModel):
|
||||
r"""Ollama chat model integration.
|
||||
|
||||
.. dropdown:: Setup
|
||||
??? note "Setup"
|
||||
:open:
|
||||
|
||||
Install ``langchain-ollama`` and download any models you want to use from ollama.
|
||||
@@ -492,7 +492,7 @@ class ChatOllama(BaseChatModel):
|
||||
``reasoning_content`` key, but will be present within the main response content
|
||||
as think tags (``<think>`` and ``</think>``).
|
||||
|
||||
.. note::
|
||||
!!! note
|
||||
This feature is only available for `models that support reasoning <https://ollama.com/search?c=thinking>`__.
|
||||
|
||||
.. code-block:: python
|
||||
@@ -546,7 +546,7 @@ class ChatOllama(BaseChatModel):
|
||||
validate_model_on_init: bool = False
|
||||
"""Whether to validate the model exists in Ollama locally on initialization.
|
||||
|
||||
.. versionadded:: 0.3.4
|
||||
!!! version-added "Added in version 0.3.4"
|
||||
"""
|
||||
|
||||
mirostat: Optional[int] = None
|
||||
@@ -1239,7 +1239,7 @@ class ChatOllama(BaseChatModel):
|
||||
Args:
|
||||
tools: A list of tool definitions to bind to this chat model.
|
||||
Supports any tool definition handled by
|
||||
:meth:`langchain_core.utils.function_calling.convert_to_openai_tool`.
|
||||
`langchain_core.utils.function_calling.convert_to_openai_tool`.
|
||||
tool_choice: If provided, which tool for model to call. **This parameter
|
||||
is currently ignored as it is not supported by Ollama.**
|
||||
kwargs: Any additional parameters are passed directly to
|
||||
@@ -1269,7 +1269,7 @@ class ChatOllama(BaseChatModel):
|
||||
If ``schema`` is a Pydantic class then the model output will be a
|
||||
Pydantic instance of that class, and the model-generated fields will be
|
||||
validated by the Pydantic class. Otherwise the model output will be a
|
||||
dict and will not be validated. See :meth:`langchain_core.utils.function_calling.convert_to_openai_tool`
|
||||
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.
|
||||
|
||||
@@ -1295,7 +1295,7 @@ class ChatOllama(BaseChatModel):
|
||||
kwargs: Additional keyword args aren't supported.
|
||||
|
||||
Returns:
|
||||
A Runnable that takes same inputs as a :class:`langchain_core.language_models.chat.BaseChatModel`.
|
||||
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). Otherwise, if ``include_raw`` is False then Runnable outputs a dict.
|
||||
|
||||
@@ -1305,15 +1305,13 @@ class ChatOllama(BaseChatModel):
|
||||
- ``'parsed'``: None if there was a parsing error, otherwise the type depends on the ``schema`` as described above.
|
||||
- ``'parsing_error'``: Optional[BaseException]
|
||||
|
||||
.. versionchanged:: 0.2.2
|
||||
|
||||
!!! warning "Behavior changed in 0.2.2"
|
||||
Added support for structured output API via ``format`` parameter.
|
||||
|
||||
.. versionchanged:: 0.3.0
|
||||
|
||||
!!! warning "Behavior changed in 0.3.0"
|
||||
Updated default ``method`` to ``'json_schema'``.
|
||||
|
||||
.. dropdown:: Example: schema=Pydantic class, method="json_schema", include_raw=False
|
||||
??? note "Example: `schema=Pydantic` class, `method='json_schema'`, `include_raw=False`"
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -1343,7 +1341,7 @@ class ChatOllama(BaseChatModel):
|
||||
# justification='Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ.'
|
||||
# )
|
||||
|
||||
.. dropdown:: Example: ``schema=Pydantic`` class, ``method='json_schema'``, ``include_raw=True``
|
||||
??? note "Example: `schema=Pydantic` class, `method='json_schema'`, `include_raw=True`"
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -1371,7 +1369,7 @@ class ChatOllama(BaseChatModel):
|
||||
# 'parsing_error': None
|
||||
# }
|
||||
|
||||
.. dropdown:: Example: ``schema=Pydantic`` class, ``method='function_calling'``, ``include_raw=False``
|
||||
??? note "Example: `schema=Pydantic` class, `method='function_calling'`, `include_raw=False`"
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -1404,7 +1402,7 @@ class ChatOllama(BaseChatModel):
|
||||
# justification='Both a pound of bricks and a pound of feathers weigh one pound. The weight is the same, but the volume or density of the objects may differ.'
|
||||
# )
|
||||
|
||||
.. dropdown:: Example: schema=TypedDict class, method="function_calling", include_raw=False
|
||||
??? note "Example: `schema=TypedDict` class, `method='function_calling'`, `include_raw=False`"
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -1431,7 +1429,7 @@ class ChatOllama(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.'
|
||||
# }
|
||||
|
||||
.. dropdown:: Example: ``schema=OpenAI`` function schema, ``method='function_calling'``, ``include_raw=False``
|
||||
??? note "Example: `schema=OpenAI` function schema, `method='function_calling'`, `include_raw=False`"
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -1461,7 +1459,7 @@ class ChatOllama(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.'
|
||||
# }
|
||||
|
||||
.. dropdown:: Example: ``schema=Pydantic`` class, ``method='json_mode'``, ``include_raw=True``
|
||||
??? note "Example: `schema=Pydantic` class, `method='json_mode'`, `include_raw=True`"
|
||||
|
||||
.. code-block::
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ class OllamaEmbeddings(BaseModel, Embeddings):
|
||||
validate_model_on_init: bool = False
|
||||
"""Whether to validate the model exists in ollama locally on initialization.
|
||||
|
||||
.. versionadded:: 0.3.4
|
||||
!!! version-added "Added in version 0.3.4"
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ class OllamaLLM(BaseLLM):
|
||||
validate_model_on_init: bool = False
|
||||
"""Whether to validate the model exists in ollama locally on initialization.
|
||||
|
||||
.. versionadded:: 0.3.4
|
||||
!!! version-added "Added in version 0.3.4"
|
||||
"""
|
||||
|
||||
mirostat: Optional[int] = None
|
||||
|
||||
Reference in New Issue
Block a user