Skip to content

Commit d65da13

Browse files
authored
docs(ollama): add validate_model_on_init note, bump lock (#32172)
1 parent c14bd1f commit d65da13

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

libs/partners/ollama/langchain_ollama/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
"""This is the langchain_ollama package.
22
3-
It provides infrastructure for interacting with the Ollama service.
3+
Provides infrastructure for interacting with the `Ollama <https://ollama.com/>`__
4+
service.
5+
6+
.. note::
7+
**Newly added in 0.3.4:** ``validate_model_on_init`` param on all models.
8+
This parameter allows you to validate the model exists in Ollama locally on
9+
initialization. If set to ``True``, it will raise an error if the model does not
10+
exist locally. This is useful for ensuring that the model is available before
11+
attempting to use it, especially in environments where models may not be
12+
pre-downloaded.
413
"""
514

615
from importlib import metadata

libs/partners/ollama/langchain_ollama/chat_models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ class Multiply(BaseModel):
437437
unless you set ``reasoning`` to ``True``."""
438438

439439
validate_model_on_init: bool = False
440-
"""Whether to validate the model exists in Ollama locally on initialization."""
440+
"""Whether to validate the model exists in Ollama locally on initialization.
441+
442+
.. versionadded:: 0.3.4
443+
"""
441444

442445
mirostat: Optional[int] = None
443446
"""Enable Mirostat sampling for controlling perplexity.

libs/partners/ollama/langchain_ollama/embeddings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ class OllamaEmbeddings(BaseModel, Embeddings):
128128
"""Model name to use."""
129129

130130
validate_model_on_init: bool = False
131-
"""Whether to validate the model exists in ollama locally on initialization."""
131+
"""Whether to validate the model exists in ollama locally on initialization.
132+
133+
.. versionadded:: 0.3.4
134+
"""
132135

133136
base_url: Optional[str] = None
134137
"""Base url the model is hosted under."""

libs/partners/ollama/langchain_ollama/llms.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ class OllamaLLM(BaseLLM):
5353
be present directly within the main response content."""
5454

5555
validate_model_on_init: bool = False
56-
"""Whether to validate the model exists in ollama locally on initialization."""
56+
"""Whether to validate the model exists in ollama locally on initialization.
57+
58+
.. versionadded:: 0.3.4
59+
"""
5760

5861
mirostat: Optional[int] = None
5962
"""Enable Mirostat sampling for controlling perplexity.

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)