GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(wand): add json-array generation type for array-contract fields · simstudioai/sim@d5ede2e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/sim
    • app/api/wand
      • route.ts
    • blocks
      • blocks
        • snowflake.ts
      • types.ts
    • lib/wand
      • strip-code-fences.test.ts
      • strip-code-fences.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/sim/app/api/wand/route.ts‎

Copy file name to clipboardExpand all lines: apps/sim/app/api/wand/route.ts
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,13 @@ export const POST = withRouteHandler(async (req: NextRequest) => {
339339
'\n\nIMPORTANT: Return ONLY the raw JSON object. Do NOT wrap it in markdown code blocks (no ```json or ```). Do NOT include any explanation or text before or after the JSON. The response must start with { and end with }.'
340340
}
341341

342+
// Separate from json-object: that reinforcement demands braces, which would
343+
// fight a field whose contract is an array.
344+
if (generationType === 'json-array') {
345+
finalSystemPrompt +=
346+
'\n\nIMPORTANT: Return ONLY the raw JSON array. Do NOT wrap it in markdown code blocks (no ```json or ```). Do NOT include any explanation or text before or after the JSON. The response must start with [ and end with ].'
347+
}
348+
342349
const messages: ChatMessage[] = [{ role: 'system', content: finalSystemPrompt }]
343350

344351
messages.push(...history.filter((msg) => msg.role !== 'system'))
Collapse file

‎apps/sim/blocks/blocks/snowflake.ts‎

Copy file name to clipboardExpand all lines: apps/sim/blocks/blocks/snowflake.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ export const SnowflakeBlock: BlockConfig<SnowflakeStatementResponse> = {
431431
prompt:
432432
'Generate a non-empty JSON array of flat row objects. Every row must have the same keys. Use Load Data instead for bulk ingestion from staged files. Return ONLY the JSON array - no explanations, no extra text.',
433433
placeholder: 'Describe the records to write...',
434-
generationType: 'json-object',
434+
generationType: 'json-array',
435435
},
436436
},
437437
{
@@ -446,7 +446,7 @@ export const SnowflakeBlock: BlockConfig<SnowflakeStatementResponse> = {
446446
prompt:
447447
'Generate a JSON array containing the row column names that uniquely match target records, for example ["tenant_id","id"]. Return ONLY the JSON array - no explanations, no extra text.',
448448
placeholder: 'Describe the columns that identify a row...',
449-
generationType: 'json-object',
449+
generationType: 'json-array',
450450
},
451451
},
452452
{
@@ -781,7 +781,7 @@ export const SnowflakeBlock: BlockConfig<SnowflakeStatementResponse> = {
781781
prompt:
782782
'Generate an ordered JSON array of Snowflake procedure bindings. Each item must contain a supported Snowflake binding type and a string value, for example {"type":"TEXT","value":"daily"}. Return ONLY the JSON array - no explanations, no extra text.',
783783
placeholder: 'Describe the procedure arguments in order...',
784-
generationType: 'json-object',
784+
generationType: 'json-array',
785785
},
786786
},
787787
{
Collapse file

‎apps/sim/blocks/types.ts‎

Copy file name to clipboardExpand all lines: apps/sim/blocks/types.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export type GenerationType =
181181
| 'typescript-function-body'
182182
| 'json-schema'
183183
| 'json-object'
184+
| 'json-array'
184185
| 'table-schema'
185186
| 'system-prompt'
186187
| 'custom-tool-schema'
Collapse file

‎apps/sim/lib/wand/strip-code-fences.test.ts‎

Copy file name to clipboardExpand all lines: apps/sim/lib/wand/strip-code-fences.test.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ describe('shouldStripCodeFences', () => {
9292
expect(shouldStripCodeFences('javascript-function-body')).toBe(true)
9393
expect(shouldStripCodeFences('custom-tool-schema')).toBe(true)
9494
expect(shouldStripCodeFences('json-object')).toBe(true)
95+
expect(shouldStripCodeFences('json-array')).toBe(true)
9596
expect(shouldStripCodeFences('cron-expression')).toBe(true)
9697
})
9798

Collapse file

‎apps/sim/lib/wand/strip-code-fences.ts‎

Copy file name to clipboardExpand all lines: apps/sim/lib/wand/strip-code-fences.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const STRIPS_CODE_FENCES: Record<GenerationType, boolean> = {
1919
'typescript-function-body': true,
2020
'json-schema': true,
2121
'json-object': true,
22+
'json-array': true,
2223
'table-schema': true,
2324
'system-prompt': false,
2425
'custom-tool-schema': true,

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.