You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.2 KiB

11 months ago
  1. const AIbitat = require("../index.js");
  2. const {
  3. cli,
  4. webBrowsing,
  5. fileHistory,
  6. webScraping,
  7. } = require("../plugins/index.js");
  8. require("dotenv").config({ path: `../../../../.env.development` });
  9. const aibitat = new AIbitat({
  10. model: "gpt-4o",
  11. })
  12. .use(cli.plugin())
  13. .use(fileHistory.plugin())
  14. .use(webBrowsing.plugin()) // Does not have introspect so will fail.
  15. .use(webScraping.plugin())
  16. .agent("researcher", {
  17. role: `You are a Researcher. Conduct thorough research to gather all necessary information about the topic
  18. you are writing about. Collect data, facts, and statistics. Analyze competitor blogs for insights.
  19. Provide accurate and up-to-date information that supports the blog post's content to @copywriter.`,
  20. functions: ["web-browsing"],
  21. })
  22. .agent("copywriter", {
  23. role: `You are a Copywriter. Interpret the draft as general idea and write the full blog post using markdown,
  24. ensuring it is tailored to the target audience's preferences, interests, and demographics. Apply genre-specific
  25. writing techniques relevant to the author's genre. Add code examples when needed. Code must be written in
  26. Typescript. Always mention references. Revisit and edit the post for clarity, coherence, and
  27. correctness based on the feedback provided. Ask for feedbacks to the channel when you are done`,
  28. })
  29. .agent("pm", {
  30. role: `You are a Project Manager. Coordinate the project, ensure tasks are completed on time and within budget.
  31. Communicate with team members and stakeholders.`,
  32. interrupt: "ALWAYS",
  33. })
  34. .channel("content-team", ["researcher", "copywriter", "pm"]);
  35. async function main() {
  36. if (!process.env.OPEN_AI_KEY)
  37. throw new Error(
  38. "This example requires a valid OPEN_AI_KEY in the env.development file"
  39. );
  40. await aibitat.start({
  41. from: "pm",
  42. to: "content-team",
  43. content: `We have got this draft of the new blog post, let us start working on it.
  44. --- BEGIN DRAFT OF POST ---
  45. Maui is a beautiful island in the state of Hawaii and is world-reknown for its whale watching season. Here are 2 other additional things to do in Maui, HI:
  46. --- END DRAFT OF POST ---
  47. `,
  48. });
  49. }
  50. main();