基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mikailustuner/OmniRule --skill vector-db-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Bun runtime: HTTP server, file I/O, SQLite, test runner, package manager, bundler — all-in-one JS toolchain.
Clerk: Drop-in auth UI, Organizations, User management, JWT templates, webhooks, Next.js middleware integration.
Gelişmiş masaüstü, tarayıcı ve işletim sistemi kontrol yeteneği. Görsel (koordinat tabanlı) fare/klavye otomasyonu, DOM manipülasyonu, pencere yönetimi, gelişmiş dosya, ağ ve süreç yönetimini kapsar.
| name | vector-db-patterns |
| description | Vector Database: Embedding storage, semantic search, similarity metrics, RAG architectures. |
| triggers | {"extensions":[".py",".ts"],"directories":["vector/","embeddings/","rag/"],"keywords":["vector","embedding","pinecone","chroma","weaviate","milvus","qdrant","pgvector","faiss","semantic search"]} |
| auto_load_when | Building RAG systems or semantic search features |
| agent | ai-engineer |
| tools | ["Read","Write","Bash"] |
Focus: Embedding storage, semantic search, similarity, RAG
Which vector DB to use?
├── Scale: Small (<100K vectors) → Chroma, in-memory
├── Scale: Medium (100K-10M) → Pinecone, Weaviate, Qdrant
├── Scale: Large (10M+) → Milvus, Elasticsearch
│
├── Infrastructure:
│ ├── Cloud-native → Pinecone, Elasticsearch
│ ├── Self-hosted → Weaviate, Qdrant, Milvus
│ └── PostgreSQL extension → pgvector (if already using PG)
│
├── Features needed:
│ ├── Hybrid search (vector + keyword) → Weaviate, Elasticsearch
│ ├── Multi-tenancy → Pinecone, Milvus
│ └── Time-based filtering → Most support
│
└── Cost: Open source (Weaviate, Qdrant, pgvector) vs Managed (Pinecone)
Embedding Pipeline:
├── Text preprocessing
│ ├── Chunking strategy (fixed size, sentence, recursive)
│ ├── Chunk size: 256-512 tokens for semantic search
│ └── Overlap: 10-20% to preserve context
│
├── Embedding model selection
│ ├── General purpose → text-embedding-3-small, bge-small
│ ├── Code → codellama, codex
│ └── Multilingual → bge-m3, multilingual-e5
│
├── Batch processing
│ ├── Batch size: 100-1000 for efficiency
│ ├── Async processing for large datasets
│ └── Progress tracking for long jobs
│
└── Storage
├── Store raw text + embeddings
├── Metadata for filtering
└── Original source for citation
Semantic Search Flow:
├── Query preprocessing
│ ├── Same embedding model as indexing
│ ├── Clean, truncate if needed
│ └── (Optional) Query expansion
│
├── Vector search
│ ├── Top-K retrieval (k=3-10 for RAG)
│ ├── Similarity metric: Cosine (default), Dot, Euclidean
│ └── (Optional) Filtering by metadata
│
├── Reranking (optional but recommended)
│ ├── Cross-encoder reranking for accuracy
│ └── Re-rank top 20 to top 5
│
└── Post-processing
├── Extract source documents
└── Format for LLM context
RAG Variants:
├── Naive RAG
│ └── Retrieve → Pass directly to LLM
│ └── Simple but can retrieve irrelevant docs
│
├── Advanced RAG
│ ├── Query preprocessing (rewriting, expansion)
│ ├── Chunking optimization
│ ├── Hybrid search (vector + keyword)
│ └── Reranking
│
├── Modular RAG
│ ├── Routing (choose data source based on query)
│ ├── Fusion (combine multiple retrievers)
│ └── Memory (store conversation context)
│
└── Agentic RAG (LangChain/LlamaIndex agents)
├── Multi-step retrieval
├── Tool use (web search + DB)
└── Iteration until answer found
❌ Using wrong chunk size — too small loses context, too large adds noise
✅ Experiment with 256-1024 tokens, measure recall
❌ No metadata filtering — searching everything for every query
✅ Add filters (date, source, category) to reduce search space
❌ Same embedding model for all — code needs code model, text needs text model
✅ Choose model based on content type
❌ Storing only vectors — losing original text for citations
✅ Store original text + metadata alongside vector
❌ No fallback — search fails silently
✅ Fallback to keyword search or cached results
| Task | Solution | Note |
|---|---|---|
| Semantic search | Vector similarity (cosine) | Top-K retrieval |
| Hybrid search | Vector + BM25 | Weaviate, Elasticsearch |
| Reranking | Cross-encoder | Re-rank top-20 to top-5 |
| Filtering | Metadata + vector | Combine in query |
| Scaling | Sharding + replication | DB-specific |
| Cost optimization | Quantization | FP16 → INT8 → binary |