-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
92 lines (80 loc) · 2.57 KB
/
main.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
from crewai import Crew
from textwrap import dedent
from agents import TravelAgents
from tasks import TravelTasks
from dotenv import load_dotenv
load_dotenv()
class TripCrew:
def __init__(self, origin, cities, date_range, interests):
self.origin = origin
self.cities = cities
self.date_range = date_range
self.interests = interests
def run(self):
# Define your custom agents and tasks in agents.py and tasks.py
agents = TravelAgents()
tasks = TravelTasks()
# Define your custom agents and tasks here
expert_travel_agent = agents.expert_travel_agent()
city_selection_expert = agents.city_selection_expert()
local_tour_guide = agents.local_tour_guide()
# Custom tasks include agent name and variables as input
plan_itinerary = tasks.plan_itinerary(
expert_travel_agent,
self.cities,
self.date_range,
self.interests
)
identify_city = tasks.identify_city(
city_selection_expert,
self.origin,
self.cities,
self.interests,
self.date_range
)
gather_city_info = tasks.gather_city_info(
local_tour_guide,
self.cities,
self.date_range,
self.interests
)
# Define your custom crew here
crew = Crew(
agents=[expert_travel_agent,
city_selection_expert,
local_tour_guide
],
tasks=[
plan_itinerary,
identify_city,
gather_city_info
],
verbose=True,
)
result = crew.kickoff()
return result
# This is the main function that you will use to run your custom crew.
if __name__ == "__main__":
print("## Welcome to Trip Planner Crew")
print('-------------------------------')
origin = input(
dedent("""
From where will you be traveling from?
"""))
cities = input(
dedent("""
What are the cities options you are interested in visiting?
"""))
date_range = input(
dedent("""
What is the date range you are interested in traveling?
"""))
interests = input(
dedent("""
What are some of your high level interests and hobbies?
"""))
trip_crew = TripCrew(origin, cities, date_range, interests)
result = trip_crew.run()
print("\n\n########################")
print("## Here is you Trip Plan")
print("########################\n")