Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
Claude Skills Maintainers avatar

Google Gemini Embeddings

  • 196 repo stars
  • Updated July 25, 2026
  • secondsky/claude-skills

Generate Google Gemini embeddings (gemini-embedding-001) for RAG and semantic vector search, integrating with Vectorize.

About

A skill for using the Google Gemini embeddings API (gemini-embedding-001) to power RAG and semantic search. Developers use it for vector search and Vectorize integration, and to resolve dimension mismatches, rate limits, and text-truncation issues.

  • Gemini embeddings API
  • RAG & semantic search
  • Vectorize integration
  • Vector search

Google Gemini Embeddings by the numbers

  • Data as of Jul 28, 2026 (Skillselion catalog sync)
/plugin marketplace add secondsky/claude-skills
/plugin install google-gemini-embeddings@claude-skills

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
repo stars196
Last updatedJuly 25, 2026
Repositorysecondsky/claude-skills

What it does

Generate Google Gemini embeddings (gemini-embedding-001) for RAG and semantic vector search, integrating with Vectorize.

README.md

Google Gemini Embeddings

Status: Production Ready ✅ Last Updated: 2025-10-25 Production Tested: RAG applications with Cloudflare Vectorize


Auto-Trigger Keywords

Claude Code automatically discovers this skill when you mention:

Primary Keywords

  • gemini embeddings
  • gemini-embedding-001
  • google embeddings
  • gemini embed
  • @google/genai embeddings
  • text-embedding-004 (common confusion with OpenAI naming)

Use Cases

  • semantic search gemini
  • rag gemini
  • vector search gemini
  • document clustering gemini
  • similarity search gemini
  • retrieval augmented generation gemini
  • cosine similarity gemini

Technical Keywords

  • 768 dimensions
  • 3072 dimensions
  • embed content gemini
  • batch embeddings gemini
  • embeddings api gemini
  • vector normalization
  • matryoshka embeddings

Integration Keywords

  • vectorize gemini
  • cloudflare vectorize embeddings
  • rag vectorize
  • gemini embeddings workers
  • gemini embeddings cloudflare

Task Types

  • retrieval query gemini
  • retrieval document gemini
  • embedding task types
  • semantic similarity embedding
  • clustering embeddings

Error-Based Keywords

  • dimension mismatch embeddings
  • embeddings rate limit
  • text truncation embeddings
  • batch size limit embeddings
  • 429 too many requests gemini
  • cosine similarity calculation error
  • vector dimensions do not match
  • embedding model deprecated

What This Skill Does

Provides complete, production-ready coverage of Google Gemini embeddings API (gemini-embedding-001) for building RAG systems, semantic search, and vector-based applications with Cloudflare Vectorize integration.

Core Capabilities

SDK + Fetch Patterns: Both @google/genai SDK and raw fetch for Cloudflare Workers ✅ 8 Task Types: RETRIEVAL_QUERY, RETRIEVAL_DOCUMENT, SEMANTIC_SIMILARITY, CLUSTERING, etc. ✅ Flexible Dimensions: 128-3072 dimensions using Matryoshka Representation Learning ✅ Batch Processing: Rate limiting, chunking, exponential backoff ✅ Vectorize Integration: Complete RAG workflows with Cloudflare Vectorize ✅ Error Prevention: 8 documented errors with solutions ✅ Production Patterns: Caching, semantic search, document clustering


Known Issues This Skill Prevents

Issue Why It Happens How Skill Fixes It
Dimension Mismatch Not specifying outputDimensionality (defaults to 3072) Templates show correct dimension configuration matching Vectorize index
Rate Limiting (429) Exceeding 100 RPM (free tier) Provides exponential backoff and batch processing patterns
Text Truncation Input > 2,048 tokens (silently truncated) Chunking strategies with overlap for long documents
Wrong Task Type Using RETRIEVAL_DOCUMENT for queries (10-30% quality loss) Clear examples of when to use RETRIEVAL_QUERY vs RETRIEVAL_DOCUMENT
Cosine Similarity Errors Incorrect formula or not normalizing Correct implementation provided with magnitude handling
Vector Storage Loss Rounding floats to integers Guidance on full-precision storage
Model Version Confusion Using deprecated experimental models Specifies stable gemini-embedding-001
Batch Size Exceeded Trying to embed too many texts at once Chunking and pagination examples

Sources: See references/top-errors.md for detailed documentation with official links


When to Use This Skill

✅ Use When:

  • Building RAG (Retrieval Augmented Generation) systems
  • Implementing semantic search with Cloudflare Vectorize
  • Need flexible embedding dimensions (128-3072)
  • Optimizing for specific tasks (8 task types available)
  • Integrating with Cloudflare Workers or edge environments
  • Building on a budget (free tier: 100 RPM, 30k TPM)

❌ Don't Use When:

  • You need >2,048 token context window (use OpenAI text-embedding-3 instead)
  • You're already committed to OpenAI ecosystem and need 1536 fixed dimensions
  • You need embeddings for non-text modalities (images, audio)

Quick Usage Example

Setup

# 1. Install SDK
npm install @google/genai@^1.27.0

# 2. Set API key
export GEMINI_API_KEY="your-api-key"

# 3. Create Vectorize index (768 dimensions recommended)
npx wrangler vectorize create gemini-embeddings --dimensions 768 --metric cosine

Basic Embedding

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const response = await ai.models.embedContent({
  model: 'gemini-embedding-001',
  content: 'Your text here',
  config: {
    taskType: 'RETRIEVAL_QUERY', // Or RETRIEVAL_DOCUMENT
    outputDimensionality: 768 // Match Vectorize index
  }
});

const embedding = response.embedding.values; // [0.012, -0.034, ...]

Result: 768-dimension embedding optimized for your use case Full instructions: See SKILL.md


Package Versions (Verified 2025-10-25)

Package Version Status
@google/genai 1.27.0 ✅ Latest stable
typescript 5.6.0 ✅ Latest stable

Dependencies

Prerequisites: None (standalone skill)

Integrates With:

  • cloudflare-vectorize (recommended for RAG)
  • cloudflare-workers-ai (alternative embedding models)
  • google-gemini-api (for text generation in RAG)

File Structure

google-gemini-embeddings/
├── SKILL.md                    # Complete 1000-line guide with 10 sections
├── README.md                   # This file
├── templates/                  # 7 production templates
│   ├── package.json
│   ├── basic-embeddings.ts     # SDK approach
│   ├── embeddings-fetch.ts     # Cloudflare Workers fetch
│   ├── batch-embeddings.ts     # Rate limiting + batching
│   ├── rag-with-vectorize.ts   # Complete RAG implementation
│   ├── semantic-search.ts      # Cosine similarity + top-K
│   └── clustering.ts           # K-means clustering
├── references/                 # 5 comprehensive guides
│   ├── top-errors.md           # 8 errors with solutions
│   ├── model-comparison.md     # Gemini vs OpenAI vs Workers AI
│   ├── vectorize-integration.md # Complete Vectorize setup
│   ├── rag-patterns.md         # 8 RAG implementation patterns
│   └── dimension-guide.md      # Choosing 768 vs 1536 vs 3072
└── scripts/
    └── check-versions.sh       # Package version verification

Official Documentation


Related Skills

  • google-gemini-api - Main Gemini API for text/image generation
  • cloudflare-vectorize - Vector database for storing embeddings
  • cloudflare-workers-ai - Workers AI embeddings (BGE models, free alternative)

Contributing

Found an issue or have a suggestion?


License

MIT License - See main repo LICENSE file


Production Tested: ✅ RAG applications with Cloudflare Vectorize Token Savings: ~60% Error Prevention: 100% (8 documented errors) Ready to use! See SKILL.md for complete setup.

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.