taaha3244 commited on
Commit
a88da4e
1 Parent(s): bf6a5b0

Create main.py

Browse files
Files changed (1) hide show
  1. main.py +78 -0
main.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ from crewai import Agent, Task, Crew
4
+ from langchain.agents import Tool
5
+ from langchain_community.tools.tavily_search import TavilySearchResults
6
+
7
+ load_dotenv()
8
+ os.environ["OPENAI_API_KEY"] = os.getenv('OPENAI_API_KEY')
9
+ os.environ["OPENAI_MODEL_NAME"] = 'gpt-3.5-turbo'
10
+ os.environ["TAVILY_API_KEY"] =os.getenv("TAVILY_API_KEY")
11
+
12
+ def setup_agents_and_tasks():
13
+ tavily_tool = Tool(
14
+ name="Intermediate Answer",
15
+ func=TavilySearchResults().run,
16
+ description="Useful for search-based queries",
17
+ )
18
+
19
+ sales_rep_agent = Agent(
20
+ role="Sales Representative",
21
+ goal="Identify high-value leads that match our ideal customer profile",
22
+ backstory=(
23
+ "As a part of the dynamic sales team at AI LOVES HR, "
24
+ "your mission is to scour the digital landscape for potential leads."
25
+ ),
26
+ allow_delegation=False,
27
+ verbose=True
28
+ )
29
+
30
+ lead_sales_rep_agent = Agent(
31
+ role="Lead Sales Representative",
32
+ goal="Nurture leads with personalized, compelling communications",
33
+ backstory=(
34
+ "Within the vibrant ecosystem of AI Loves HR's sales department, "
35
+ "you stand out as the bridge between potential clients and the solutions they need."
36
+ ),
37
+ allow_delegation=False,
38
+ verbose=True
39
+ )
40
+
41
+ lead_profiling_task = Task(
42
+ description=(
43
+ "Conduct an in-depth analysis of {lead_name}, a company in the {industry} sector "
44
+ "that recently showed interest in our solutions. "
45
+ "Utilize all available data sources to compile a detailed profile."
46
+ ),
47
+ expected_output=(
48
+ "A comprehensive report on {lead_name}, including company background, "
49
+ "key personnel, recent milestones, and identified needs."
50
+ ),
51
+ tools=[tavily_tool],
52
+ agent=sales_rep_agent,
53
+ )
54
+
55
+ personalized_outreach_task = Task(
56
+ description=(
57
+ "Using the insights gathered from the lead profiling report on {lead_name}, "
58
+ "craft a personalized outreach campaign aimed at {key_decision_maker}."
59
+ ),
60
+ expected_output=(
61
+ "A series of personalized email drafts tailored to {lead_name}, "
62
+ "specifically targeting {key_decision_maker}."
63
+ ),
64
+ tools=[tavily_tool],
65
+ agent=lead_sales_rep_agent
66
+ )
67
+
68
+ crew = Crew(
69
+ agents=[sales_rep_agent, lead_sales_rep_agent],
70
+ tasks=[lead_profiling_task, personalized_outreach_task],
71
+ verbose=2,
72
+ memory=True
73
+ )
74
+
75
+ return crew
76
+
77
+ def kickoff_crew(crew, inputs):
78
+ return crew.kickoff(inputs=inputs)