/** * Semantic / hybrid search orchestration. * * Wraps the Phase 1 `IndexerAdapter.search` with the embedding-generation * step. When `mode: "semantic" | "hybrid"`, this helper embeds the query * via the configured `EmbeddingProvider`, attaches the vector to the * `SearchRequest` as `query_embedding`, and delegates to the adapter. * * Callers that already have a query embedding (an upstream agent that * vectorized the user's intent) can skip embedding by passing * `query_embedding` directly — `executeSemanticSearch` honors a * caller-supplied vector and skips the embed call. * * See `docs/architecture/catalog-architecture.md` for the design. */ import type { IndexerAdapter, IndexerSlice, SearchRequest, SearchResults } from "@voyant-travel/catalog-contracts/indexer/contract"; import type { EmbeddingProvider } from "../embeddings/contract.js"; export interface SemanticSearchOptions { /** Adapter to query. */ adapter: IndexerAdapter; /** * Embedding provider — used to vectorize the query string when the mode * needs vectors. Optional: callers running pure-keyword searches can omit * this. `executeSemanticSearch` throws a clear error if mode is * `semantic` / `hybrid` and no provider is configured. */ embeddings?: EmbeddingProvider; /** The variant slice (vertical, locale, audience, market) to search. */ slice: IndexerSlice; /** The search request. `mode` controls keyword/hybrid/semantic blending. */ request: SearchRequest; } /** * Run a search request that may need a query embedding generated. * * Behavior by mode: * - `keyword` — adapter.search called directly; no embedding work. * - `hybrid` — query string is embedded (unless caller supplied * `query_embedding`), adapter blends keyword + vector * scores. * - `semantic` — query string is embedded, adapter does pure vector * similarity. (Engines that don't support pure-semantic * typically fall back to hybrid with the keyword weight * set very low.) * * Verifies adapter capabilities at runtime: requesting `semantic` / * `hybrid` against an adapter without `supportsVectorFields` throws * a clear error rather than silently degrading to keyword-only. */ export declare function executeSemanticSearch(options: SemanticSearchOptions): Promise; /** * Helper for callers (typically AI agents) that have already vectorized * a query upstream and want to bypass the embedding step entirely. The * vector is attached to the request as-is. */ export declare function executeBYOVectorSearch(options: { adapter: IndexerAdapter; slice: IndexerSlice; request: SearchRequest & { query_embedding: number[]; }; }): Promise;