Spaces:
Sleeping
Sleeping
BLJohnPrabhasith
commited on
Commit
•
d3b6ca9
1
Parent(s):
9fa30ff
Update agents.py
Browse files# Added the attribute api_key in the llm object
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 |
-
|
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 |
-
|
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 |
+
|