fix(rag): register pgvector adapter on get_connection()#64
Merged
Conversation
rag.pipelines.filing_change_detection reads the c.embedding column from
Neon pgvector and feeds it to np.array(dtype=float32). Without the
pgvector.psycopg2 register_vector call on the connection, psycopg2 returns
the vector column as the raw stringified list ('[0.1, 0.2, ...]') and
np.array can't parse it, causing ValueError mid-ingestion.
Surfaced tonight during the 2026-04-19 RAG recovery run (--rag-only real
ingestion). Steps 1-4 wrote successfully (SEC filings, 8-Ks, Finnhub,
theses) but step 5 crashed on the first vector read:
ValueError: could not convert string to float:
'[-0.064141005,0.095089,0.07256067,...]'
Fix registers the pgvector type codecs per-connection (psycopg2 scopes
adapters to the connection, not globally). Adds pgvector>=0.2 to
requirements.txt — already a transitive dep of voyageai's ecosystem but
pinning explicitly now that we import from it.
Non-blocking fix: filing_change_detection output (rag/filing_changes/
latest.json) is not consumed by research Lambda or any other pipeline
today — it's an analytic output that flags "lazy filings" (consecutive
10-K/10-Q embeddings with change_score < 0.05). Fix closes a
silent-broken-since-day-one step-5 failure that's been returning non-zero
on every Saturday SF RAG run without breaking anything downstream.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Impact
Changes
Test plan
🤖 Generated with Claude Code