AI Search Infra Ports
This module guide covers the provider-neutral semantic infrastructure boundary introduced for AI Search PR6.
For the cross-cutting AI Search architecture, rollout gates, and risk controls, start with AI Search Architecture.
Files
src/lib/search/ai/providers/EmbeddingProvider.ts.src/lib/search/ai/providers/SemanticIndexPort.ts.src/lib/search/ai/providers/types.ts.src/lib/search/ai/providers/fail-soft.ts.src/lib/search/ai/providers/factory.ts.src/lib/search/ai/providers/openai-embedding-provider.ts.src/lib/search/ai/providers/weaviate-semantic-index.ts.src/lib/search/ai/retrieval/openai-grounded-answer.ts.src/lib/search/ai/retrieval/grounded-answer-service.ts.
Goals
- Keep the embedding provider replaceable.
- Keep the vector backend replaceable.
- Keep grounded answer generation replaceable and explicitly gated.
- Make semantic infrastructure fail soft so later search routes can fall back to standard search instead of failing hard.
- Keep all runtime behavior disabled unless explicit AI infra configuration exists.
Contracts
EmbeddingProvider
- Accepts provider-neutral
EmbeddingRequestvalues. - Returns
EmbeddingResultwithstatus: "success" | "disabled" | "unavailable". - Does not throw infrastructure failures across the public boundary when wrapped by the fail-soft adapter.
SemanticIndexPort