vectorisers.ollama.OllamaVectoriser

vectorisers.ollama.OllamaVectoriser(model_name)

A wrapper class allowing a locally-running ollama server to generate text embeddings.

Attributes

Name Type Description
model_name str The name of the local model to use.

Methods

Name Description
transform Transforms input text(s) into embeddings using the Huggingface model.

transform

vectorisers.ollama.OllamaVectoriser.transform(texts)

Transforms input text(s) into embeddings using the Huggingface model.

Parameters

Name Type Description Default
texts (str, list[str]) The input text(s) to embed. Can be a single string or a list of strings. required

Returns

Name Type Description
np.ndarray numpy.ndarray: A 2D array of embeddings, where each row corresponds to an input text.

Raises

Name Type Description
ExternalServiceError If the Ollama service fails to generate embeddings.
VectorisationError If embedding extraction from the Ollama response fails.