Skip to main content

Universal Sentence Encoder

Select a language

Chroma also provides a convenient wrapper around Universal Sentence Encoder.

This embedding function uses models hosted on Tensorflow Hub.

This embedding function relies on the tensforflow_hub python package, which you can install with pip install tensforflow_hub.

import chromadb.utils.embedding_functions as embedding_functions
huggingface_ef = embedding_functions.UniversalSentenceEncoderEmbeddingFunction()

huggingface_ef([
"The quick brown fox jumps over the lazy dog.",
"I am a sentence for which I would like to get its embedding"])

You can pass in an optional model_name argument, which lets you choose which model to use. By default, Chroma uses Universal Sentence Encoder - https://tfhub.dev/google/universal-sentence-encoder/4