Files
genesis-2/testers/ai-structured-files.ts
T

25 lines
755 B
TypeScript

import { supabase } from "./new-user";
const file = Bun.file("files/carta.pdf");
await supabase.auth.signInWithPassword({
email: "guillermo.arrieta@lasalle.mx",
password: "admin",
});
const fd = new FormData();
fd.append("payload", JSON.stringify({
response: { input: "Resume estos documentos en JSON.", model: "gpt-5" },
structured: { type: "json_schema", name: "resumen", strict: true, schema: {
type: "object", properties: { resumen: { type: "string" } }, required: ["resumen"], additionalProperties: false
} },
storage: { prefix: "tmp" },
}));
fd.append("files", file);
const response = await supabase.functions.invoke("ai-structured", {
method: "POST",
body: fd,
});
console.log({ d: response.data, e: response.error });