Skip to main content

Universal Sentence Encoder

Select a language
Chroma also provides a convenient wrapper around [Universal Sentence Encoder](https://research.google.com/pubs/archive/46808.pdf). This embedding function uses `https://tfhub.dev/google/universal-sentence-encoder/4` available 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()

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