Skip to main content
Embeddings are handled by the CohereEmbeddings class, which is a wrapper around the Cohere API.

Installation

Embeddings require the cohere library. See the Installation Guide for more information.

Usage

from chonkie import CohereEmbeddings

# Initialize Cohere embeddings
embeddings = CohereEmbeddings()

# Specify model and API key
embeddings = CohereEmbeddings(model="embed-english-light-v3.0", api_key="YOUR_API_KEY")

Example

embeddings = CohereEmbeddings()
vectors = embeddings.embed("your text here")
# Or you can
vectors = embeddings.embed_batch(["text1", "text2"])
I