Google Gemini ↗
noOriginal Documentation
Documentation Index#
Fetch the complete documentation index at: https://docs.trychroma.com/llms.txt Use this file to discover all available pages before exploring further.
Chroma provides a convenient wrapper around Google’s Generative AI embedding API. This embedding function runs remotely on Google’s servers, and requires an API key.
You can get an API key by signing up for an account at Google AI Studio.
This embedding function relies on the google-genai python package, which you can install with pip install google-genai.
# import
import chromadb.utils.embedding_functions as embedding_functions
# The GoogleGenaiEmbeddingFunction expects the API key in the GOOGLE_API_KEY environment variable.
google_ef = embedding_functions.GoogleGenaiEmbeddingFunction(model_name="models/gemini-embedding-001")
google_ef(["document1","document2"])
# pass documents to query for .add and .query
collection = client.create_collection(name="name", embedding_function=google_ef)
collection = client.get_collection(name="name", embedding_function=google_ef)
```
You can view a more [complete example](https://github.com/chroma-core/chroma/tree/main/examples/gemini) chatting over documents with Gemini embedding and langauge models.
For more info - please visit the [official Google docs](https://ai.google.dev/gemini-api/docs/embeddings).
<span class="tab-end"></span>
<span class="tab-start" data-tab-title="TypeScript"></span>
```typescript
// npm install @chroma-core/google-gemini
import { ChromaClient } from "chromadb";
import { GoogleGeminiEmbeddingFunction } from "@chroma-core/google-gemini";
const embedder = new GoogleGeminiEmbeddingFunction({
apiKey: "<YOUR API KEY>",
modelName: "gemini-embedding-001",
});
// use directly
const embeddings = await embedder.generate(["document1", "document2"]);
// pass documents to query for .add and .query
const collection = await client.createCollection({
name: "name",
embeddingFunction: embedder,
});
const collectionGet = await client.getCollection({
name: "name",
embeddingFunction: embedder,
});
```
You can view a more [complete example using Node](https://github.com/chroma-core/chroma/blob/main/clients/js/examples/node/app.js).
For more info - please visit the [official Google docs](https://ai.google.dev/gemini-api/docs/embeddings).
<span class="tab-end"></span>
<span class="tab-group-end"></span>Link last verified
June 7, 2026.
View original ↗
Source: Chroma Docs
Link last verified: 2026-03-04