@travisennis/acai-brainstorm
Version:
A set of brainstorming agents and tools to use with AI.SDK.
29 lines (28 loc) • 1.05 kB
JavaScript
import { generateInitialIdeas, printTree, TreeNodeImpl, } from "./utils.js";
export * from "./bigMindMapping.js";
export * from "./index.js";
export * from "./reverseBrainstorming.js";
export * from "./roleStorming.js";
export * from "./scamper.js";
export * from "./sixHats.js";
export * from "./starBursting.js";
export * from "./tool.js";
export * from "./types.js";
export * from "./utils.js";
// Main function
export async function brainstorm({ model, query, strategy, n = 5, }) {
// Initialize the root node with the user's query
const rootRb = new TreeNodeImpl(query);
// Generate initial ideas
const initialIdeas = await generateInitialIdeas({ model, query, n });
console.info(initialIdeas.length);
// Process each initial idea
for (const idea of initialIdeas) {
const childNode = await strategy({ model, idea });
rootRb.addChild(childNode);
}
// Print and return the tree
return printTree(rootRb);
}
// for more:
// https://www.lucidchart.com/blog/effective-brainstorming-techniques