File size: 1,132 Bytes
eab050b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { pgTable, serial, text, real, jsonb, timestamp, bigint } from "drizzle-orm/pg-core";
import { createInsertSchema } from "drizzle-zod";
import { z } from "zod/v4";

export const rasaAnalysesTable = pgTable("rasa_analyses", {
  id: serial("id").primaryKey(),
  text: text("text").notNull(),
  rasa_name: text("rasa_name").notNull(),
  rasa_confidence: real("rasa_confidence").notNull(),
  rasa_explanation: text("rasa_explanation").notNull(),
  hallucination_score: real("hallucination_score").notNull(),
  hallucination_severity: text("hallucination_severity").notNull(),
  hallucination_problematic_statements: jsonb("hallucination_problematic_statements").$type<string[]>().notNull().default([]),
  summary: text("summary").notNull(),
  timestamp: bigint("timestamp", { mode: "number" }).notNull(),
  created_at: timestamp("created_at").defaultNow().notNull(),
});

export const insertRasaAnalysisSchema = createInsertSchema(rasaAnalysesTable).omit({ id: true, created_at: true });
export type InsertRasaAnalysis = z.infer<typeof insertRasaAnalysisSchema>;
export type RasaAnalysis = typeof rasaAnalysesTable.$inferSelect;