Files
duocthu/apps/ai-service/migrations/001_rag_retrieval_trace.sql

15 lines
468 B
SQL

CREATE TABLE IF NOT EXISTS rag_retrieval_trace (
trace_id uuid PRIMARY KEY,
query_text text NOT NULL,
subject_scope text NOT NULL,
query_intent text NOT NULL,
decision text NOT NULL,
reason text NOT NULL,
resolved_drug_id text,
citations jsonb NOT NULL DEFAULT '[]'::jsonb,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS rag_retrieval_trace_created_at_idx
ON rag_retrieval_trace (created_at DESC);