-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblogTeam.js
52 lines (45 loc) · 1.57 KB
/
blogTeam.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require('dotenv').config();
const { Agent, Task, Team } = require('kaibanjs');
const { TavilySearchResults } = require('@langchain/community/tools/tavily_search');
// Define the search tool used by the Research Agent
const searchTool = new TavilySearchResults({
maxResults: 5,
apiKey: process.env.TAVILY_API_KEY
});
// Define the Research Agent
const researchAgent = new Agent({
name: 'Ava',
role: 'News Researcher',
goal: 'Find and summarize the latest news on a given topic',
background: 'Experienced in data analysis and information gathering',
tools: [searchTool]
});
// Define the Writer Agent
const writerAgent = new Agent({
name: 'Kai',
role: 'Content Creator',
goal: 'Create engaging blog posts based on provided information',
background: 'Skilled in writing and content creation',
tools: []
});
// Define Tasks
const researchTask = new Task({
title: 'Latest news research',
description: 'Research the latest news on the topic: {topic}',
expectedOutput: 'A summary of the latest news and key points on the given topic',
agent: researchAgent
});
const writingTask = new Task({
title: 'Blog post writing',
description: 'Write a blog post about {topic} based on the provided research',
expectedOutput: 'An engaging blog post summarizing the latest news on the topic in Markdown format',
agent: writerAgent
});
// Create the Team
const blogTeam = new Team({
name: 'AI News Blogging Team',
agents: [researchAgent, writerAgent],
tasks: [researchTask, writingTask],
env: { OPENAI_API_KEY: process.env.OPENAI_API_KEY }
});
module.exports = { blogTeam };