/** * LlmTextSearchPlugin * * Adds a `text: String` field to `VectorNearbyInput` when the LLM plugin * is enabled. This allows clients to pass natural language text instead of * raw float vectors for similarity search — the plugin converts text to * vectors server-side using the configured embedder. * * This mirrors the graphile-postgis pattern where `WithinDistanceInput` * accepts a compound input (point + distance) and the plugin handles * the conversion to SQL internally. * * The `text` field is mutually exclusive with `vector`: clients provide * one or the other. When `text` is provided, the plugin embeds it and * injects the resulting vector into the normal pgvector pipeline. * * Runtime embedding for query filters uses the v4-style resolver wrapping * approach (same as graphile-upload-plugin). When a connection query's * `where` argument includes a VectorNearbyInput with `text`, the resolver * wrapper embeds the text and replaces it with the resulting vector before * the plan executes. * * If the embedder is not configured, the `text` field is still registered * (so the schema is stable) but will return a clear error at execution time. * * If the embedder returns null (e.g. quota exceeded when the metering * plugin is loaded), behavior depends on `onQuotaExceeded`: * - `'degrade'` (default): silently removes the text field and continues * with text-only search as a graceful fallback. * - `'throw'`: always throws an error, even if text adapters could handle it. */ import type { GraphileConfig } from 'graphile-config'; declare global { namespace GraphileConfig { interface Plugins { LlmTextSearchPlugin: true; } } } /** * Recursively walk a `where` argument object and embed any VectorNearbyInput * values that have `text` instead of `vector`. * * If the embedder returns null (e.g. quota exceeded), the text field is * removed so the pgvector filter is skipped — graceful text-only fallback. */ export declare function embedTextInWhere(obj: any, embedder: (text: string) => Promise, hasTextAdapters: boolean, onQuotaExceeded?: 'degrade' | 'throw'): Promise; /** * Creates the LlmTextSearchPlugin. * * Hooks into VectorNearbyInput to add a `text` field alongside the * existing `vector` field. When a user provides `text`, the plugin's * resolver wrapper embeds it before passing to pgvector. */ export declare function createLlmTextSearchPlugin(options?: { onQuotaExceeded?: 'degrade' | 'throw'; }): GraphileConfig.Plugin;