mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
Modify evaluator to just loop back and forth if there is only one destination in loop
This commit is contained in:
@@ -73,8 +73,12 @@ Description: ${block.description}`
|
||||
.join('\n---\n')}
|
||||
|
||||
Routing Rules:
|
||||
- Score greater than or equal to 0.85: Choose success path block
|
||||
${
|
||||
targetBlocks.length === 1
|
||||
? `- Route back to the only available block (${targetBlocks[0].id}) to continue the iteration`
|
||||
: `- Score greater than or equal to 0.85: Choose success path block
|
||||
- Score less than 0.85: Choose failure path block`
|
||||
}`
|
||||
: ''
|
||||
|
||||
return `${basePrompt}${targetBlocksInfo}
|
||||
@@ -83,7 +87,8 @@ Response Format:
|
||||
Return ONLY the destination block ID as a single word, no punctuation or explanation.
|
||||
Example: "2acd9007-27e8-4510-a487-73d3b825e7c1"
|
||||
|
||||
Remember: Your response must be ONLY the block ID.`
|
||||
Remember: Your response must be ONLY the block ID - no additional text, formatting, or explanation.
|
||||
If there is only one available destination, return that block's ID regardless of the score.`
|
||||
}
|
||||
|
||||
export const EvaluatorBlock: BlockConfig<EvaluatorResponse> = {
|
||||
|
||||
+1
-1
@@ -314,7 +314,7 @@ export class Executor {
|
||||
|
||||
if (executedLoopBlocks.length > 0) {
|
||||
const iterations = loopIterations.get(loopId) || 0
|
||||
if (iterations < (loop.maxIterations ?? 5)) {
|
||||
if (iterations < loop.maxIterations - 1) {
|
||||
// Check if the evaluator chose a block within the loop
|
||||
const evaluatorInLoop = executedLoopBlocks.find((blockId) => {
|
||||
const block = blocks.find((b) => b.id === blockId)
|
||||
|
||||
Reference in New Issue
Block a user