Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Jan 28, 2025
2 parents 8e1f6d5 + d27f0d5 commit 8b9cafc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode"]
}
17 changes: 11 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.singleQuote": false,
"typescript.tsdk": "node_modules/typescript/lib"
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"files.exclude": {
"**/node_modules": true
},
"prettier.configPath": "prettier.config.cjs",
"prettier.singleQuote": false,
"search.exclude": {
"**/node_modules": true
},
"typescript.tsdk": "node_modules/typescript/lib"
}
17 changes: 14 additions & 3 deletions packages/core/src/core/chain-of-thought.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ export class ChainOfThought extends EventEmitter {
.map((id) => this.goalManager.getGoalById(id))
.filter((g): g is Goal => !!g);

// Update goals with no dependencies to ready
for (const goal of finalGoals) {
if (goal.dependencies && goal.dependencies.length === 0) {
this.goalManager.updateGoalStatus(goal.id, "ready");
}
}

// Add a planning step
this.recordReasoningStep(
`Strategy planned for objective: ${objective}`,
Expand Down Expand Up @@ -1055,6 +1062,7 @@ export class ChainOfThought extends EventEmitter {
* ```ts
* const result = await chain.executeAction({
* type: "sendMessage",
* context: "Sending a message to user"
* payload: {
* message: "Hello world"
* }
Expand Down Expand Up @@ -1190,16 +1198,18 @@ ${this.context.worldState}
4. If the required amounts are not available, end the sequence.
{{additional_validations}}
## Output Format
Return a JSON array where each step contains:
- plan: A short explanation of what you will do
- meta: A metadata object with requirements for the step. Find this in the context.
- actions: A list of actions to be executed. You can either use ${this.getAvailableOutputs()}
<AVAILABLE_ACTIONS>
Below is a list of actions you may use. For each action,
the "payload" must follow the indicated structure exactly. Do not include any markdown formatting, slashes or comments.
Below is a list of actions you may use.
The "payload" must follow the indicated structure exactly. Do not include any markdown formatting, slashes or comments.
Each action must include:
- **payload**: The action data structured as per the available actions.
- **context**: A contextual description or metadata related to the action's execution. This can include statuses, results, or any pertinent information that may influence future actions.
${availableOutputs
.map(
Expand Down Expand Up @@ -1257,6 +1267,7 @@ ${availableOutputs
actions: z.array(
z.object({
type: z.string(),
context: z.string(),
payload: z.any(),
})
),
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/core/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface ChainOfThoughtContext {
*/
export interface CoTAction {
type: string;
context: string;
payload: Record<string, any>;
}

Expand Down
6 changes: 5 additions & 1 deletion prettier.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ module.exports = {
printWidth: 80,
overrides: [
{
files: ["*.yaml", "*.yml"],
files: ["*.yml", "*.yaml"],
options: {
tabWidth: 2,
proseWrap: "preserve",
bracketSpacing: false,
},
},
{
files: ["*.md", "*.mdx"],
options: {
tabWidth: 2,
proseWrap: "always",
embeddedLanguageFormatting: "auto",
},
},
],
Expand Down

0 comments on commit 8b9cafc

Please sign in to comment.