Skip to main content

README

title: GOFA AI Overview sidebar_label: Overview description: Overview of GOFA AI intelligent services and RAG Chatbot API grouping.

GOFA AI provides intelligent health assistant capabilities centered on Retrieval‑Augmented Generation (RAG). All responses are required to be grounded in retrieved content, avoiding hallucination.

The first publicly available endpoints are the RAG Chatbot API (/api/rag-chatbot) and its accompanying text-to-speech endpoint (/api/rag-chatbot/tts). This section will:

Quick Navigation
  • RAG Chatbot API – Interactive retrieval-augmented health consultation
  • Upcoming features (planned): Personalized risk summaries, adaptive rehabilitation suggestions, explainability metrics, etc.

Core Design Principles

PrincipleDescription
Grounded ResponsesAnswers must cite retrieved document content, no speculation
Language AdaptationChinese input responds in "Cantonese colloquial"; English input responds in concise professional English
Safety ComplianceEach response includes a medical disclaimer, not a substitute for professional advice
Scope RestrictionNon-health-related questions are politely redirected and constrained
TraceabilityResponses end with source document titles listed as references
Streaming FirstDefault to SSE streaming output for improved perceived response speed

Endpoint Overview

CategoryEndpointDescription
Chat CompletionPOST /api/rag-chatbotRAG streaming/single-shot responses (with source sentinel)
(Accompanying) TTSPOST /api/rag-chatbot/ttsSynthesizes speech from response text (explained separately)
  1. The client first obtains a Firebase ID Token (corresponding to your user).
  2. Send POST /api/rag-chatbot, preferably without ?format=json to experience streaming.
  3. The frontend concatenates text-delta incrementally, waits for the final source sentinel => separates answer and sources.
  4. If speech is needed, call the TTS endpoint after obtaining the final clean text (removing the sentinel segment).
  5. Store the answer, source list, model, and timestamp in conversation records (to avoid re-parsing raw text).

Versions and Compatibility

ComponentStatusNotes
Modelgemini-2.5-flashMay adjust with GCP upgrades, check release notes
Source SentinelStablePattern: \n[__SOURCE_FILES__] + JSON array
JSON ModeStableSuitable for batch, export, or atomic result scenarios

For new features or adjustments, please include use cases and expected behavior when submitting an issue to facilitate evaluation.