ruvector/npm/packages/postgres-cli/README.md
rUv ee40332ce1 fix(postgres): Resolve compilation errors and Docker build issues
- Fix simsimd Option/Result type mismatch in scaled_dot.rs
- Fix f32/f64 type conversions in poincare.rs and lorentz.rs
- Fix AVX512 missing wrapper functions by using AVX2 fallback
- Fix Vec<Vec<f32>> to JsonB for pgrx pg_extern compatibility
- Fix DashMap get() to get_mut() for mutable access
- Fix router.rs dereference for best_score comparison
- Update Dockerfile to copy pre-written SQL file for pgrx
- Simplify init.sql to use correct function names
- Add postgres-cli npm package for CLI tooling

All changes tested successfully in Docker with:
- Extension loads with AVX2 SIMD support (8 floats/op)
- Distance functions verified working
- PostgreSQL 16 container runs successfully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 01:17:50 +00:00

2.6 KiB

@ruvector/postgres-cli

Command-line interface for the RuVector PostgreSQL extension - an advanced AI vector database.

Installation

npm install -g @ruvector/postgres-cli

Quick Start

# Connect to your PostgreSQL database with RuVector extension
ruvector-pg -c "postgresql://user:pass@localhost:5432/mydb" info

# Install the extension
ruvector-pg install

# Create a vector table
ruvector-pg vector create embeddings --dim 384 --index hnsw

# Search vectors
ruvector-pg vector search embeddings --text "hello world" --top-k 10

Commands

Vector Operations

# Create vector table with HNSW index
ruvector-pg vector create <name> --dim <dimensions> --index <hnsw|ivfflat>

# Insert vectors from JSON file
ruvector-pg vector insert <table> --file vectors.json

# Search for similar vectors
ruvector-pg vector search <table> --query "[0.1, 0.2, ...]" --top-k 10 --metric cosine

Attention Mechanisms

# Compute attention
ruvector-pg attention compute --query "[...]" --keys "[[...]]" --values "[[...]]" --type scaled_dot

# List available attention types
ruvector-pg attention list-types

Graph Neural Networks

# Create GNN layer
ruvector-pg gnn create my_layer --type gcn --input-dim 384 --output-dim 128

# Forward pass
ruvector-pg gnn forward my_layer --features features.json --edges edges.json

Graph & Cypher

# Execute Cypher query
ruvector-pg graph query "MATCH (n:Person) RETURN n"

# Create node
ruvector-pg graph create-node --labels "Person,Developer" --properties '{"name": "Alice"}'

# Traverse graph
ruvector-pg graph traverse --start node123 --depth 3 --type bfs

Self-Learning

# Train from trajectories
ruvector-pg learning train --file trajectories.json --epochs 10

# Make prediction
ruvector-pg learning predict --input "[0.1, 0.2, ...]"

Benchmarking

# Run benchmarks
ruvector-pg bench run --type all --size 10000 --dim 384

# Generate report
ruvector-pg bench report --format table

Global Options

  • -c, --connection <string> - PostgreSQL connection string (default: postgresql://localhost:5432/ruvector)
  • -v, --verbose - Enable verbose output

Features

  • Vector Search: HNSW and IVFFlat indexes with cosine, L2, and inner product metrics
  • 39 Attention Mechanisms: Scaled dot-product, multi-head, flash, sparse, and more
  • Graph Neural Networks: GCN, GraphSAGE, GAT, GIN layers
  • Graph Operations: Cypher queries, BFS/DFS traversal
  • Self-Learning: ReasoningBank-based trajectory learning
  • Hyperbolic Embeddings: Poincaré and Lorentz models
  • Sparse Vectors: BM25 and SPLADE for hybrid search

License

MIT