Skip to content

Commit ab09a5a

Browse files
authored
feat(router): expose reasoning output in router v2 block (#2945)
1 parent fcd0240 commit ab09a5a

File tree

3 files changed

+332
-22
lines changed

3 files changed

+332
-22
lines changed

apps/sim/blocks/blocks/router.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,9 @@ ROUTING RULES:
129129
3. If the context is even partially related to a route's description, select that route
130130
4. ONLY output NO_MATCH if the context is completely unrelated to ALL route descriptions
131131
132-
OUTPUT FORMAT:
133-
- Output EXACTLY one route ID (copied exactly as shown above) OR "NO_MATCH"
134-
- No explanation, no punctuation, no additional text
135-
- Just the route ID or NO_MATCH
136-
137-
Your response:`
132+
Respond with a JSON object containing:
133+
- route: EXACTLY one route ID (copied exactly as shown above) OR "NO_MATCH"
134+
- reasoning: A brief explanation (1-2 sentences) of why you chose this route`
138135
}
139136

140137
/**
@@ -272,6 +269,7 @@ interface RouterV2Response extends ToolResponse {
272269
total: number
273270
}
274271
selectedRoute: string
272+
reasoning: string
275273
selectedPath: {
276274
blockId: string
277275
blockType: string
@@ -355,6 +353,7 @@ export const RouterV2Block: BlockConfig<RouterV2Response> = {
355353
tokens: { type: 'json', description: 'Token usage' },
356354
cost: { type: 'json', description: 'Cost information' },
357355
selectedRoute: { type: 'string', description: 'Selected route ID' },
356+
reasoning: { type: 'string', description: 'Explanation of why this route was chosen' },
358357
selectedPath: { type: 'json', description: 'Selected routing path' },
359358
},
360359
}

0 commit comments

Comments
 (0)