//#region src/core/ai/embeddings.d.ts /** Default Workers AI text-embedding model. `bge-base-en-v1.5` is a small, * inexpensive 768-dimension English model—a good default for short CMS page * text. A Vectorize index must be created with the SAME dimensions + a `cosine` * metric (`wrangler vectorize create … --dimensions=768 --metric=cosine`). * Overridable per call so a site can swap models (create a matching index). */ declare const DEFAULT_EMBEDDING_MODEL = "@cf/baai/bge-base-en-v1.5"; /** * How a BGE English v1.5 model turns its token vectors into one text vector. * `"mean"` averages them, and it's what Workers AI does when you don't ask. * `"cls"` takes the first token's vector, the pooling BGE was trained with. * * The two give different vectors for the same text, so the vectors you store * and the queries you search them with have to use the same pooling. Only * `"cls"` gives the same vector for a text whether it's embedded alone or in a * batch; see {@link embedMany}. */ type EmbeddingPooling = "mean" | "cls"; interface EmbedOptions { /** Embedding model id. Default {@link DEFAULT_EMBEDDING_MODEL}. */ model?: string; /** Route through AI Gateway (#87)—caching, cost caps, fallbacks, logging. */ gateway?: AiGatewayOptions; /** * The pooling to ask a BGE English v1.5 model for. Omit it for Workers AI's * default, `"mean"`, or for a model that doesn't take the option. Use the * same value when you index and when you search. */ pooling?: EmbeddingPooling; } /** * Embed a single text into a dense vector via Workers AI. Best-effort: returns * `null` when the runner is absent (binding not provisioned), the input is * blank, or the model errors / returns an unexpected shape—so a caller keeps * its non-semantic fallback (the FTS result set). Never throws. * * Text-embedding models return `{ shape, data }` where `data` is an array of * per-input vectors; single-input callers want `data[0]`. A bare `number[]` (or * `{ embedding }`) is tolerated too so a model swap doesn't need a code change. */ declare function embed(runner: AiRunner | undefined, text: string, opts?: EmbedOptions): Promise; /** How many texts {@link embedMany} sends in one call by default. Workers AI's * BGE embedding models accept up to 100 inputs per request. */ declare const EMBED_MANY_BATCH = 100; interface EmbedManyOptions extends EmbedOptions { /** Texts per Workers AI call when `pooling` is `"cls"`. Default * {@link EMBED_MANY_BATCH}; lower it for a model that takes fewer inputs per * request. A positive integer. With any other pooling, each text gets its * own call. */ batchSize?: number; } /** * Embed many texts, returning the vectors {@link embed} would return for each * one. Use it for bulk work, such as backfilling a collection's vectors; * {@link embed} stays the call for a single text. * * With `pooling: "cls"`, it sends up to {@link EmbedManyOptions.batchSize} * texts in each Workers AI call. With mean pooling, Workers AI's default, it * sends one text per call, because a batch changes a text's vector: a short * text batched with a longer one comes back measurably different from the same * text embedded alone, and matches its queries less well. So to embed in * batches, index and search with `pooling: "cls"`. * * Returns one entry per input, in input order: the text's vector, or `null` * when the text is blank or its batch failed. Best-effort like the rest of * `core/ai`, so it never throws. A batch fails as a whole when the runner is * absent, the call errors, or the response doesn't hold exactly one vector per * text, and the caller can retry just the `null` entries. * * @example * ```ts * import { embedMany } from "louise-toolkit/ai"; * * const texts = rows.map((row) => row.body); * const vectors = await embedMany(env.AI, texts); * const failed = texts.filter((_, i) => vectors[i] === null); * ``` * * @throws {RangeError} When `batchSize` isn't a positive integer. That's a * programming error, not a runtime failure, so it isn't swallowed. */ declare function embedMany(runner: AiRunner | undefined, texts: readonly string[], opts?: EmbedManyOptions): Promise<(number[] | null)[]>; /** A value Vectorize accepts in a vector's metadata—JSON primitives plus a * string array (mirrors workers-types' `VectorizeVectorMetadata`, kept * hand-defined so this module isn't pinned to a workers-types version). Typed * precisely (not `unknown`) so the real `VectorizeIndex` binding is structurally * assignable to {@link VectorIndex} under `strictFunctionTypes`. */ type VectorMetadataValue = string | number | boolean | string[]; /** One record in a {@link VectorIndex}. `id` is unique across the whole index * (Vectorize ids are global, not per-namespace); see {@link contentVectorId}. */ interface VectorRecord { id: string; values: number[]; /** Optional query-scoping partition (we set it to the collection slug). */ namespace?: string; metadata?: Record; } /** One hit from {@link VectorIndex.query}: the record id and its similarity score. */ interface VectorMatch { id: string; score: number; } /** Options for a {@link VectorIndex.query}. A structural subset of workers-types' * `VectorizeQueryOptions`: only the fields these helpers set. */ interface VectorQueryOptions { topK?: number; namespace?: string; } /** * The capability the semantic helpers need from a Vectorize binding: `upsert`, * `query`, and `deleteByIds`. Hand-defined (method syntax, so the real * `env.VECTORIZE` binding satisfies it structurally without a cast—same * precedent as {@link AiRunner}); a test double is just an object with these * three methods. Mutation methods return `unknown` because the async-mutation * receipt Vectorize returns is never inspected here. */ interface VectorIndex { upsert(vectors: VectorRecord[]): Promise; query(vector: number[], options?: VectorQueryOptions): Promise<{ matches: VectorMatch[]; }>; deleteByIds(ids: string[]): Promise; } /** Compose the globally-unique Vectorize id for a content row—`${namespace}:${id}`, * so multiple collections can share one index without id collisions. Paired * with the record's `namespace` for query scoping. */ declare function contentVectorId(namespace: string, id: number): string; /** Recover the numeric row id from a {@link contentVectorId}, or `null` if the * id doesn't carry a numeric suffix (a foreign record sharing the index). */ declare function parseContentVectorId(vectorId: string): number | null; interface IndexContentOptions extends EmbedOptions { /** Extra metadata stored on the vector (the collection slug + row id are * always included so a match can be mapped back without re-embedding). * Values must be Vectorize primitives—see {@link VectorMetadataValue}. */ metadata?: Record; } /** * Embed `text` and upsert it into `index` under the row's {@link contentVectorId}. * Best-effort → returns `true` on a successful upsert, `false` when the index is * absent, the embed yields nothing, or either call errors—so an embed-on-publish * caller never fails the publish over a missing/erroring binding. `namespace` is * the collection slug: it scopes queries and namespaces the stored vector. */ declare function indexContent(index: VectorIndex | undefined, runner: AiRunner | undefined, namespace: string, id: number, text: string, opts?: IndexContentOptions): Promise; /** One row for {@link indexContents}. */ interface IndexContentItem { id: number; text: string; /** Extra metadata for this row's vector, merged over the call's `metadata`. */ metadata?: Record; } /** * The batch form of {@link indexContent}: embed many rows with * {@link embedMany} and upsert their vectors in bulk. With `pooling: "cls"`, a * backfill of a whole collection makes one Workers AI call per 100 rows * instead of one per row; search it with the same pooling. * Returns the IDs whose vectors were stored. A row whose text is blank or * whose embedding failed is left out, and so is every row in an upsert that * errors. Best-effort, so it never throws. */ declare function indexContents(index: VectorIndex | undefined, runner: AiRunner | undefined, namespace: string, items: readonly IndexContentItem[], opts?: IndexContentOptions & Pick): Promise; /** * Remove a content row's vector from `index` (its counterpart to * {@link indexContent}—call it when a row is unpublished or deleted). * Best-effort: no-ops without an index and swallows a delete error. */ declare function removeContentVector(index: VectorIndex | undefined, namespace: string, id: number): Promise; interface SemanticSearchOptions extends EmbedOptions { /** Max matches to return. Default 20. */ topK?: number; /** * Drop any match whose score is below this floor, so a query that matches * nothing returns nothing instead of the `topK` least-distant records. On a * `cosine` index the score is a similarity, where higher is closer. No * default: omit it to keep every match. A useful floor depends on the model * and the content, so measure one against real queries before you set it. */ minScore?: number; } /** * Semantic search over one collection's vectors: embed `query`, ask `index` for * the nearest `namespace`-scoped records, and return each hit's numeric row id + * score, best-first. Best-effort → `[]` when the index/runner is absent, the * query embeds to nothing, or the query errors, so a caller falls back cleanly * to keyword results. Matches whose id doesn't parse to a numeric row id (a * foreign record) are skipped, as are matches scored below `opts.minScore` * when it's set. * * PRIVACY—this is the one Louise path that sends *visitor*-supplied text off * the origin: the search query is embedded by Workers AI (a Cloudflare * first-party binding, not a third party) before the vector lookup. Editor * content going to the AI helpers is expected; a visitor's query may not be, so * disclose it if your privacy policy enumerates processors. Omit the `index`/ * runner and search stays entirely local (keyword FTS). */ declare function semanticSearch(index: VectorIndex | undefined, runner: AiRunner | undefined, namespace: string, query: string, opts?: SemanticSearchOptions): Promise<{ id: number; score: number; }[]>; //#endregion //#region src/core/ai/fusion.d.ts /** RRF's rank-damping constant. 60 is the canonical default (Cormack et al.); * a larger value flattens the contribution of top ranks, a smaller one * sharpens it. Override it per call with {@link FuseRankingsOptions.k}. */ declare const RRF_K = 60; /** One ranked input to {@link fuseRankings}. */ interface RankedList { /** IDs ordered best-first. A repeated ID counts only at its first position. */ ids: readonly Id[]; /** How much this list counts relative to the others: its contribution to * every ID's score is multiplied by it. A finite, non-negative number; * default 1. Use it to trust one retriever more than another, for example * `2` on a curated list and `1` on a broad one. */ weight?: number; } /** Options for {@link fuseRankings}. */ interface FuseRankingsOptions { /** The rank-damping constant. A finite, non-negative number; default * {@link RRF_K}. */ k?: number; /** Return at most this many IDs, applied after fusion and boosting. A * non-negative integer; omit it to return every ID. */ limit?: number; /** * A per-ID multiplier on the fused score, for a signal that belongs to the * document rather than to any one list, such as an authority or freshness * weight. Called once for each distinct ID; return a finite, non-negative * number, where 1 leaves the score unchanged. Omit it to leave every score * as fused. */ boost?: (id: Id) => number; } /** * Fuse ranked ID lists with Reciprocal Rank Fusion and return the IDs * best-first. * * An ID's score is the sum, over every list it appears in, of * `weight / (k + rank)`, with a 1-indexed rank. An ID ranked high in _any_ list * surfaces, and one ranked in several is lifted above one ranked in a single * list, all without comparing the lists' native scores. `boost`, when given, * then multiplies each ID's fused score. IDs with equal scores order by ID * (numbers ascending, strings by UTF-16 code unit, numbers before strings), so * the result is deterministic whatever order the lists arrive in. * * **Why a list of lists.** Hybrid search is rarely exactly two retrievers: * keyword and vector today, a title-only or tag index tomorrow. One array of * `{ ids, weight }` takes any number of lists, keeps each weight next to the * list it applies to, and reads the same for two lists as for five. IDs are * generic, so numeric row IDs and string document keys both work unchanged. * * **Why `boost` is an option.** The result carries no scores, so a caller * can't reweight it afterward without guessing at the gaps between ranks. A * per-document signal has to meet the fused score before sorting and before * `limit` trims the tail, and that happens here. * * @example * ```ts * import { fuseRankings } from "louise-toolkit/ai"; * * // Keyword hits from FTS5 and semantic hits from Vectorize, keyed by * // document slug and ordered best-first. * const keyword = ["pricing", "faq", "about"]; * const semantic = ["faq", "plans", "pricing"]; * const authority = new Map([["plans", 1.5]]); * * const top = fuseRankings([{ ids: keyword }, { ids: semantic, weight: 0.8 }], { * boost: (slug) => authority.get(slug) ?? 1, * limit: 10, * }); * ``` * * @throws {RangeError} When `k`, a `weight`, or a `boost` result isn't a * finite, non-negative number, or `limit` isn't a non-negative integer. */ declare function fuseRankings(lists: readonly RankedList[], options?: FuseRankingsOptions): Id[]; //#endregion //#region src/core/ai/index.d.ts /** The one capability these helpers need from a Workers AI binding: `run(model, * inputs)`. `env.AI` satisfies this structurally—pass it directly. Hand-defined * (rather than importing the workers-types `Ai` generic) so the module stays * catalog-agnostic; a test double is just `{ run }`. */ interface AiRunner { run(model: string, inputs: Record, options?: Record): Promise; } /** The env members the generation kill switch reads. Structural, so a caller's * own `CloudflareEnv` satisfies it without importing anything. */ interface AiEnv { AI?: AiRunner; /** Deploy-time kill switch for AI **generation**. See {@link aiRunner}. */ LOUISE_AI?: string; } /** * Whether this deploy has turned AI generation off by choice. * * Takes `unknown` rather than `AiEnv`: the routes are generic over their own * `Env`, and constraining every one of them to know about a var only this module * reads would push a Workers AI detail through signatures that have nothing to do * with it. Reading one string defensively is the smaller cost. */ declare function aiGenerationDisabled(env: unknown): boolean; /** * The runner to hand a generation route—the binding, unless this deploy has * turned generation off. * * ```ts * aiRoute({ resolveEditor, ai: aiRunner }) * ``` * * **One definition, not four.** Every consumer reached the runner through its * own `ai: (env) => env.AI`, so a flag expressed at each call site would be four * chances to get it wrong—and a kill switch you don't trust is worse than none. * * **`LOUISE_AI` cannot turn AI on.** It only ever subtracts: with no binding * there is nothing to enable, which keeps the env var a ceiling rather than a * second source of truth. * * **Embeddings are deliberately NOT gated by this.** They power site search and * generate no content, so folding them in would mean "disable AI writing" * silently breaks search—a consequence nobody predicts from the flag's name, * surfacing as "search returns nothing" long after the flag was flipped. A site * that genuinely wants everything off can still unprovision the binding. * * Takes `unknown` for the same reason {@link aiGenerationDisabled} does, and it * matters more here: this is passed *as* a route's `ai` accessor, whose parameter * is that route's own `Env`. An `AiEnv` parameter shares no properties with an * `EditorRouteEnv`, so TypeScript rejects the assignment outright—the helper * would be typed to describe the env it reads and unusable in the one position it * exists for. */ declare function aiRunner(env: unknown): AiRunner | undefined; /** * Why a generation route has no runner—so "off by choice" and "never * configured" can read differently. * * Both produce a 503 and both hide the button, which is right for an * unprovisioned binding: there is nothing to tell the editor about. It is wrong * for a deliberate opt-out, where the honest answer is "AI assists are turned off * for this site" rather than a control that quietly isn't there. */ declare function aiUnavailableReason(env: unknown): "disabled" | "unconfigured"; /** * Why an AI call gave nothing usable (ADR 0022 § 8): * * - `unavailable`: no binding, or Workers AI refused the account or timed out. * - `model-retired`: the model ID no longer exists. Change the model. * - `rate-limited`: capacity or the daily allocation ran out. Try again later. * - `invalid-output`: the model answered, but with nothing usable, such as an * empty reply or JSON that doesn't parse. * - `truncated`: the output token cap cut the answer off. * - `error`: anything else. */ type AiFailureReason = "unavailable" | "model-retired" | "rate-limited" | "invalid-output" | "truncated" | "error"; /** Called once with the reason when a helper returns `null` for a failure. * Blank input isn't a failure, so it doesn't call this. */ type AiFailureListener = (reason: AiFailureReason) => void; /** * Sort a thrown Workers AI error into an {@link AiFailureReason}, from the * error codes and messages Workers AI documents. A `status` of 429 counts as * `rate-limited`. It never throws. */ declare function classifyAiError(err: unknown): "unavailable" | "model-retired" | "rate-limited" | "error"; /** * Run a model best-effort: returns its raw output, or `null` when `runner` is * absent (binding not provisioned) or the call throws. **Never throws**—AI is * an assist, never a gate—so callers wire it inline and keep their non-AI * fallback (empty alt, the original prose, no SEO suggestion). * * A thrown error is reported with `reportDegraded` as `ai.run.`, such * as `ai.run.model-retired`, where the reason is {@link classifyAiError}'s. */ declare function runAi(runner: AiRunner | undefined, model: string, inputs: Record, options?: Record): Promise; /** Token counts a model reported for one call. A count the model didn't report * is `null`. */ interface AiUsage { /** Tokens in the prompt. */ promptTokens: number | null; /** Tokens the model generated. */ completionTokens: number | null; /** Prompt and completion together. */ totalTokens: number | null; } /** A text generation's answer, and how it ended. */ interface AiTextResult { /** The model's raw output, for a caller that reads more than the text, such as * a JSON-mode object. */ output: unknown; /** The generated text, or `null` when the output carries none. */ text: string | null; /** * Whether the output token cap cut the answer off. `true` when the model * reports a finish reason of `length` or `max_tokens`, or when it generated at * least the `max_tokens` requested. Workers AI doesn't always report a finish * reason, so the token count is the check that always runs. */ truncated: boolean; /** The finish reason as the model reported it, or `null` when it reported none. */ finishReason: string | null; /** Token counts, or `null` when the model reported none. */ usage: AiUsage | null; } /** * Run a text-generating model best-effort, and report whether the output cap * cut its answer off. * * The same contract as {@link runAi}: `null` when `runner` is absent or the call * throws, and it never throws. Otherwise it returns the text along with * `truncated`, read from `inputs.max_tokens` and what the model reported. A * truncated answer is reported with `reportDegraded` as `ai.truncated`, with the * model ID, so it shows in `wrangler tail` and an `onDegraded` listener hears it. * * Check `truncated` before you store or show the text. A cut-off answer reads as * complete until someone notices that it stops mid-sentence. */ declare function runAiText(runner: AiRunner | undefined, model: string, inputs: Record, options?: Record): Promise; /** * Route a Workers AI call through [AI Gateway](https://developers.cloudflare.com/ai-gateway/) * (#87). Passed to `run` as `options.gateway`, so a gateway `id` puts response * caching (identical prompts are free on repeat), cost caps / rate limits, * provider fallback, retries, and request logging in front of every call—without * changing this module's contract. Omit it and calls go direct. * Hand-defined (a subset of workers-types' `GatewayOptions`) to stay decoupled. */ interface AiGatewayOptions { /** The AI Gateway id (created in the Cloudflare dashboard or via the API). */ id: string; /** Custom cache key. Gateway caching already keys on the full request (model + * inputs), so identical calls dedupe by default; set this only to *widen* a * cache entry (for example, a content hash) across incidental request variance. */ cacheKey?: string; /** Cache TTL in seconds. Caching is on by default; `0` disables it. */ cacheTtl?: number; /** Skip the cache for this call (force a fresh model run). */ skipCache?: boolean; } /** Default vision model for {@link generateAltText}—image bytes + a prompt in, * a text `description` out. Overridable per call so a site can swap models * without a code change here. */ declare const DEFAULT_ALT_TEXT_MODEL = "@cf/llava-hf/llava-1.5-7b-hf"; /** Alt text should be short—long descriptions defeat the purpose for screen * readers. Trimmed to this many characters (with an ellipsis). */ declare const MAX_ALT_TEXT_LENGTH = 240; /** What's known about where an image appears, so alt text can say what it's * for, not only what it shows (#599). */ interface AltTextContext { /** The page it appears on. */ pageTitle?: string; /** The nearest heading above it. */ heading?: string; /** Its caption. */ caption?: string; /** Where it links, for a linked image: its alt text should say where the * link goes, since that's what a screen reader user needs. */ href?: string; } interface AltTextOptions { /** Vision model id. Default {@link DEFAULT_ALT_TEXT_MODEL}. */ model?: string; /** Where the image appears, folded into the prompt. Upload knows none of * this, so it's omitted there; the backfill passes the caption. */ context?: AltTextContext; /** Prompt sent with the image. Default asks for one concise sentence. */ prompt?: string; /** Output token cap. Default 128 (alt text is short). */ maxTokens?: number; /** Route through AI Gateway (#87)—caching, cost caps, fallbacks, logging. */ gateway?: AiGatewayOptions; /** Hears why, when it returns `null` for a failure. */ onFailure?: AiFailureListener; } /** * Generate concise alt text for an image via Workers AI. Best-effort: returns * `null` when the runner is absent, the model errors, it yields no text, or the * output cap cut its answer off—the caller keeps its empty-alt fallback, which an * editor can fill in by hand. A cut-off caption is refused rather than stored, * because tidying makes half a sentence look finished. The result is tidied: * whitespace-collapsed, common "an image of…" lead-ins stripped, sentence-cased, * and length-capped ({@link MAX_ALT_TEXT_LENGTH}). */ declare function generateAltText(runner: AiRunner | undefined, image: ArrayBuffer | Uint8Array | number[], opts?: AltTextOptions): Promise; /** Default instruct model for {@link rewriteText} and {@link suggestSeo}. * Overridable per call so a site can swap models without a code change. * Was `@cf/meta/llama-3.1-8b-instruct`, retired by Workers AI (EOL 2026-05-30); * bumped to the current Llama 3.3 fp8-fast build so the assists keep working. */ declare const DEFAULT_TEXT_MODEL = "@cf/meta/llama-3.3-70b-instruct-fp8-fast"; /** How {@link rewriteText} should transform the passage. */ type RewriteMode = "tighten" | "rephrase" | "simplify" | "fix"; /** The four rewrite modes, in menu order—export so a toolbar can list them. */ declare const REWRITE_MODES: readonly RewriteMode[]; /** The default output token cap for {@link rewriteText}. */ declare const REWRITE_MAX_TOKENS = 512; /** * The longest passage, in characters, that {@link REWRITE_MAX_TOKENS} leaves * room to rewrite: 1,536, a few paragraphs. The editor's rewrite route refuses a * longer selection with a `413`. * * Sized from the output cap, because a rewrite runs about as long as its input. * English averages about four characters per token, so budgeting three per token * keeps a typical passage near three-quarters of the cap, and leaves headroom for * a rewrite that comes back longer than it went in. A passage past the cap spends * tokens on an answer that comes back cut off, and {@link rewriteText} refuses a * cut-off answer. */ declare const REWRITE_MAX_CHARS: number; /** A before-and-after pair that shows the model the site's voice. */ interface RewriteExample { before: string; after: string; } interface RewriteOptions { /** How to transform the text. Default `"tighten"`. */ mode?: RewriteMode; /** * The site's voice, audience, and locale, in plain words, appended to the * fixed prompt: "Warm and plain. Readers are neighbors, not experts. British * English." No default. */ instructions?: string; /** One or two before-and-after pairs in the site's voice, sent as example * turns ahead of the text. Past two, the rest are ignored. */ examples?: readonly RewriteExample[]; /** Instruct model id. Default {@link DEFAULT_TEXT_MODEL}. */ model?: string; /** Output token cap. Default {@link REWRITE_MAX_TOKENS}. */ maxTokens?: number; /** Route through AI Gateway (#87)—caching, cost caps, fallbacks, logging. */ gateway?: AiGatewayOptions; /** Hears why, when it returns `null` for a failure. */ onFailure?: AiFailureListener; } declare function rewriteText(runner: AiRunner | undefined, text: string, opts?: RewriteOptions): Promise; /** A suggested SEO title + meta description. Either field may be `null` when the * model didn't produce a usable value. */ interface SeoSuggestion { title: string | null; description: string | null; } interface SeoOptions { /** The site's voice, audience, and locale, appended to the fixed prompt, as * for {@link RewriteOptions.instructions}. No default. */ instructions?: string; model?: string; maxTokens?: number; /** Max chars of `content` sent to the model (keeps the prompt bounded). Default 4000. */ maxContentChars?: number; /** Route through AI Gateway (#87)—caching, cost caps, fallbacks, logging. */ gateway?: AiGatewayOptions; /** Hears why, when it returns `null` for a failure. */ onFailure?: AiFailureListener; } /** * Suggest an SEO title + meta description from page content via Workers AI. * Best-effort: `null` when the runner is absent, the content is blank, the output * cap cut the reply off, or the reply can't be parsed as the expected JSON. * Fields are length-capped, and a missing/empty field becomes `null` (a result * with neither is `null` overall). */ declare function suggestSeo(runner: AiRunner | undefined, content: string, opts?: SeoOptions): Promise; //#endregion export { removeContentVector as $, FuseRankingsOptions as A, IndexContentOptions as B, aiUnavailableReason as C, runAi as D, rewriteText as E, EMBED_MANY_BATCH as F, VectorQueryOptions as G, VectorIndex as H, EmbedManyOptions as I, embed as J, VectorRecord as K, EmbedOptions as L, RankedList as M, fuseRankings as N, runAiText as O, DEFAULT_EMBEDDING_MODEL as P, parseContentVectorId as Q, EmbeddingPooling as R, aiRunner as S, generateAltText as T, VectorMatch as U, SemanticSearchOptions as V, VectorMetadataValue as W, indexContent as X, embedMany as Y, indexContents as Z, RewriteMode as _, AiRunner as a, SeoSuggestion as b, AltTextContext as c, DEFAULT_TEXT_MODEL as d, semanticSearch as et, MAX_ALT_TEXT_LENGTH as f, RewriteExample as g, REWRITE_MODES as h, AiGatewayOptions as i, RRF_K as j, suggestSeo as k, AltTextOptions as l, REWRITE_MAX_TOKENS as m, AiFailureListener as n, AiTextResult as o, REWRITE_MAX_CHARS as p, contentVectorId as q, AiFailureReason as r, AiUsage as s, AiEnv as t, DEFAULT_ALT_TEXT_MODEL as u, RewriteOptions as v, classifyAiError as w, aiGenerationDisabled as x, SeoOptions as y, IndexContentItem as z };