Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

gemini-embeddingsGemini embeddings 搜索

Agent Skill

用于搭建或维护带检索增强的 RAG 工作流,适合让 Agent 处理知识库问答、向量检索、来源引用和事实核查。它可以辅助整理数据接入、Embedding、向量库、召回参数和回答生成流程。使用时需要确认数据来源、更新频率、召回阈值和引用展示方式,避免把未命中的资料或过期内容包装成确定事实。

总安装

367

周安装

15

GitHub Stars

1

下载量

118
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gemini-embeddings(Gemini embeddings 搜索)
来源仓库:https://github.com/akrindev/google-studio-skills
仓库路径:skills/gemini-embeddings
安装命令:
npx skills add https://github.com/akrindev/google-studio-skills --skill gemini-embeddings
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/akrindev/google-studio-skills --skill gemini-embeddings

简介

用于搭建和维护带检索增强的 RAG 工作流。

  • 适合处理知识库问答、向量检索和事实核查任务。
  • 可辅助整理数据接入、Embedding 和召回参数设置。
  • 需确认数据来源、更新频率和引用展示方式。gemini-embeddings 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 适用于 Codex、Claude、Cursor 和 Gemini CLI 问答系统。

SKILL.md

Gemini Embeddings

Generate high-quality text embeddings for semantic search, similarity analysis, clustering, and RAG (Retrieval Augmented Generation) applications through executable scripts.

When to Use This Skill

Use this skill when you need to:

  • Find semantically similar documents or texts
  • Build semantic search engines
  • Implement RAG (Retrieval Augmented Generation)
  • Cluster or group similar documents
  • Calculate text similarity scores
  • Power recommendation systems
  • Enable semantic document retrieval
  • Create vector databases for AI applications

Available Scripts

scripts/embed.js

Purpose: Generate embeddings and calculate similarity

When to use:

  • Creating vector representations of text
  • Comparing text similarity
  • Building semantic search systems
  • Implementing RAG pipelines
  • Clustering documents

Key parameters:

ParameterDescriptionExample
textsText(s) to embed (required)"Your text here"
--model, -mEmbedding modelgemini-embedding-001
--task, -tTask typeSEMANTIC_SIMILARITY
--dim, -dOutput dimensionality768, 1536, 3072
--similarity, -sCalculate pairwise similarityFlag
--json, -jOutput as JSONFlag

Output: Embedding vectors or similarity scores

Workflows

Workflow 1: Single Text Embedding

node scripts/embed.js "What is the meaning of life?"
  • Best for: Basic embedding generation
  • Output: Vector with 3072 dimensions (default)
  • Use when: Storing single document vectors

Workflow 2: Semantic Search

# 1. Generate embedding for query
node scripts/embed.js "best practices for coding" --task RETRIEVAL_QUERY > query.json

# 2. Generate embeddings for documents (batch)
node scripts/embed.js "Coding best practices include version control" "Clean code is essential" --task RETRIEVAL_DOCUMENT > docs.json

# 3. Compare and find most similar (calculate similarity separately)
  • Best for: Building search functionality
  • Task types: RETRIEVAL_QUERY, RETRIEVAL_DOCUMENT
  • Combines with: Similarity calculation for ranking

Workflow 3: Text Similarity Comparison

node scripts/embed.js "What is the meaning of life?" "What is the purpose of existence?" "How do I bake a cake?" --similarity
  • Best for: Comparing multiple texts, finding duplicates
  • Output: Pairwise similarity scores (0-1)
  • Use when: Need to rank text similarity

Workflow 4: Dimensionality Reduction for Efficiency

node scripts/embed.js "Text to embed" --dim 768
  • Best for: Faster storage and comparison
  • Options: 768, 1536, or 3072 (default)
  • Trade-off: Lower dimensions = less accuracy but faster

Workflow 5: Document Clustering

# 1. Generate embeddings for multiple documents
node scripts/embed.js "Machine learning is AI" "Deep learning is a subset" "Neural networks power AI" --json > embeddings.jsonl

# 2. Process embeddings with clustering algorithm (your code)
# Use scikit-learn, KMeans, etc.
  • Best for: Grouping similar documents, topic discovery
  • Task type: CLUSTERING
  • Combines with: Clustering libraries (scikit-learn)

Workflow 6: RAG Implementation

# 1. Create document embeddings (one-time setup)
node scripts/embed.js "Document 1 content" "Document 2 content" --task RETRIEVAL_DOCUMENT --dim 1536

# 2. For each query, find similar documents
node scripts/embed.js "User query here" --task RETRIEVAL_QUERY

# 3. Use retrieved documents in prompt to LLM (gemini-text)
node skills/gemini-text/scripts/generate.js "Context: [retrieved docs]. Answer: [user query]"
  • Best for: Building knowledge-based AI systems
  • Combines with: gemini-text for generation with context

Workflow 7: JSON Output for API Integration

node scripts/embed.js "Text to process" --json
  • Best for: API responses, database storage
  • Output: JSON array of embedding vectors
  • Use when: Programmatic processing required

Workflow 8: Batch Document Processing

# 1. Create JSONL with documents
echo '{"text": "Document 1"}' > docs.jsonl
echo '{"text": "Document 2"}' >> docs.jsonl

# 2. Process with script or custom code
python3 << 'EOF'
import json
from google import genai

client = genai.Client()

texts = []
with open("docs.jsonl") as f:
    for line in f:
        texts.append(json.loads(line)["text"])

response = client.models.embed_content(
    model="gemini-embedding-001",
    contents=texts,
    task_type="RETRIEVAL_DOCUMENT"
)

embeddings = [e.values for e in response.embeddings]
print(f"Generated {len(embeddings)} embeddings")
EOF
  • Best for: Large document collections
  • Combines with: Vector databases (Pinecone, Weaviate)

Parameters Reference

Task Types

Task TypeBest ForWhen to Use
SEMANTIC_SIMILARITYComparing text similarityGeneral comparison tasks
RETRIEVAL_DOCUMENTEmbedding documentsStoring documents for retrieval
RETRIEVAL_QUERYEmbedding search queriesFinding similar documents
CLASSIFICATIONText classificationCategorizing text
CLUSTERINGGrouping similar textsDocument clustering

Dimensionality Options

DimensionsUse CaseTrade-off
768High-volume, real-timeLower accuracy, faster
1536Balanced performanceGood accuracy/speed balance
3072Highest accuracySlower, more storage

Similarity Scores

ScoreInterpretation
0.8 - 1.0Very similar (likely duplicates)
0.6 - 0.8Highly related (same topic)
0.4 - 0.6Moderately related
0.2 - 0.4Weakly related
0.0 - 0.2Unrelated

Output Interpretation

Embedding Vector

  • Format: List of float values (768, 1536, or 3072)
  • Range: Typically -1.0 to 1.0
  • Normalized for cosine similarity
  • Can be stored in vector databases

Similarity Output

Pairwise Similarity:
  'What is the meaning of life?...' <-> 'What is the purpose of existence?...': 0.8742
  'What is the meaning of life?...' <-> 'How do I bake a cake?...': 0.1234
  • Higher scores = more similar
  • Use threshold (e.g., 0.7) for matching

JSON Output

[[0.123, -0.456, 0.789, ...], [0.234, -0.567, 0.890, ...]]
  • Array of embedding vectors
  • One per input text
  • Ready for database storage

Common Issues

"google-genai not installed"

npm install @google/genai@latest dotenv@latest

"numpy not installed" (for similarity)

pip install numpy

"Invalid task type"

  • Use available tasks: SEMANTIC_SIMILARITY, RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, CLASSIFICATION, CLUSTERING
  • Check spelling (case-sensitive)
  • Use correct task for your use case

"Invalid dimension"

  • Options: 768, 1536, or 3072 only
  • Check model supports requested dimension
  • Default to 3072 if unsure

"No similarity calculated"

  • Need multiple texts for similarity comparison
  • Use --similarity flag
  • Check that at least 2 texts provided

"Embedding size mismatch"

  • All embeddings must have same dimensionality
  • Use consistent --dim parameter
  • Recompute if dimensions differ

Best Practices

Task Selection

  • SEMANTIC_SIMILARITY: General text comparison
  • RETRIEVAL_DOCUMENT: Storing documents for search
  • RETRIEVAL_QUERY: Querying for similar documents
  • CLASSIFICATION: Categorization tasks
  • CLUSTERING: Grouping similar content

Dimensionality Choice

  • 768: Real-time applications, high volume
  • 1536: Balanced choice for most use cases
  • 3072: Maximum accuracy, offline processing

Performance Optimization

  • Use lower dimensions for speed
  • Batch multiple texts in one request
  • Cache embeddings for repeated queries
  • Precompute document embeddings for search

Storage Tips

  • Use vector databases (Pinecone, Weaviate, Chroma)
  • Normalize vectors for consistent comparison
  • Store metadata with embeddings
  • Index for fast retrieval

RAG Implementation

  • Precompute document embeddings
  • Use RETRIEVAL_DOCUMENT for docs
  • Use RETRIEVAL_QUERY for user questions
  • Combine top results with gemini-text

Similarity Thresholds

  • 0.9+: Exact duplicates or near-duplicates
  • 0.7-0.9: Same topic/subject
  • 0.5-0.7: Related concepts
  • <0.5: Different topics

Related Skills

  • gemini-text: Generate text with retrieved context (RAG)
  • gemini-batch: Process embeddings in bulk
  • gemini-files: Upload documents for embedding
  • gemini-search: Implement semantic search (if available)

Quick Reference

# Basic embedding
node scripts/embed.js "Your text here"

# Semantic search
node scripts/embed.js "Query" --task RETRIEVAL_QUERY

# Document embedding
node scripts/embed.js "Document text" --task RETRIEVAL_DOCUMENT

# Similarity comparison
node scripts/embed.js "Text 1" "Text 2" "Text 3" --similarity

# Dimensionality reduction
node scripts/embed.js "Text" --dim 768

# JSON output
node scripts/embed.js "Text" --json

Reference

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.95%
按下载量换算45

Claude

26.29%
按下载量换算31

Cursor

19.55%
按下载量换算23

Gemini CLI

9.16%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills