@minded-ai/mindedjs 2.0.1-beta-7 → 2.0.1-beta-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPromptRouter.d.ts","sourceRoot":"","sources":["../../src/edges/createPromptRouter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA+C3D,eAAO,MAAM,kBAAkB,yFAO5B;IACD,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,GAAG,EAAE,iBAAiB,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,aACsB,OAAO,eAAe,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"createPromptRouter.d.ts","sourceRoot":"","sources":["../../src/edges/createPromptRouter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AA+C3D,eAAO,MAAM,kBAAkB,yFAO5B;IACD,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,GAAG,EAAE,iBAAiB,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,aACsB,OAAO,eAAe,CAAC,KAAK,oBAwJlD,CAAC"}
|
|
@@ -11,10 +11,10 @@ Based on the conversation history and memory state, you should classify the next
|
|
|
11
11
|
Each step has a nodeId and a condition. You should decide to move to the right step based on the condition.
|
|
12
12
|
|
|
13
13
|
Here are the available options and their conditions:
|
|
14
|
-
|
|
14
|
+
<%= steps %>
|
|
15
15
|
|
|
16
16
|
Recent messages:
|
|
17
|
-
|
|
17
|
+
<%= messages %>
|
|
18
18
|
|
|
19
19
|
You MUST respond with the exact nodeId from the options above. Do not use step numbers or any other identifiers.
|
|
20
20
|
|
|
@@ -32,10 +32,10 @@ Based on the conversation history and memory state, you should classify the next
|
|
|
32
32
|
Each step has a nodeId and a condition. You should decide to move to the right step based on the condition.
|
|
33
33
|
|
|
34
34
|
Here are the available options and their conditions:
|
|
35
|
-
|
|
35
|
+
<%= steps %>
|
|
36
36
|
|
|
37
37
|
Recent messages:
|
|
38
|
-
|
|
38
|
+
<%= messages %>
|
|
39
39
|
|
|
40
40
|
You MUST respond with the exact nodeId from the options above. Do not use step numbers or any other identifiers.
|
|
41
41
|
|
|
@@ -70,13 +70,7 @@ const createPromptRouter = ({ edges, llm, includeReasoning = true, maxRetries =
|
|
|
70
70
|
stepsStr = `- Node: "${currentNodeName}" (stay in current node)\n`;
|
|
71
71
|
}
|
|
72
72
|
// Add the edge options
|
|
73
|
-
stepsStr += edges
|
|
74
|
-
.map((edge) => {
|
|
75
|
-
// Compile edge prompts with EJS to support templates in conditions
|
|
76
|
-
const compiledPrompt = (0, compilePrompt_1.compilePrompt)(edge.prompt || '', { memory: state.memory });
|
|
77
|
-
return `- Node: "${edge.target}" - Condition: "${compiledPrompt}"`;
|
|
78
|
-
})
|
|
79
|
-
.join('\n');
|
|
73
|
+
stepsStr += edges.map((edge) => `- Node: "${edge.target}" - Condition: "${edge.prompt}"`).join('\n');
|
|
80
74
|
// Prepare recent messages (last 10 messages for context)
|
|
81
75
|
const recentMessages = state.messages.slice(-10);
|
|
82
76
|
const messagesStr = recentMessages
|
|
@@ -87,9 +81,8 @@ const createPromptRouter = ({ edges, llm, includeReasoning = true, maxRetries =
|
|
|
87
81
|
})
|
|
88
82
|
.join('\n');
|
|
89
83
|
// Select prompt based on reasoning preference
|
|
90
|
-
|
|
84
|
+
const promptTemplate = includeReasoning ? ROUTER_PROMPT : ROUTER_PROMPT_WITHOUT_REASONING;
|
|
91
85
|
// Compile prompt with EJS and parameters
|
|
92
|
-
promptTemplate = promptTemplate.replace('{steps}', stepsStr).replace('{messages}', messagesStr);
|
|
93
86
|
const routerPrompt = (0, compilePrompt_1.compilePrompt)(promptTemplate, {
|
|
94
87
|
steps: stepsStr,
|
|
95
88
|
messages: messagesStr,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPromptRouter.js","sourceRoot":"","sources":["../../src/edges/createPromptRouter.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAGxB,uDAAyD;AAEzD,4CAAyC;AACzC,0DAAuD;AAEvD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;CAoBrB,CAAC;AAEF,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;CAmBvC,CAAC;AAEK,MAAM,kBAAkB,GAAG,CAAC,EACjC,KAAK,EACL,GAAG,EACH,gBAAgB,GAAG,IAAI,EACvB,UAAU,GAAG,CAAC,EACd,oBAAoB,GAAG,KAAK,EAC5B,eAAe,GAQhB,EAAE,EAAE;IACH,OAAO,KAAK,EAAE,KAAmC,EAAE,EAAE;;QACnD,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,kCAAkC,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAE9G,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,eAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,0BAA0B,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAA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AAC;oBACpD,CAAC;oBAED,OAAO,YAAY,CAAC;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;QAED,wDAAwD;QACxD,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC,CAAC;AAvKW,QAAA,kBAAkB,sBAuK7B"}
|
package/package.json
CHANGED
|
@@ -12,10 +12,10 @@ Based on the conversation history and memory state, you should classify the next
|
|
|
12
12
|
Each step has a nodeId and a condition. You should decide to move to the right step based on the condition.
|
|
13
13
|
|
|
14
14
|
Here are the available options and their conditions:
|
|
15
|
-
|
|
15
|
+
<%= steps %>
|
|
16
16
|
|
|
17
17
|
Recent messages:
|
|
18
|
-
|
|
18
|
+
<%= messages %>
|
|
19
19
|
|
|
20
20
|
You MUST respond with the exact nodeId from the options above. Do not use step numbers or any other identifiers.
|
|
21
21
|
|
|
@@ -34,10 +34,10 @@ Based on the conversation history and memory state, you should classify the next
|
|
|
34
34
|
Each step has a nodeId and a condition. You should decide to move to the right step based on the condition.
|
|
35
35
|
|
|
36
36
|
Here are the available options and their conditions:
|
|
37
|
-
|
|
37
|
+
<%= steps %>
|
|
38
38
|
|
|
39
39
|
Recent messages:
|
|
40
|
-
|
|
40
|
+
<%= messages %>
|
|
41
41
|
|
|
42
42
|
You MUST respond with the exact nodeId from the options above. Do not use step numbers or any other identifiers.
|
|
43
43
|
|
|
@@ -91,13 +91,7 @@ export const createPromptRouter = ({
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// Add the edge options
|
|
94
|
-
stepsStr += edges
|
|
95
|
-
.map((edge) => {
|
|
96
|
-
// Compile edge prompts with EJS to support templates in conditions
|
|
97
|
-
const compiledPrompt = compilePrompt(edge.prompt || '', { memory: state.memory });
|
|
98
|
-
return `- Node: "${edge.target}" - Condition: "${compiledPrompt}"`;
|
|
99
|
-
})
|
|
100
|
-
.join('\n');
|
|
94
|
+
stepsStr += edges.map((edge) => `- Node: "${edge.target}" - Condition: "${edge.prompt}"`).join('\n');
|
|
101
95
|
|
|
102
96
|
// Prepare recent messages (last 10 messages for context)
|
|
103
97
|
const recentMessages = state.messages.slice(-10);
|
|
@@ -110,10 +104,9 @@ export const createPromptRouter = ({
|
|
|
110
104
|
.join('\n');
|
|
111
105
|
|
|
112
106
|
// Select prompt based on reasoning preference
|
|
113
|
-
|
|
107
|
+
const promptTemplate = includeReasoning ? ROUTER_PROMPT : ROUTER_PROMPT_WITHOUT_REASONING;
|
|
114
108
|
|
|
115
109
|
// Compile prompt with EJS and parameters
|
|
116
|
-
promptTemplate = promptTemplate.replace('{steps}', stepsStr).replace('{messages}', messagesStr);
|
|
117
110
|
const routerPrompt = compilePrompt(promptTemplate, {
|
|
118
111
|
steps: stepsStr,
|
|
119
112
|
messages: messagesStr,
|