Vector semantic search

From jpcaparas/superpowers-laravel · View interactive version

Vector semantic search is an AI agent skill from the GitHub repository jpcaparas/superpowers-laravel. Add semantic search with native vector queries (Laravel 13+); pgvector similarity clauses, embedding workflows, and hybrid search patterns

How to use this skill

Skill file

Semantic / Vector Search (Laravel 13+)

Use native vector query support to build semantic search on PostgreSQL + pgvector. Generate embeddings via the AI SDK and query them directly from the query builder.

Commands

# Migration: vector column (requires pgvector extension)
Schema::table('documents', function (Blueprint $table) {
    $table->vector('embedding', dimensions: 1536);
});

# Generate an embedding
use Illuminate\Support\Str;
$embedding = Str::of('Best wineries in Napa Valley')->toEmbeddings();

# Similarity search from the query builder
$documents = DB::table('documents')
    ->whereVectorSimilarTo('embedding', 'Best wineries in Napa Valley')
    ->limit(10)
    ->get();

Patterns

Testing

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.