AI Search Grounded Answers
This module guide covers the PR12 grounded Ask AI slice layered on top of the existing semantic indexing and retrieval stack.
For the cross-cutting AI Search architecture, rollout gates, and risk controls, start with AI Search Architecture.
Files
src/app/api/search/ask/route.ts.src/lib/search/ai/retrieval/http.ts.src/lib/search/ai/retrieval/grounded-answer-service.ts.src/lib/search/ai/retrieval/openai-grounded-answer.ts.src/lib/search/ai/retrieval/index-coverage.ts.src/hooks/useAskAi.ts.src/components/search/AskAiCard.tsx.src/hooks/useAiSearchAvailability.ts.src/hooks/useAiSearchUiState.ts.
Public Contract
POST /api/search/ask
Request body:
{
"question": "What do the indexed design docs say about citations?",
"services": ["google"],
"accountIds": ["google-account-1"]
}
Response envelope data:
{
"status": "answered",
"answer": "Grounded answer text",
"citations": [
{
"resourceId": "file-1",
"resourceName": "Design Doc",
"service": "google",
"accountId": "google-account-1",
"accountLabel": "user@example.com (Business)",
"snippet": "Grounded evidence excerpt"
}
],
"citationCount": 1,
"grounded": true,
"indexCoverage": "partial",
"reason": null
}
Safe no-answer responses use:
status: "no_answer".answer: null.citations: [].grounded: false.