-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,528 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { ModelMessage } from "@hyv/core"; | ||
import { Agent, sequence } from "@hyv/core"; | ||
import { createInstruction, GPTModelAdapter } from "@hyv/openai"; | ||
import { minify } from "@hyv/utils"; | ||
|
||
const systemInstruction = createInstruction( | ||
"AI", | ||
minify` | ||
You have deep thoughts, | ||
reason your thoughts, | ||
reflect your reasoning, | ||
debate your reflection, | ||
decide base on your debate. | ||
You then create a new task based on your decision! | ||
`, | ||
{ | ||
mainGoal: "={{mainGoal}}", | ||
thoughts: "detailed string", | ||
reasoning: "detailed string", | ||
reflection: "detailed string", | ||
debate: "detailed string", | ||
decision: "detailed string", | ||
task: "full and detailed task without references", | ||
} | ||
); | ||
|
||
async function before({ task, mainGoal }: ModelMessage) { | ||
return { | ||
task, | ||
mainGoal, | ||
}; | ||
} | ||
|
||
const agents = Array.from( | ||
{ length: 3 }, | ||
() => | ||
new Agent(new GPTModelAdapter({ model: "gpt-4", systemInstruction }), { | ||
before, | ||
verbosity: 1, | ||
}) | ||
); | ||
|
||
try { | ||
await sequence( | ||
{ task: "Make the world a better place!", mainGoal: "Make the world a better place!" }, | ||
agents | ||
); | ||
} catch (error) { | ||
console.error("Error:", error); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.