feat: add @toon-format/toon dependency and integrate into OpenAI notebooks
- Updated deno.lock and package.json to include @toon-format/toon@^2.1.0. - Modified background-openai.ipynb to handle error responses and adjust execution counts. - Enhanced definitions-openai.ipynb to include additional metadata for perishables and origen schemas. - Refactored embeddings-openai.ipynb to improve error handling and output formatting. - Updated create-chat-conversation function to append messages and responses to conversations. - Added SQL functions for appending conversation data to the database.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "bb61ec88",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -19,7 +19,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "8baca5f2",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -32,7 +32,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 7,
|
||||
"id": "26b3bb36",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -55,28 +55,36 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 21,
|
||||
"execution_count": 9,
|
||||
"id": "8abb080e",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\u001b[32m\"e39952c1-a53b-43bf-8033-feda493a0651\"\u001b[39m"
|
||||
"{\n",
|
||||
" message: \u001b[32m\"TypeError: error sending request for url (http://127.0.0.1:54321/rest/v1/planes_estudio?select=*): client error (Connect): tcp connect error: No se puede establecer una conexión ya que el equipo de destino denegó expresamente dicha conexión. (os error 10061)\"\u001b[39m,\n",
|
||||
" details: \u001b[32m\"TypeError: error sending request for url (http://127.0.0.1:54321/rest/v1/planes_estudio?select=*): client error (Connect): tcp connect error: No se puede establecer una conexión ya que el equipo de destino denegó expresamente dicha conexión. (os error 10061)\\n\"\u001b[39m +\n",
|
||||
" \u001b[32m\" at async mainFetch (ext:deno_fetch/26_fetch.js:192:12)\\n\"\u001b[39m +\n",
|
||||
" \u001b[32m\" at async fetch (ext:deno_fetch/26_fetch.js:475:11)\\n\"\u001b[39m +\n",
|
||||
" \u001b[32m\" at async <anonymous>:2:31\"\u001b[39m,\n",
|
||||
" hint: \u001b[32m\"\"\u001b[39m,\n",
|
||||
" code: \u001b[32m\"\"\u001b[39m\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"execution_count": 21,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"plan.id"
|
||||
"error"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 22,
|
||||
"execution_count": 12,
|
||||
"id": "a382bdc6",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -84,9 +92,9 @@
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{\n",
|
||||
" id: \u001b[32m\"resp_0f1906be7e83879e00699895d7f1cc8193a960e6ccdab1d377\"\u001b[39m,\n",
|
||||
" id: \u001b[32m\"resp_0ae72cbd0894279200699c8e42941c8192ba4a09e280b21a17\"\u001b[39m,\n",
|
||||
" object: \u001b[32m\"response\"\u001b[39m,\n",
|
||||
" created_at: \u001b[33m1771607511\u001b[39m,\n",
|
||||
" created_at: \u001b[33m1771867714\u001b[39m,\n",
|
||||
" status: \u001b[32m\"queued\"\u001b[39m,\n",
|
||||
" background: \u001b[33mtrue\u001b[39m,\n",
|
||||
" completed_at: \u001b[1mnull\u001b[22m,\n",
|
||||
@@ -130,15 +138,12 @@
|
||||
" truncation: \u001b[32m\"disabled\"\u001b[39m,\n",
|
||||
" usage: \u001b[1mnull\u001b[22m,\n",
|
||||
" user: \u001b[1mnull\u001b[22m,\n",
|
||||
" metadata: {\n",
|
||||
" tabla: \u001b[32m\"planes_estudio\"\u001b[39m,\n",
|
||||
" id: \u001b[32m\"e39952c1-a53b-43bf-8033-feda493a0651\"\u001b[39m\n",
|
||||
" },\n",
|
||||
" metadata: { tabla: \u001b[32m\"planes_estudio\"\u001b[39m, id: \u001b[32m\"2\"\u001b[39m },\n",
|
||||
" output_text: \u001b[32m\"\"\u001b[39m\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"execution_count": 22,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
@@ -150,7 +155,7 @@
|
||||
" input: \"Hola mundo\",\n",
|
||||
" metadata: {\n",
|
||||
" tabla: \"planes_estudio\",\n",
|
||||
" id: plan.id,\n",
|
||||
" id: '2',\n",
|
||||
" },\n",
|
||||
" text: {\n",
|
||||
" format: {\n",
|
||||
@@ -183,7 +188,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 23,
|
||||
"execution_count": 13,
|
||||
"id": "6b2470ed",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
@@ -200,13 +205,13 @@
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{\n",
|
||||
" id: \u001b[32m\"resp_0f1906be7e83879e00699895d7f1cc8193a960e6ccdab1d377\"\u001b[39m,\n",
|
||||
" id: \u001b[32m\"resp_0ae72cbd0894279200699c8e42941c8192ba4a09e280b21a17\"\u001b[39m,\n",
|
||||
" object: \u001b[32m\"response\"\u001b[39m,\n",
|
||||
" created_at: \u001b[33m1771607511\u001b[39m,\n",
|
||||
" created_at: \u001b[33m1771867714\u001b[39m,\n",
|
||||
" status: \u001b[32m\"completed\"\u001b[39m,\n",
|
||||
" background: \u001b[33mtrue\u001b[39m,\n",
|
||||
" billing: { payer: \u001b[32m\"developer\"\u001b[39m },\n",
|
||||
" completed_at: \u001b[33m1771607519\u001b[39m,\n",
|
||||
" completed_at: \u001b[33m1771867721\u001b[39m,\n",
|
||||
" error: \u001b[1mnull\u001b[22m,\n",
|
||||
" frequency_penalty: \u001b[33m0\u001b[39m,\n",
|
||||
" incomplete_details: \u001b[1mnull\u001b[22m,\n",
|
||||
@@ -216,12 +221,12 @@
|
||||
" model: \u001b[32m\"gpt-5-mini-2025-08-07\"\u001b[39m,\n",
|
||||
" output: [\n",
|
||||
" {\n",
|
||||
" id: \u001b[32m\"rs_0f1906be7e83879e00699895d976548193ad40e9aae0b1b4f2\"\u001b[39m,\n",
|
||||
" id: \u001b[32m\"rs_0ae72cbd0894279200699c8e43cd4c8192bcbc70792b6aa621\"\u001b[39m,\n",
|
||||
" type: \u001b[32m\"reasoning\"\u001b[39m,\n",
|
||||
" summary: []\n",
|
||||
" },\n",
|
||||
" {\n",
|
||||
" id: \u001b[32m\"msg_0f1906be7e83879e00699895ddf62881938811097ba62e8724\"\u001b[39m,\n",
|
||||
" id: \u001b[32m\"msg_0ae72cbd0894279200699c8e48976481928e1f205210636717\"\u001b[39m,\n",
|
||||
" type: \u001b[32m\"message\"\u001b[39m,\n",
|
||||
" status: \u001b[32m\"completed\"\u001b[39m,\n",
|
||||
" content: [\n",
|
||||
@@ -229,7 +234,7 @@
|
||||
" type: \u001b[32m\"output_text\"\u001b[39m,\n",
|
||||
" annotations: [],\n",
|
||||
" logprobs: [],\n",
|
||||
" text: \u001b[32m'{\"ai-message\":\"¡Hola! ¿Cómo puedo ayudarte hoy? Si te refieres al clásico “Hola mundo” en programación, puedo mostrarte ejemplos en varios lenguajes, explicar su historia o ayudarte a crear tu primer programa. ¿Qué prefieres?\",\"suggested-topic\":\"El uso del programa “Hola mundo” como herramienta pedagógica en la enseñanza de la programación: impacto en la comprensión inicial, variaciones por lenguaje y mejores prácticas didácticas.\"}'\u001b[39m\n",
|
||||
" text: \u001b[32m'{\"ai-message\":\"¡Hola! ¿En qué puedo ayudarte hoy? Puedo mostrar ejemplos de \\\\\"Hola mundo\\\\\" en distintos lenguajes, explicar conceptos de programación, ayudar con una tarea o sugerir recursos. Dime qué prefieres.\",\"suggested-topic\":\"El papel del programa \\\\\"Hola Mundo\\\\\" en la enseñanza de la programación: comparación práctica entre Python, Java y C (sintaxis, tiempo de arranque, facilidad de aprendizaje y percepción del estudiante).\"}'\u001b[39m\n",
|
||||
" }\n",
|
||||
" ],\n",
|
||||
" role: \u001b[32m\"assistant\"\u001b[39m\n",
|
||||
@@ -268,20 +273,17 @@
|
||||
" usage: {\n",
|
||||
" input_tokens: \u001b[33m167\u001b[39m,\n",
|
||||
" input_tokens_details: { cached_tokens: \u001b[33m0\u001b[39m },\n",
|
||||
" output_tokens: \u001b[33m437\u001b[39m,\n",
|
||||
" output_tokens: \u001b[33m482\u001b[39m,\n",
|
||||
" output_tokens_details: { reasoning_tokens: \u001b[33m320\u001b[39m },\n",
|
||||
" total_tokens: \u001b[33m604\u001b[39m\n",
|
||||
" total_tokens: \u001b[33m649\u001b[39m\n",
|
||||
" },\n",
|
||||
" user: \u001b[1mnull\u001b[22m,\n",
|
||||
" metadata: {\n",
|
||||
" tabla: \u001b[32m\"planes_estudio\"\u001b[39m,\n",
|
||||
" id: \u001b[32m\"e39952c1-a53b-43bf-8033-feda493a0651\"\u001b[39m\n",
|
||||
" },\n",
|
||||
" output_text: \u001b[32m'{\"ai-message\":\"¡Hola! ¿Cómo puedo ayudarte hoy? Si te refieres al clásico “Hola mundo” en programación, puedo mostrarte ejemplos en varios lenguajes, explicar su historia o ayudarte a crear tu primer programa. ¿Qué prefieres?\",\"suggested-topic\":\"El uso del programa “Hola mundo” como herramienta pedagógica en la enseñanza de la programación: impacto en la comprensión inicial, variaciones por lenguaje y mejores prácticas didácticas.\"}'\u001b[39m\n",
|
||||
" metadata: { tabla: \u001b[32m\"planes_estudio\"\u001b[39m, id: \u001b[32m\"2\"\u001b[39m },\n",
|
||||
" output_text: \u001b[32m'{\"ai-message\":\"¡Hola! ¿En qué puedo ayudarte hoy? Puedo mostrar ejemplos de \\\\\"Hola mundo\\\\\" en distintos lenguajes, explicar conceptos de programación, ayudar con una tarea o sugerir recursos. Dime qué prefieres.\",\"suggested-topic\":\"El papel del programa \\\\\"Hola Mundo\\\\\" en la enseñanza de la programación: comparación práctica entre Python, Java y C (sintaxis, tiempo de arranque, facilidad de aprendizaje y percepción del estudiante).\"}'\u001b[39m\n",
|
||||
"}"
|
||||
]
|
||||
},
|
||||
"execution_count": 23,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user