Add deno.lock file and refactor AI function to streamline OpenAI integration
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user