> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ollama

Generate embeddings via the [ollama](https://github.com/ollama/ollama-python) python library. More details:

* [Ollama docs on embeddings](https://github.com/ollama/ollama/blob/main/docs/api.md#generate-embeddings)
* [Ollama blog on embeddings](https://ollama.com/blog/embedding-models)

| Parameter | Type | Default Value | Description |
| - | - | - | - |
| `name` | `str` | `nomic-embed-text` | The name of the model. |
| `host` | `str` | `http://localhost:11434` | The Ollama host to connect to. |
| `options` | `ollama.Options` or `dict` | `None` | Additional model parameters listed in the documentation for the Modelfile such as `temperature`. |
| `keep_alive` | `float` or `str` | `"5m"` | Controls how long the model will stay loaded into memory following the request. |
| `ollama_client_kwargs` | `dict` | `{}` | kwargs that can be past to the `ollama.Client`. |

import tempfile
from pathlib import Path

import lancedb
from lancedb.embeddings import get\_registry
from lancedb.pydantic import LanceModel, Vector

db = lancedb.connect(str(Path(tempfile.mkdtemp()) / "ollama-demo"))
func = get\_registry().get("ollama").create(name="nomic-embed-text")

class Words(LanceModel):
&#x20;   text: str = func.SourceField()
&#x20;   vector: Vector(func.ndims()) = func.VectorField()

table = db.create\_table("words", schema=Words, mode="overwrite")
table.add(
&#x20;   \[
&#x20;       \{"text": "hello world"},
&#x20;       \{"text": "goodbye world"},
&#x20;   ]
)

query = "greetings"
actual = table.search(query).limit(1).to\_pydantic(Words)\[0]
print(actual.text)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.