AgentDB Vector Search
БесплатноБез исполняемых скриптовНе проверенImplement semantic vector search with AgentDB for intelligent document retrieval, similarity matching, and context-aware querying. Use when building RAG…
от proffesor-for-testing★ 537 звёзд на GitHubОб этом скилле
AgentDB Vector Search
What This Skill Does
Implements vector-based semantic search using AgentDB's high-performance vector database with 150x-12,500x faster operations than traditional solutions. Features HNSW indexing, quantization, and sub-millisecond search (<100µs).
Prerequisites
- Node.js 18+
- AgentDB v1.0.7+ (via agentic-flow or standalone)
- OpenAI API key (for embeddings) or custom embedding model
Quick Start with CLI
Initialize Vector Database
# Initialize with default dimensions (1536 for OpenAI ada-002)
npx [email protected] init ./vectors.db
# Custom dimensions for different embedding models
npx [email protected] init ./vectors.db --dimension 768 # sentence-transformers
npx [email protected] init ./vectors.db --dimension 384 # all-MiniLM-L6-v2
# Use preset configurations
npx [email protected] init ./vectors.db --preset small # <10K vectors
npx [email protected] init ./vectors.db --preset medium # 10K-100K vectors
npx [email protected] init ./vectors.db --preset large # >100K vectors
# In-memory database for testing
npx [email protected] init ./vectors.db --in-memory
Query Vector Database
# Basic similarity search
npx [email protected] query ./vectors.db "[0.1,0.2,0.3,...]"
# Top-k results
npx [email protected] query ./vectors.db "[0.1,0.2,0.3]" -k 10
# With similarity threshold (cosine similarity)
npx [email protected] query ./vectors.db "0.1 0.2 0.3" -t 0.75 -m cosine
# Different distance metrics
npx [email protected] query ./vectors.db "[...]" -m euclidean # L2 distance
npx [email protected] query ./vectors.db "[...]" -m dot # Dot product
# JSON output for automation
npx [email protected] query ./vectors.db "[...]" -f json -k 5
# Verbose output with distances
npx [email protected] query ./vectors.db "[...]" -v
Import/Export Vectors
# Export vectors to JSON
npx [email protected] export ./vectors.db ./backup.json
# Import vectors from JSON
npx [email protected] import ./backup.json
# Get database statistics
npx [email protected] stats ./vectors.db
Quick Start with API
import { createAgentDBAdapter, computeEmbedding } from 'agentic-flow/reasoningbank';
// Initialize with vector search optimizations
const adapter = await createAgentDBAdapter({
dbPath: '.agentdb/vectors.db',
enableLearning: false, // Vector search only
enableReasoning: true, // Enable semantic matching
quantizationType: 'binary', // 32x memory reduction
cacheSize: 1000, // Fast retrieval
});
// Store document with embedding
const text = "The quantum computer achieved 100 qubits";
const embedding = await computeEmbedding(text);
await adapter.insertPattern({
id: '',
type: 'document',
domain: 'technology',
pattern_data: JSON.stringify({
embedding,
text,
metadata: { category: "quantum", date: "2025-01-15" }
}),
confidence: 1.0,
usage_count: 0,
success_count: 0,
created_at: Date.now(),
last_used: Date.now(),
});
// Semantic search with MMR (Maximal Marginal Relevance)
const queryEmbedding = await computeEmbedding("quantum computing advances");
const results = await adapter.retrieveWithReasoning(queryEmbedding, {
domain: 'technology',
k: 10,
useMMR: true, // Diverse results
synthesizeContext: true, // Rich context
});
Core Features
1. Vector Storage
// Store with automatic embedding
await db.storeWithEmbedding({
content: "Your document text",
metadata: { source: "docs", page: 42 }
});
2. Similarity Search
// Find similar documents
const similar = await db.findSimilar("quantum computing", {
limit: 5,
minScore: 0.75
});
3. Hybrid Search (Vector + Metadata)
// Combine vector similarity with metadata filtering
const results = await db.hybridSearch({
query: "machine learning models",
filters: {
category: "research",
date: { $gte: "2024-01-01" }
},
limit: 20
});
Advanced Usage
RAG (Retrieval Augmented Generation)
// Build RAG pipeline
async function ragQuery(question: string) {
// 1. Get relevant context
const context = await db.searchSimilar(
await embed(question),
{ limit: 5, threshold: 0.7 }
);
// 2. Generate answer with context
const prompt = `Context: ${context.map(c => c.text).join('\n')}
Question: ${question}`;
return await llm.generate(prompt);
}
Batch Operations
// Efficient batch storage
await db.batchStore(documents.map(doc => ({
text: doc.content,
embedding: doc.vector,
metadata: doc.meta
})));
MCP Server Integration
# Start AgentDB MCP server for Claude Code
npx [email protected] mcp
# Add to Claude Code (one-time setup)
claude mcp add agentdb npx [email protected] mcp
# Now use MCP tools in Claude Code:
# - agentdb_query: Semantic vector search
# - agentdb_store: Store documents with embeddings
# - agentdb_stats: Database statistics
Performance Benchmarks
# Run comprehensive benchmarks
n
Установить AgentDB Vector Search в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл AgentDB Vector Search?
Implement semantic vector search with AgentDB for intelligent document retrieval, similarity matching, and context-aware querying. Use when building RAG systems, semantic search engines, or intelligent knowledge bases.
Как установить скилл AgentDB Vector Search?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл AgentDB Vector Search запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic