OllamaEmbeddings#

class langchain_ollama.embeddings.OllamaEmbeddings[source]#

Bases: BaseModel, Embeddings

OllamaEmbeddings embedding model.

Example

from langchain_ollama import OllamaEmbeddings

embedder = OllamaEmbeddings(model="llama3")
embedder.embed_query("what is the place that jonathan worked at?")

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param base_url: str | None = None#

Base url the model is hosted under.

param client_kwargs: dict | None = {}#

Additional kwargs to pass to the httpx Client. For a full list of the params, see [this link](https://pydoc.dev/httpx/latest/httpx.Client.html)

param model: str [Required]#

Model name to use.

async aembed_documents(texts: List[str]) List[List[float]][source]#

Embed search docs.

Parameters:

texts (List[str])

Return type:

List[List[float]]

async aembed_query(text: str) List[float][source]#

Embed query text.

Parameters:

text (str)

Return type:

List[float]

embed_documents(texts: List[str]) List[List[float]][source]#

Embed search docs.

Parameters:

texts (List[str])

Return type:

List[List[float]]

embed_query(text: str) List[float][source]#

Embed query text.

Parameters:

text (str)

Return type:

List[float]

Examples using OllamaEmbeddings#