BLJohnPrabhasith commited on
Commit
d3b6ca9
1 Parent(s): 9fa30ff

Update agents.py

Browse files

# Added the attribute api_key in the llm object

Files changed (1) hide show
  1. agents.py +54 -53
agents.py CHANGED
@@ -1,53 +1,54 @@
1
- from crewai import Agent
2
- from dotenv import load_dotenv
3
- from langchain_groq import ChatGroq
4
- import os
5
- from tools import tool
6
- load_dotenv()
7
-
8
-
9
- llm = ChatGroq(
10
- model = "groq/llama-3.1-8b-instant",
11
- verbose = True,
12
- temperature = 0.5,
13
- )
14
-
15
- ## Creating a researcher agent who is responsible to dig the details of particular
16
- ## topic in detail
17
-
18
- News_Researcher = Agent(
19
- role = "Senior Researcher",
20
- goal = "uncover ground breaking Technologies in {topic}",
21
- verbose = True,
22
- memory = True,
23
- backstory = (
24
- """
25
- Driven by curiosity, you are at forefront of the innovation,
26
- eager to explore and share knowledge that could change the world
27
- """
28
- ),
29
- tools = [tool],
30
- llm = llm,
31
- allow_delegation = True,
32
- )
33
-
34
- ## Creating a writer agent with custom tools responsible in writing news blog
35
-
36
- News_Writer = Agent(
37
- role = 'Writer',
38
- goal = 'Narrate compelling tech stories about {topic}',
39
- verbose = True,
40
- memory = True,
41
- backstory = (
42
- """
43
- With a Flair for simplifying complex topics, you craft engaging
44
- narratives that captivate and educate, bringing new discoveries to light
45
- in an accessible manner.
46
- """
47
- ),
48
- tools = [tool],
49
- llm = llm,
50
- allow_delegations = False
51
- )
52
-
53
-
 
 
1
+ from crewai import Agent
2
+ from dotenv import load_dotenv
3
+ from langchain_groq import ChatGroq
4
+ import os
5
+ from tools import tool
6
+ load_dotenv()
7
+
8
+
9
+ llm = ChatGroq(
10
+ api_key=os.getenv("GROQ_API_KEY"),
11
+ model = "groq/llama-3.1-8b-instant",
12
+ verbose = True,
13
+ temperature = 0.5,
14
+ )
15
+
16
+ ## Creating a researcher agent who is responsible to dig the details of particular
17
+ ## topic in detail
18
+
19
+ News_Researcher = Agent(
20
+ role = "Senior Researcher",
21
+ goal = "uncover ground breaking Technologies in {topic}",
22
+ verbose = True,
23
+ memory = True,
24
+ backstory = (
25
+ """
26
+ Driven by curiosity, you are at forefront of the innovation,
27
+ eager to explore and share knowledge that could change the world
28
+ """
29
+ ),
30
+ tools = [tool],
31
+ llm = llm,
32
+ allow_delegation = True,
33
+ )
34
+
35
+ ## Creating a writer agent with custom tools responsible in writing news blog
36
+
37
+ News_Writer = Agent(
38
+ role = 'Writer',
39
+ goal = 'Narrate compelling tech stories about {topic}',
40
+ verbose = True,
41
+ memory = True,
42
+ backstory = (
43
+ """
44
+ With a Flair for simplifying complex topics, you craft engaging
45
+ narratives that captivate and educate, bringing new discoveries to light
46
+ in an accessible manner.
47
+ """
48
+ ),
49
+ tools = [tool],
50
+ llm = llm,
51
+ allow_delegations = False
52
+ )
53
+
54
+