Skip to content

Commit 8878a7b

Browse files
authored
docs: ollama nits (#31714)
1 parent 7cdd533 commit 8878a7b

File tree

6 files changed

+1316
-705
lines changed

6 files changed

+1316
-705
lines changed

docs/docs/integrations/chat/ollama.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
"source": [
259259
"## Tool calling\n",
260260
"\n",
261-
"We can use [tool calling](https://blog.langchain.dev/improving-core-tool-interfaces-and-docs-in-langchain/) with an LLM [that has been fine-tuned for tool use](https://ollama.com/library/llama3.1):\n",
261+
"We can use [tool calling](https://blog.langchain.dev/improving-core-tool-interfaces-and-docs-in-langchain/) with an LLM [that has been fine-tuned for tool use](https://ollama.com/search?&c=tools) such as `llama3.1`:\n",
262262
"\n",
263263
"```\n",
264264
"ollama pull llama3.1\n",

docs/docs/integrations/providers/ollama.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ Ollama will start as a background service automatically, if this is disabled, ru
2323
ollama serve
2424
```
2525

26-
After starting ollama, run `ollama pull <model_checkpoint>` to download a model
27-
from the [Ollama model library](https://ollama.ai/library).
26+
After starting ollama, run `ollama pull <name-of-model>` to download a model from the [Ollama model library](https://ollama.ai/library):
2827

2928
```bash
3029
ollama pull llama3.1
3130
```
3231

32+
- This will download the default tagged version of the model. Typically, the default points to the latest, smallest sized-parameter model.
33+
- To view all pulled (downloaded) models, use `ollama list`
34+
3335
We're now ready to install the `langchain-ollama` partner package and run a model.
3436

3537
### Ollama LangChain partner package install

docs/docs/integrations/text_embedding/ollama.ipynb

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
"cell_type": "markdown",
5656
"id": "c84fb993",
5757
"metadata": {},
58-
"source": "To enable automated tracing of your model calls, set your [LangSmith](https://docs.smith.langchain.com/) API key:"
58+
"source": [
59+
"To enable automated tracing of your model calls, set your [LangSmith](https://docs.smith.langchain.com/) API key:"
60+
]
5961
},
6062
{
6163
"cell_type": "code",
@@ -108,7 +110,7 @@
108110
},
109111
{
110112
"cell_type": "code",
111-
"execution_count": 3,
113+
"execution_count": 2,
112114
"id": "9ea7a09b",
113115
"metadata": {},
114116
"outputs": [],
@@ -127,7 +129,7 @@
127129
"source": [
128130
"## Indexing and Retrieval\n",
129131
"\n",
130-
"Embedding models are often used in retrieval-augmented generation (RAG) flows, both as part of indexing data as well as later retrieving it. For more detailed instructions, please see our [RAG tutorials](/docs/tutorials/).\n",
132+
"Embedding models are often used in retrieval-augmented generation (RAG) flows, both as part of indexing data as well as later retrieving it. For more detailed instructions, please see our [RAG tutorials](/docs/tutorials/rag/).\n",
131133
"\n",
132134
"Below, see how to index and retrieve data using the `embeddings` object we initialized above. In this example, we will index and retrieve a sample document in the `InMemoryVectorStore`."
133135
]
@@ -139,14 +141,11 @@
139141
"metadata": {},
140142
"outputs": [
141143
{
142-
"data": {
143-
"text/plain": [
144-
"'LangChain is the framework for building context-aware reasoning applications'"
145-
]
146-
},
147-
"execution_count": 4,
148-
"metadata": {},
149-
"output_type": "execute_result"
144+
"name": "stdout",
145+
"output_type": "stream",
146+
"text": [
147+
"LangChain is the framework for building context-aware reasoning applications\n"
148+
]
150149
}
151150
],
152151
"source": [
@@ -166,8 +165,8 @@
166165
"# Retrieve the most similar text\n",
167166
"retrieved_documents = retriever.invoke(\"What is LangChain?\")\n",
168167
"\n",
169-
"# show the retrieved document's content\n",
170-
"retrieved_documents[0].page_content"
168+
"# Show the retrieved document's content\n",
169+
"print(retrieved_documents[0].page_content)"
171170
]
172171
},
173172
{
@@ -252,7 +251,7 @@
252251
],
253252
"metadata": {
254253
"kernelspec": {
255-
"display_name": "Python 3 (ipykernel)",
254+
"display_name": ".venv",
256255
"language": "python",
257256
"name": "python3"
258257
},
@@ -266,7 +265,7 @@
266265
"name": "python",
267266
"nbconvert_exporter": "python",
268267
"pygments_lexer": "ipython3",
269-
"version": "3.9.6"
268+
"version": "3.13.5"
270269
}
271270
},
272271
"nbformat": 4,

libs/partners/ollama/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,21 @@ This package contains the LangChain integration with Ollama
88
pip install -U langchain-ollama
99
```
1010

11-
You will also need to run the Ollama server locally.
12-
You can download it [here](https://ollama.com/download).
11+
For the package to work, you will need to install and run the Ollama server locally ([download](https://ollama.com/download)).
12+
13+
To run integration tests (`make integration_tests`), you will need the following models installed in your Ollama server:
14+
15+
- `llama3`
16+
- `llama3:latest`
17+
- `lamma3.1`
18+
- `gemma3:4b`
19+
- `deepseek-r1:1.5b`
20+
21+
Install these models by running:
22+
23+
```bash
24+
ollama pull <name-of-model>
25+
```
1326

1427
## Chat Models
1528

@@ -34,6 +47,7 @@ embeddings.embed_query("What is the meaning of life?")
3447
```
3548

3649
## LLMs
50+
3751
`OllamaLLM` class exposes LLMs from Ollama.
3852

3953
```python

libs/partners/ollama/langchain_ollama/llms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class OllamaLLM(BaseLLM):
2828
from langchain_ollama import OllamaLLM
2929
3030
model = OllamaLLM(model="llama3")
31-
model.invoke("Come up with 10 names for a song about parrots")
31+
print(model.invoke("Come up with 10 names for a song about parrots"))
3232
"""
3333

3434
model: str

0 commit comments

Comments
 (0)