@deepnote/blocks
Advanced tools
+23
-0
@@ -105,2 +105,3 @@ //#region rolldown:runtime | ||
| const executableBlockTypes = new Set([ | ||
| "agent", | ||
| "code", | ||
@@ -329,2 +330,11 @@ "sql", | ||
| }); | ||
| const agentBlockSchema = zod.z.object({ | ||
| ...executableBlockFields, | ||
| type: zod.z.literal("agent"), | ||
| content: zod.z.string().optional(), | ||
| metadata: executableBlockMetadataSchema.extend({ | ||
| deepnote_variable_name: zod.z.string().optional(), | ||
| deepnote_agent_model: zod.z.string().optional() | ||
| }).default({}) | ||
| }); | ||
| const bigNumberBlockSchema = zod.z.object({ | ||
@@ -440,2 +450,3 @@ ...executableBlockFields, | ||
| textCellCalloutBlockSchema, | ||
| agentBlockSchema, | ||
| codeBlockSchema, | ||
@@ -776,2 +787,13 @@ sqlBlockSchema, | ||
| //#endregion | ||
| //#region src/blocks/agent-blocks.ts | ||
| function createPythonCodeForAgentBlock(block) { | ||
| const prompt = block.content ?? ""; | ||
| if (!prompt.trim()) return "# [agent block] (empty system prompt)"; | ||
| return `# [agent block] System prompt:\n${prompt.split("\n").map((line) => `# ${line}`).join("\n")}`; | ||
| } | ||
| function isAgentBlock(block) { | ||
| return block.type === "agent"; | ||
| } | ||
| //#endregion | ||
| //#region src/blocks/python-utils.ts | ||
@@ -1195,2 +1217,3 @@ function escapePythonString(value) { | ||
| function createPythonCode(block, executionContext) { | ||
| if (isAgentBlock(block)) return createPythonCodeForAgentBlock(block); | ||
| if (isCodeBlock(block)) return createPythonCodeForCodeBlock(block); | ||
@@ -1197,0 +1220,0 @@ if (isSqlBlock(block)) return createPythonCodeForSqlBlock(block); |
+23
-0
@@ -79,2 +79,3 @@ import { z } from "zod"; | ||
| const executableBlockTypes = new Set([ | ||
| "agent", | ||
| "code", | ||
@@ -303,2 +304,11 @@ "sql", | ||
| }); | ||
| const agentBlockSchema = z.object({ | ||
| ...executableBlockFields, | ||
| type: z.literal("agent"), | ||
| content: z.string().optional(), | ||
| metadata: executableBlockMetadataSchema.extend({ | ||
| deepnote_variable_name: z.string().optional(), | ||
| deepnote_agent_model: z.string().optional() | ||
| }).default({}) | ||
| }); | ||
| const bigNumberBlockSchema = z.object({ | ||
@@ -414,2 +424,3 @@ ...executableBlockFields, | ||
| textCellCalloutBlockSchema, | ||
| agentBlockSchema, | ||
| codeBlockSchema, | ||
@@ -750,2 +761,13 @@ sqlBlockSchema, | ||
| //#endregion | ||
| //#region src/blocks/agent-blocks.ts | ||
| function createPythonCodeForAgentBlock(block) { | ||
| const prompt = block.content ?? ""; | ||
| if (!prompt.trim()) return "# [agent block] (empty system prompt)"; | ||
| return `# [agent block] System prompt:\n${prompt.split("\n").map((line) => `# ${line}`).join("\n")}`; | ||
| } | ||
| function isAgentBlock(block) { | ||
| return block.type === "agent"; | ||
| } | ||
| //#endregion | ||
| //#region src/blocks/python-utils.ts | ||
@@ -1169,2 +1191,3 @@ function escapePythonString(value) { | ||
| function createPythonCode(block, executionContext) { | ||
| if (isAgentBlock(block)) return createPythonCodeForAgentBlock(block); | ||
| if (isCodeBlock(block)) return createPythonCodeForCodeBlock(block); | ||
@@ -1171,0 +1194,0 @@ if (isSqlBlock(block)) return createPythonCodeForSqlBlock(block); |
+1
-1
| { | ||
| "name": "@deepnote/blocks", | ||
| "version": "4.3.0", | ||
| "version": "4.4.0", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2657599
4.8%27123
4.59%