ActiveRecord neighbor vector search, with per-document max

I am doing LLM RAG with rails ActiveRecord, postgres with the pgvector extension for vector similarity searches, and the neighbor gem. I am fairly new to all of this stuff, figuring it out by doing it. I realized that for a particular use, I wanted to get some document diversity so i wanted to Continue reading ActiveRecord neighbor vector search, with per-document max