embedding-strategies
它能做什么
这个工具可以帮你选择最合适的模型,把文本转换成数字(向量),让计算机能够理解文本的含义。它还会提供一些建议,告诉你如何组织这些文本,以便更高效地搜索。
适用场景
- ✓当你需要选择一个模型,让 AI 理解你的文本时。
- ✓当你需要决定如何把文本切分成小块,交给 AI 处理时。
- ✓如果你想提高 AI 从文本中提取信息的质量时。
技能链接
https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/embedding-strategies/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在金融文档中搜索信息,哪个 embedding 模型最好?”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会对比不同的 “embedding” 模型,它们就像是把文本翻译成数字的“翻译官”。工具还会展示一套处理流程,在把文本转换成数字之前先进行整理,让 AI 更好地理解内容。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Embedding Strategies
Guide to selecting and optimizing embedding models for vector search applications.
When to Use This Skill
- Choosing embedding models for RAG
- Optimizing chunking strategies
- Fine-tuning embeddings for domains
- Comparing embedding model performance
- Reducing embedding dimensions
- Handling multilingual content
Core Concepts
1. Embedding Model Comparison (2026)
| Model | Dimensions | Max Tokens | Best For |
|---|---|---|---|
| voyage-3-large | 1024 | 32000 | Claude apps (Anthropic recommended) |
| voyage-3 | 1024 | 32000 | Claude apps, cost-effective |
| voyage-code-3 | 1024 | 32000 | Code search |
| voyage-finance-2 | 1024 | 32000 | Financial documents |
| voyage-law-2 | 1024 | 32000 | Legal documents |
| text-embedding-3-large | 3072 | 8191 | OpenAI apps, high accuracy |
| text-embedding-3-small | 1536 | 8191 | OpenAI apps, cost-effective |
| bge-large-en-v1.5 | 1024 | 512 | Open source, local deployment |
| all-MiniLM-L6-v2 | 384 | 256 | Fast, lightweight |
| multilingual-e5-large | 1024 | 512 | Multi-language |
2. Embedding Pipeline
Document → Chunking → Preprocessing → Embedding Model → Vector
↓
[Overlap, Size] [Clean, Normalize] [API/Local]
Templates and detailed worked examples
Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.
Best Practices
Do's
- Match model to use case: Code vs prose vs multilingual
- Chunk thoughtfully: Preserve semantic boundaries
- Normalize embeddings: For cosine similarity search
- Batch requests: More efficient than one-by-one
- Cache embeddings: Avoid recomputing for static content
- Use Voyage AI for Claude apps: Recommended by Anthropic
Don'ts
- Don't ignore token limits: Truncation loses information
- Don't mix embedding models: Incompatible vector spaces
- Don't skip preprocessing: Garbage in, garbage out
- Don't over-chunk: Lose important context
- Don't forget metadata: Essential for filtering and debugging
常见问题
什么是 embedding?
它是文本的数值表示,让计算机能够比较词语和短语的含义,并理解其意思。
什么是“分块”(chunking)?
它是把一段长文本切分成更小片段的过程,让 AI 能够更好地处理和理解每一部分。
为什么选择合适的模型很重要?
不同的模型适合处理不同类型的文本(比如代码、金融资料等),如果选错了模型,AI 可能会误解信息。
详情
作者的原始描述
Select and optimize embedding models for semantic search and RAG applications. Use when choosing embedding models, implementing chunking strategies, or optimizing embedding quality for specific domains.
repo: wshobson/agents
热度
- GitHub 星标
- 41k
- 排名
- #6720
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …