/** * GraphileLlmPreset * * A preset that bundles all LLM plugins for PostGraphile v5. * This is the recommended entry point — add it to your preset's `extends` array. * * When enabled, this preset: * - Resolves an embedder from configuration (llm_module, env vars, or preset options) * - Adds a `text: String` field to `VectorNearbyInput` for text-based vector search * - Adds `{column}Text: String` companion fields on mutation inputs for vector columns * - Optionally enables billing/metering via the LlmMeteringPlugin * * Included in ConstructivePreset when `enableLlm` is true (the default). * Can also be used standalone by adding it directly to your preset's `extends` array. * * @example * ```typescript * import { GraphileLlmPreset } from 'graphile-llm'; * * const preset = { * extends: [ * ConstructivePreset, * GraphileLlmPreset(), * ], * }; * ``` * * @example With explicit embedder configuration: * ```typescript * import { GraphileLlmPreset } from 'graphile-llm'; * * const preset = { * extends: [ * ConstructivePreset, * GraphileLlmPreset({ * defaultEmbedder: { * provider: 'ollama', * model: 'nomic-embed-text', * baseUrl: 'http://localhost:11434', * }, * }), * ], * }; * ``` * * @example With billing metering (opt-in, meter slug = model name by default): * ```typescript * GraphileLlmPreset({ * defaultEmbedder: { provider: 'openai', model: 'text-embedding-3-small' }, * metering: true, * // → embedding calls metered under 'text-embedding-3-small' meter slug * // → three-level waterfall: text-embedding-3-small → inference pool → universal * }) * ``` * * @example With strict quota enforcement (fail if embedding unavailable): * ```typescript * GraphileLlmPreset({ * defaultEmbedder: { provider: 'openai', model: 'text-embedding-3-small' }, * metering: true, * onQuotaExceeded: 'throw', * // → if billing quota is exceeded, queries with unifiedSearch throw an error * // → without this, queries silently fall back to text-only search * }) * ``` * * @example With custom entity_id resolution (bill per-database): * ```typescript * GraphileLlmPreset({ * defaultEmbedder: { provider: 'openai', model: 'text-embedding-3-small' }, * metering: { * resolveEntityId: (pgSettings) => pgSettings['jwt.claims.database_id'], * }, * }) * ``` */ import type { GraphileConfig } from 'graphile-config'; import type { GraphileLlmOptions } from './types'; /** * Creates a preset that includes all LLM plugins. * * @param options - Configuration options for the LLM plugin * @returns A GraphileConfig.Preset to add to your extends array */ export declare function GraphileLlmPreset(options?: GraphileLlmOptions): GraphileConfig.Preset; export default GraphileLlmPreset;