Add deno.lock file and refactor AI function to streamline OpenAI integration

This commit is contained in:
2026-01-13 11:10:41 -06:00
parent f037e31896
commit 411e0f2154
3 changed files with 44 additions and 54 deletions
+1 -37
View File
@@ -16,43 +16,7 @@ try {
const response = await supabase.functions.invoke("ai-structured", {
body: {
response: {
model: "gpt-5",
input: [
{ role: "system", content: "Responde SIEMPRE en JSON válido." },
{ role: "user", content: "Dame 3 ideas de proyecto de IA para educación." },
],
/* conversation: "conv_...", */ // opcional
},
structured: {
type: "json_schema",
name: "ideas",
strict: true,
schema: {
type: "object",
properties: {
ideas: {
type: "array",
items: {
type: "object",
properties: {
titulo: { type: "string" },
descripcion: { type: "string" }
},
required: ["titulo", "descripcion"],
additionalProperties: false
}
}
},
required: ["ideas"],
additionalProperties: false
}
},
references: {
/* vectorStoreIds: ["vs_..."], */ // opcional (file_search) ✅
/* openaiFileIds: ["file_..."], */ // opcional (input_file) ✅
},
usarMCP: false, // opcional ✅
query: "Escribe un poema sobre la primavera en español",
},
});
console.log({ d: response.data, e: response.error });