similarity-search-patterns
實作相似性搜尋模式
建置快速語意搜尋既複雜又容易出錯。此技能提供適用於常見向量資料庫和混合檢索方法的經過驗證的範本。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「similarity-search-patterns」。 Explain how to implement hybrid search with Qdrant
預期結果:
- Use a dense vector query with optional filters for metadata.
- Add sparse or keyword signals by managing payload fields.
- Balance relevance by tuning limit and score threshold parameters.
- Consider enabling quantization for memory efficiency at scale.
正在使用「similarity-search-patterns」。 What index type should I use for 10 million vectors?
預期結果:
- Consider HNSW for balanced speed and recall at this scale.
- Configure ef_search between 100-500 based on latency requirements.
- Monitor recall metrics to tune search parameters.
- For very large datasets, evaluate IVF+PQ for memory efficiency.
正在使用「similarity-search-patterns」。 Show me a Pinecone reranking pattern
預期結果:
- Over-fetch initial results (50-100) using vector search.
- Pass query and top results to cross-encoder for scoring.
- Reorder final results by cross-encoder scores.
- Limit final output to top_k based on relevance requirements.
安全審計
安全This skill contains only documentation and code templates for implementing vector search. No executable code, file access, or network operations are performed by the skill itself. The static analyzer detected patterns in documentation examples and mathematical formulas that triggered false positive security alerts. All detected 'network', 'external_commands', and 'env_access' patterns are documentation artifacts, not actual malicious code.
風險因素
🌐 網路存取 (8)
⚙️ 外部命令 (9)
🔑 環境變數 (3)
品質評分
你能建構什麼
新增向量搜尋 API
使用 Pinecone、Qdrant、pgvector 或 Weaviate 建立向量搜尋層。
擴充檢索索引
為大規模相似性搜尋工作負載選擇索引類型和參數。
改善 RAG 品質
實作混合搜尋和重新排序,以提升檢索增強生成中的相關性。
試試這些提示
為 500 萬個向量且延遲低於 100 毫秒的情況推薦索引類型,並說明取捨。
草擬一個具有 upsert 和搜尋方法的 Pinecone 向量儲存類別,並說明所需參數。
展示一個結合向量相似性和全文搜尋的 pgvector 混合搜尋查詢,並支援權重控制。
在向量搜尋後使用交叉編碼器新增重新排序步驟,並說明流程。
最佳實務
- 在調整索引參數之前先測量召回率和延遲
- 對模糊查詢使用混合搜尋以獲得更好的相關性
- 批次執行 upsert 以減少 API 開銷和營運成本
避免
- 跳過評估只依賴預設參數
- 對小型資料集過度索引,而平面搜尋已足夠
- 忽略可以減少搜尋空間的中繼資料過濾器