similarity-search-patterns
यह क्या करती है
यह टूल बड़े डेटा में मिलती-जुलती जानकारी खोजने में मदद करता है, जैसे किसी विशाल कैटलॉग में 'मिलते-जुलते आइटम' ढूँढना। यह इसके लिए उन्नत तरीके इस्तेमाल करता है, जो तेज़ और कारगर होते हैं।
कब इस्तेमाल करें
- ✓जब आप ऐसा सर्च सिस्टम बनाना चाहते हैं जो आपके सवाल का मतलब समझे।
- ✓जब दस्तावेज़ों के आधार पर सवालों के जवाब देने वाला सिस्टम बना रहे हों।
- ✓उत्पादों या कंटेंट के लिए पर्सनलाइज़्ड सुझाव बनाने के लिए।
Skill का लिंक
https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/similarity-search-patterns/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“वीगन खाने के बारे में इस टेक्स्ट से मिलते-जुलते दस्तावेज़ खोजो।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
अंदर से यह आपके डेटा को संख्याओं (vectors) में बदलता है और गणितीय तरीकों से पता लगाता है कि कौन सी संख्याएँ एक-दूसरे के सबसे करीब हैं। फिर इन्हें खास इंडेक्स में व्यवस्थित करता है, ताकि खोज बहुत तेज़ हो।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Similarity Search Patterns
Patterns for implementing efficient similarity search in production systems.
When to Use This Skill
- Building semantic search systems
- Implementing RAG retrieval
- Creating recommendation engines
- Optimizing search latency
- Scaling to millions of vectors
- Combining semantic and keyword search
Core Concepts
1. Distance Metrics
| Metric | Formula | Best For | | ------------------ | ------------------ | --------------------- | --- | -------------- | | Cosine | 1 - (A·B)/(‖A‖‖B‖) | Normalized embeddings | | Euclidean (L2) | √Σ(a-b)² | Raw embeddings | | Dot Product | A·B | Magnitude matters | | Manhattan (L1) | Σ | a-b | | Sparse vectors |
2. Index Types
┌─────────────────────────────────────────────────┐
│ Index Types │
├─────────────┬───────────────┬───────────────────┤
│ Flat │ HNSW │ IVF+PQ │
│ (Exact) │ (Graph-based) │ (Quantized) │
├─────────────┼───────────────┼───────────────────┤
│ O(n) search │ O(log n) │ O(√n) │
│ 100% recall │ ~95-99% │ ~90-95% │
│ Small data │ Medium-Large │ Very Large │
└─────────────┴───────────────┴───────────────────┘
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
- Use appropriate index - HNSW for most cases
- Tune parameters - ef_search, nprobe for recall/speed
- Implement hybrid search - Combine with keyword search
- Monitor recall - Measure search quality
- Pre-filter when possible - Reduce search space
Don'ts
- Don't skip evaluation - Measure before optimizing
- Don't over-index - Start with flat, scale up
- Don't ignore latency - P99 matters for UX
- Don't forget costs - Vector storage adds up
अक्सर पूछे जाने वाले सवाल
'distance metrics' क्या होते हैं?
ये गणितीय सूत्र हैं जो मापते हैं कि दो संख्या-समूह (vectors) एक-दूसरे से कितने 'दूर' या 'नज़दीक' हैं। इससे मिलती-जुलती जानकारी खोजने में मदद मिलती है।
'index types' क्या हैं?
ये डेटा को व्यवस्थित करने के अलग-अलग तरीके हैं, ताकि खोज तेज़ हो सके। कुछ ज़्यादा सटीक होते हैं, कुछ ज़्यादा तेज़, और हर एक अलग आकार के डेटा के लिए अच्छा होता है।
'hybrid search' क्या है?
यह मतलब-आधारित (semantic) खोज को सटीक कीवर्ड खोज के साथ मिलाना है। इससे ऐसे नतीजे मिलते हैं जो मतलब के हिसाब से भी सही हों और उनमें आपके लिखे शब्द भी हों।
जानकारी
लेखक का मूल विवरण
Implement efficient similarity search with vector databases. Use when building semantic search, implementing nearest neighbor queries, or optimizing retrieval performance.
repo: wshobson/agents
लोकप्रियता
- GitHub स्टार
- 41k
- रैंकिंग में स्थान
- #6726
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
screen-reader-testing
41kआपके एजेंट को screen readers का इस्तेमाल करके वेबसाइटों की जांच करने देता है, ताकि यह पक्का हो सके कि वे accessible हैं।
wcag-audit-patterns
41kआपके एजेंट को वेबसाइटों का accessibility audit करने और WCAG guidelines के हिसाब से समस्याएं ठीक करने में मदद करता है।
multi-reviewer-patterns
41kआपके एजेंट को कई code reviews को एक साथ चलाने देता है। यह एक जैसे findings हटाता है और सारी रिपोर्ट को एक जगह जोड़ता है।
parallel-debugging
41kआपके एजेंट को parallel जांच के साथ जटिल समस्याओं को debug करने और root cause analysis में मदद करता है।
मिलती-जुलती skills
pytorch-patterns
280kआपके एजेंट को machine learning models के लिए PyTorch इस्तेमाल करने में मदद करता है। कुशल model training के best practices लागू करता है और नतीजों को दोहराने लायक रखता है।
evm-token-decimals
280kयह आपके एजेंट को अलग-अलग blockchain networks पर decimal numbers की गलतियों से बचने में मदद करता है। यह transactions और calculations में token values सही रखने का ध्यान रखता है।
ito-inference
280kआपके एजेंट को AI models की उपलब्धता जाँचने देता है। यह compute request को तैयार model service से जोड़ता है।