Skip to main content

Ollama

Chroma provides a convenient wrapper around Ollama’s embeddings API. You can use the OllamaEmbeddingFunction embedding function to generate embeddings for your documents with a model of your choice.
from chromadb.utils.embedding_functions.ollama_embedding_function import (
    OllamaEmbeddingFunction,
)

ollama_ef = OllamaEmbeddingFunction(
    url="http://localhost:11434",
    model_name="llama2",
)

embeddings = ollama_ef(["This is my first text to embed",
                        "This is my second document"])