Skip to content

fix(graphile-llm): require exactly one of vector or text on VectorNearbyInput - #1955

Merged
pyramation merged 2 commits into
mainfrom
fix/vector-nearby-exactly-one
Nov 4, 2026
Merged

pyramation merged 2 commits into
mainfrom
fix/vector-nearby-exactly-one

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

VectorNearbyInput now takes exactly one of vector or text. Sending both, or neither, is a plan-time error with a message that says which; before, a client-sent vector silently won over text. Sending text with no embedding provider configured is also an error instead of a silently dropped filter. unifiedSearch and the {column}Text mutation companions are unchanged.

New graphql/server-test/__tests__/vector-text-search.integration.test.ts runs this through the routed server over HTTP (so GraphQL validation applies) against a local stand-in for the Ollama /api/embed endpoint: { text } ranks the matching row first, { vector } still works without calling the embedder, neither and both are rejected.

Link to Devin session: https://app.devin.ai/sessions/5ad1f8a49a8240e6baddcb4df99396e6
Open in Devin Desktop: https://app.devin.ai/desktop/session/5ad1f8a49a8240e6baddcb4df99396e6?variant=devin
Requested by: @pyramation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@luxor-code-review

luxor-code-review Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 2 nitpicks below.

🧹 Nitpicks (2) — 🟢 2 low
  • 🟢 Nearby input contract tightened: both/neither now error (embed-inputs.ts:165) — applyRule for the nearby kind now throws when both text and vector are provided, or when text is provided without a configured embedder (graphile/graphile-llm/src/embed-inputs.ts:165-181); previously the vector silently won and missing text was a silent no-op when embed was null.
  • 🟢 Update stale no-embedder docs and log (text-search-plugin.ts:20) — The plugin header still says 'If no embedder is configured, text is ignored' (graphile/graphile-llm/src/plugins/text-search-plugin.ts:20-22) and the finalize hook logs the same message (graphile/graphile-llm/src/plugins/text-search-plugin.ts:209-212), but the new behavior in embed-inputs.ts:176-181 throws text needs an embedding provider and none is configured.

This PR wires text-search entities into embedding-based vector search: embed-inputs.ts embeds query/text inputs through a configurable provider, and text-search-plugin.ts tightens unifiedSearch filtering so queries supply either a vector or text (not both/neither), embedding text at plan time and ranking by cosine distance. An integration test spins up a local stand-in embedder server and a new seed fixture adds a vector_text_search.articles table with a vector(3) column.

Files Change
graphile/graphile-llm/src/embed-inputs.ts Embeds input text via configurable provider; errors when both/neither vector and text are supplied.
graphile/graphile-llm/src/plugins/text-search-plugin.ts Applies embedded vectors to unified search filtering with cosine ranking.
graphile/graphile-llm/src/__tests__/embed-inputs.test.ts Unit tests for the embedding pipeline and XOR input validation.
graphql/server-test/__tests__/vector-text-search.integration.test.ts End-to-end search test using a local Ollama-style embedder stand-in.
graphql/server-test/__fixtures__/seed/vector-text-search/schema.sql Seeds vector_text_search.articles table with pgvector column and grants.

Reviewed commit: a20df3d

@pyramation
pyramation merged commit ad78358 into main Nov 4, 2026
19 checks passed
@pyramation
pyramation deleted the fix/vector-nearby-exactly-one branch November 4, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant