Amitabhab commited on
Commit
64eefbd
·
1 Parent(s): 0df9a3b

Adding options for specifying specific interests and cuisine preferences.

Browse files
Files changed (4) hide show
  1. app.py +86 -45
  2. config/agents.yaml +3 -11
  3. config/tasks.yaml +18 -31
  4. crew.py +84 -57
app.py CHANGED
@@ -1,52 +1,81 @@
1
  #!/usr/bin/env python
2
- import sys
 
 
 
 
 
 
 
 
 
3
  import json
 
 
4
  import gradio as gr
5
  import plotly.graph_objects as go
6
- import logging
7
- from crew import TravelCrew, AddressSummaryCrew
8
-
9
- def filter_map(text_list, lat, lon):
10
- fig = go.Figure(go.Scattermapbox(
11
- lat=lat,
12
- lon=lon,
13
- mode='markers',
14
- marker=go.scattermapbox.Marker(
15
- size=11
16
- ),
17
- hovertext=text_list
18
- ))
 
 
 
 
 
 
 
19
 
20
  fig.update_layout(
21
- mapbox_style="open-street-map",
22
  hovermode='closest',
23
- mapbox=dict(
24
- bearing=0,
25
- center=go.layout.mapbox.Center(
26
- lat=lat[1],
27
- lon=lon[1]
28
- ),
29
- pitch=0,
30
- zoom=10
31
- ),
32
  )
33
  return fig
34
 
35
- def run(origin, destination, age, trip_duration, children, budget):
36
- # Replace with your inputs, it will automatically interpolate any tasks and agents information
37
- logger.info(f"Origin: {origin}, Destination: {destination}, Age: {age}, Duration: {trip_duration}, Children: {children}, Daily Budget: {budget}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  inputs = {
39
  'origin': origin,
40
  'destination': destination,
41
  'age': age,
42
  'trip_duration': trip_duration,
 
 
43
  'children': children,
44
- 'budget': budget
45
  }
46
  result = TravelCrew().crew().kickoff(inputs=inputs)
47
- inputs_for_address = {
48
- 'text': str(result)
49
- }
50
 
51
  addresses = AddressSummaryCrew().crew().kickoff(inputs=inputs_for_address)
52
  json_addresses = None
@@ -60,27 +89,39 @@ def run(origin, destination, age, trip_duration, children, budget):
60
  try:
61
  json_addresses = json.loads(addresses.raw[8:-4])
62
  except json.JSONDecodeError as e:
63
- logger.error("Error loading Crew Output for addresses")
64
- logger.info(addresses.raw)
65
- return (result, None)
66
- fig = filter_map(json_addresses["name"], json_addresses["lat"], json_addresses["lon"])
 
 
 
 
67
  return (result, fig)
68
 
69
  logger = logging.getLogger()
70
  logger.setLevel(logging.INFO)
71
 
72
  demo = gr.Interface(
73
- title="Plan your itinerary with the help of AI",
74
- description="Use this app to create a detailed itinerary on how to explore a new place. Itinerary is customized to your taste. Powered by Sambanova Cloud.",
 
75
  fn=run,
76
- inputs=[gr.Textbox(label="Origin"), gr.Textbox(label="Destination"),
77
- gr.Slider(label="Your age?", value=30, minimum=15, maximum=90, step=5),
78
- gr.Slider(label="How many days are you travelling?", value=5, minimum=1, maximum=14, step=1),
79
- gr.Checkbox(label="Check if children are travelling with you"),
80
- gr.Slider(label="Total budget of trip in USD", show_label=True, value=1000, minimum=500, maximum=10000, step=500)],
 
 
 
 
 
 
 
81
  outputs=[
82
- gr.Textbox(label="Complete Itinerary", show_copy_button=True, autoscroll=False),
83
- gr.Plot(label="Venues on a Map. Please verify with a Navigation System before traveling.")
84
- ]
85
  )
86
  demo.launch()
 
1
  #!/usr/bin/env python
2
+ """
3
+ Travel planner based on Agentic AI workflow.
4
+
5
+ This module deploys a portal which can customize a day to day travel itinerary
6
+ for a person using multiple specialized AI crews.
7
+
8
+ Implemented using Gradio and Crew AI
9
+ A deployment is available at https://huggingface.co/spaces/sambanovasystems/trip-planner
10
+ """
11
+
12
  import json
13
+ import logging
14
+
15
  import gradio as gr
16
  import plotly.graph_objects as go
17
+ from crew import AddressSummaryCrew, TravelCrew
18
+ from typing import List
19
+
20
+
21
+ def filter_map(text_list: List[str], lat: List[str], lon: List[str]) -> go.Figure:
22
+ """
23
+ Create a Map showing the points specified in the inputs.
24
+
25
+ Args:
26
+ text_list: List of the description of all locations that will be shown on the map
27
+ lat: List of latitude coordinates of the locations
28
+ lon: List of longitude coordinates of the locations
29
+
30
+ Returns:
31
+ Figure: Map with the points specified in the inputs
32
+ """
33
+
34
+ fig = go.Figure(
35
+ go.Scattermapbox(lat=lat, lon=lon, mode='markers', marker=go.scattermapbox.Marker(size=11), hovertext=text_list)
36
+ )
37
 
38
  fig.update_layout(
39
+ mapbox_style='open-street-map',
40
  hovermode='closest',
41
+ mapbox=dict(bearing=0, center=go.layout.mapbox.Center(lat=lat[1], lon=lon[1]), pitch=0, zoom=10),
 
 
 
 
 
 
 
 
42
  )
43
  return fig
44
 
45
+
46
+ def run(origin: str, destination: str, age: int, trip_duration: int,
47
+ interests: List, cuisine_preferences: List, children: bool, budget: int) -> (str, go.Figure):
48
+ """
49
+ Run the specfied query using Crew AI agents
50
+
51
+ Args:
52
+ origin: Origin city of the traveller
53
+ destination: Destination that traveller is going to
54
+ age: Age profile of traveller
55
+ interests: Specific interests of the traveller
56
+ cuisine_preferences: Specific cuisine preferences of the traveller
57
+ children: Whether traveller has children travelling with them
58
+ budget: Total budget of traveller in US Dollars
59
+
60
+ Returns:
61
+ Returns a tuple containing the itinerary and map
62
+ """
63
+ logger.info(
64
+ f'Origin: {origin}, Destination: {destination}, Age: {age}, Duration: {trip_duration},'
65
+ f' Interests: {interests}, Cuisines: {cuisine_preferences}, Children: {children}, Daily Budget: {budget}'
66
+ )
67
  inputs = {
68
  'origin': origin,
69
  'destination': destination,
70
  'age': age,
71
  'trip_duration': trip_duration,
72
+ 'interests': interests,
73
+ 'cuisine_preferences': cuisine_preferences,
74
  'children': children,
75
+ 'budget': budget,
76
  }
77
  result = TravelCrew().crew().kickoff(inputs=inputs)
78
+ inputs_for_address = {'text': str(result)}
 
 
79
 
80
  addresses = AddressSummaryCrew().crew().kickoff(inputs=inputs_for_address)
81
  json_addresses = None
 
89
  try:
90
  json_addresses = json.loads(addresses.raw[8:-4])
91
  except json.JSONDecodeError as e:
92
+ # Try with different format of result data generated with ``` and ending with ```
93
+ try:
94
+ json_addresses = json.loads(addresses.raw[4:-4])
95
+ except json.JSONDecodeError as e:
96
+ logger.error('Error loading Crew Output for addresses')
97
+ logger.info(addresses.raw)
98
+ return (result, None)
99
+ fig = filter_map(json_addresses['name'], json_addresses['lat'], json_addresses['lon'])
100
  return (result, fig)
101
 
102
  logger = logging.getLogger()
103
  logger.setLevel(logging.INFO)
104
 
105
  demo = gr.Interface(
106
+ title='Plan your itinerary with the help of AI',
107
+ description='Use this app to create a detailed itinerary on how to explore a new place.'
108
+ ' Itinerary is customized to your taste. Powered by Sambanova Cloud.',
109
  fn=run,
110
+ inputs=[
111
+ gr.Textbox(label='Where are you travelling from?'),
112
+ gr.Textbox(label='Where are you going?'),
113
+ gr.Slider(label='Your age?', value=30, minimum=15, maximum=90, step=5),
114
+ gr.Slider(label='How many days are you travelling?', value=5, minimum=1, maximum=14, step=1),
115
+ gr.CheckboxGroup(["Museums", "Shopping", "Entertainment", "Nightlife", "Outdoor Adventures"], label="Checkbox your specific interests."),
116
+ gr.CheckboxGroup(["Ethnic", "American", "Italian", "Mexican", "Chinese", "Japanese", "Indian", "Thai", "French", "Vietnamese", "Vegan"], label="Checkbox your cuisine preferences."),
117
+ gr.Checkbox(label='Check if children are travelling with you'),
118
+ gr.Slider(
119
+ label='Total budget of trip in USD', show_label=True, value=1000, minimum=500, maximum=10000, step=500
120
+ ),
121
+ ],
122
  outputs=[
123
+ gr.Textbox(label='Complete Personalized Itinerary of your Trip', show_copy_button=True, autoscroll=False),
124
+ gr.Plot(label='Venues on a Map. Please verify with a Navigation System before traveling.'),
125
+ ],
126
  )
127
  demo.launch()
config/agents.yaml CHANGED
@@ -14,22 +14,14 @@ restaurant_scout:
14
  backstory: >
15
  As a food lover, you know the best spots in town for a delightful culinary experience. You also have a knack for finding picturesque and entertaining locations.
16
 
17
- museum_scout:
18
  role: >
19
- Museum Scout
20
  goal: >
21
- Find well-known as well as off-the-beat museums matching the age profile. Also pay particular attention to if there are children. If children are accompanying, pick up museums which might be more interesting to children.
22
  backstory: >
23
  You know the best museums in town for different age groups. Older people may like quieter museums such as art museums. Young children like museums where they can get to touch, feel, and play.
24
 
25
- shopping_scout:
26
- role: >
27
- Shopping Scout
28
- goal: >
29
- Find good areas for shopping. This can include local markets where visitors can buy souvenir, glamorous shopping mall, and flea markets where visiors can buy used goods. If children are accompanying, pick shopping options with suitable amenities and entertainment options for children.
30
- backstory: >
31
- You are an expert of the city and good at finding shopping options where high quality goods reflecting the local values and culture can be bought at a discount
32
-
33
  itinerary_compiler:
34
  role: >
35
  Itinerary Compiler
 
14
  backstory: >
15
  As a food lover, you know the best spots in town for a delightful culinary experience. You also have a knack for finding picturesque and entertaining locations.
16
 
17
+ interest_scout:
18
  role: >
19
+ Interest Scout
20
  goal: >
21
+ Find well-known as well as off-the-beat activities tailored to the list of interests of the traveller and matching the age profile. Also pay particular attention to if there are children. If children are accompanying, pick up activities which might be more interesting to children.
22
  backstory: >
23
  You know the best museums in town for different age groups. Older people may like quieter museums such as art museums. Young children like museums where they can get to touch, feel, and play.
24
 
 
 
 
 
 
 
 
 
25
  itinerary_compiler:
26
  role: >
27
  Itinerary Compiler
config/tasks.yaml CHANGED
@@ -12,6 +12,10 @@ personalized_activity_planning_task:
12
 
13
  - Approximate age of the adult travelers: {age}
14
 
 
 
 
 
15
  - Are children accompanying the trip: {children}
16
 
17
  - how long is the trip: {trip_duration}
@@ -25,8 +29,9 @@ personalized_activity_planning_task:
25
 
26
  restaurant_scenic_location_scout_task:
27
  description: >
28
- Find highly-rated restaurants and dining experiences at {destination}.
29
- Recommend scenic locations and fun activities that align with the traveler's preferences.
 
30
  Use internet search tools, restaurant review sites, and travel guides.
31
  Make sure to find a variety of options to suit different tastes and budgets, and ratings for them.
32
  Extract the address of he restaurant so that the same can be displayed to the user.
@@ -39,6 +44,8 @@ restaurant_scenic_location_scout_task:
39
 
40
  - age of the traveler: {age}
41
 
 
 
42
  - how long is the trip: {trip_duration}
43
 
44
  - budget for entire trip in dollars: {budget}
@@ -46,12 +53,13 @@ restaurant_scenic_location_scout_task:
46
  A list of recommended restaurants for each day of the trip.
47
  Each entry should include the name, location including a detailed address, type of cuisine or activity, and a brief description and ratings.
48
 
49
- museum_scout_task:
50
  description: >
51
- Find popular and off-the-beat museums at {destination}. Consider the {age} of the traveller while recommending museums. Check if children are accompanying in the trip. {children}
52
- If children are accompanying, find museums that might be more appealing to children.
53
- Use internet search tools, museum review sites, feedback from users, and travel guides.
54
- Extract the address of the museum so that the same can be displayed to the user.
 
55
 
56
  Traveler's information:
57
 
@@ -61,29 +69,7 @@ museum_scout_task:
61
 
62
  - age of the traveler: {age}
63
 
64
- - Are children accompanying the trip: {children}
65
-
66
- - how long is the trip: {trip_duration}
67
-
68
- - budget for entire trip in dollars: {budget}
69
- expected_output: >
70
- A list of recommended museums. There need not be a museum for each day of the trip.
71
- Each entry should include the name, location including a detailed address, type of cuisine or activity, and a brief description and ratings.
72
-
73
- shopping_scout_task:
74
- description: >
75
- Find popular shopping at {destination}. Check if children are accompanying in the trip. {children}
76
- If children are accompanying, find shopping areas that might be more appealing to children.
77
- Use internet search tools, feedback from users, and travel guides to make the decision.
78
- Extract the address of the shopping area so that the same can be displayed to the user.
79
-
80
- Traveler's information:
81
-
82
- - origin: {origin}
83
-
84
- - destination: {destination}
85
-
86
- - age of the traveler: {age}
87
 
88
  - Are children accompanying the trip: {children}
89
 
@@ -91,13 +77,14 @@ shopping_scout_task:
91
 
92
  - budget for entire trip in dollars: {budget}
93
  expected_output: >
94
- A list of recommended shopping areas for each day of the trip. Shopping options need not be provided for each day of the trip.
95
  Each entry should include the name, location including a detailed address, type of cuisine or activity, and a brief description and ratings.
96
 
97
 
98
  itinerary_compilation_task:
99
  description: >
100
  Compile all researched information into a comprehensive day-by-day itinerary for the trip to {destination}.
 
101
  Ensure the itinerary integrates hotel information and all planned activities and dining experiences.
102
  Make sure that you do not recommend the same restaurant for both lunch and dinner.
103
  Use text formatting and document creation tools to organize the information.
 
12
 
13
  - Approximate age of the adult travelers: {age}
14
 
15
+ - List of interests that the traveller may have: {interests}
16
+
17
+ - List of cuisine preferences that the traveller may have: {cuisine_preferences}
18
+
19
  - Are children accompanying the trip: {children}
20
 
21
  - how long is the trip: {trip_duration}
 
29
 
30
  restaurant_scenic_location_scout_task:
31
  description: >
32
+ Find highly-rated restaurants and dining experiences for the specific cuisine interests {cuisine_preferences} at {destination}.
33
+ Pay particular attention to the cuisines. If Vegan is on the list, then recommend restaurants which accomodate vegan diet.
34
+ Recommend scenic locations that align with the traveler's preferences and activities.
35
  Use internet search tools, restaurant review sites, and travel guides.
36
  Make sure to find a variety of options to suit different tastes and budgets, and ratings for them.
37
  Extract the address of he restaurant so that the same can be displayed to the user.
 
44
 
45
  - age of the traveler: {age}
46
 
47
+ - List of cuisine preferences that the traveller may have: {cuisine_preferences}
48
+
49
  - how long is the trip: {trip_duration}
50
 
51
  - budget for entire trip in dollars: {budget}
 
53
  A list of recommended restaurants for each day of the trip.
54
  Each entry should include the name, location including a detailed address, type of cuisine or activity, and a brief description and ratings.
55
 
56
+ interest_scout_task:
57
  description: >
58
+ Run specifically for the interests of the traveller provided {interests}. As an example if the traveller has interest in museums, plan activities related to museums at the destination.
59
+ Check if children are accompanying in the trip. {children}
60
+ If children are accompanying, find activities that might be more appealing to children.
61
+ Use internet search tools, review sites, feedback from users, and travel guides.
62
+ Extract the address of the activity so that the same can be displayed to the user.
63
 
64
  Traveler's information:
65
 
 
69
 
70
  - age of the traveler: {age}
71
 
72
+ - List of interests that the traveller may have: {interests}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  - Are children accompanying the trip: {children}
75
 
 
77
 
78
  - budget for entire trip in dollars: {budget}
79
  expected_output: >
80
+ A list of recommended activities. There must be at least one activity for each day of the trip. Allocate appropriate time for the activity so that the traveller need not rush to the next activity.
81
  Each entry should include the name, location including a detailed address, type of cuisine or activity, and a brief description and ratings.
82
 
83
 
84
  itinerary_compilation_task:
85
  description: >
86
  Compile all researched information into a comprehensive day-by-day itinerary for the trip to {destination}.
87
+ Include information relevant to the traveler's interests. For example, if the traveller is not interested in museums, do not pack the itinerary with museums.
88
  Ensure the itinerary integrates hotel information and all planned activities and dining experiences.
89
  Make sure that you do not recommend the same restaurant for both lunch and dinner.
90
  Use text formatting and document creation tools to organize the information.
crew.py CHANGED
@@ -1,37 +1,42 @@
1
- from crewai import Agent, Crew, Process, Task, LLM
2
- from crewai.project import CrewBase, agent, crew, task
3
-
4
- # Uncomment the following line to use an example of a custom tool
5
- # from surprise_travel.tools.custom_tool import MyCustomTool
6
-
7
- # Check our tools documentation for more information on how to use them
8
- from crewai_tools import SerperDevTool, ScrapeWebsiteTool
9
- #from pydantic import BaseModel, Field
10
- from typing import List, Optional
11
 
12
- import os
 
 
13
 
14
  # Change the model which you want to use below.
15
- llm = LLM(model="sambanova/Meta-Llama-3.1-70B-Instruct")
 
16
 
17
  @CrewBase
18
- class TravelCrew():
19
- """Travel crew"""
 
20
  agents_config = 'config/agents.yaml'
21
  tasks_config = 'config/tasks.yaml'
22
 
23
  @agent
24
  def personalized_activity_planner(self) -> Agent:
 
 
 
 
 
25
  return Agent(
26
  config=self.agents_config['personalized_activity_planner'],
27
  llm=llm,
28
  max_iter=1,
29
- tools=[SerperDevTool(), ScrapeWebsiteTool()], # Example of custom tool, loaded at the beginning of file
30
  allow_delegation=False,
31
  )
32
 
33
  @agent
34
  def restaurant_scout(self) -> Agent:
 
 
 
 
 
35
  return Agent(
36
  config=self.agents_config['restaurant_scout'],
37
  llm=llm,
@@ -41,19 +46,14 @@ class TravelCrew():
41
  )
42
 
43
  @agent
44
- def museum_scout(self) -> Agent:
45
- return Agent(
46
- config=self.agents_config['museum_scout'],
47
- llm=llm,
48
- max_iter=1,
49
- tools=[SerperDevTool(), ScrapeWebsiteTool()],
50
- allow_delegation=False,
51
- )
52
 
53
- @agent
54
- def shopping_scout(self) -> Agent:
55
  return Agent(
56
- config=self.agents_config['shopping_scout'],
57
  llm=llm,
58
  max_iter=1,
59
  tools=[SerperDevTool(), ScrapeWebsiteTool()],
@@ -62,6 +62,11 @@ class TravelCrew():
62
 
63
  @agent
64
  def itinerary_compiler(self) -> Agent:
 
 
 
 
 
65
  return Agent(
66
  config=self.agents_config['itinerary_compiler'],
67
  llm=llm,
@@ -71,68 +76,81 @@ class TravelCrew():
71
 
72
  @task
73
  def personalized_activity_planning_task(self) -> Task:
 
 
 
 
 
74
  return Task(
75
  config=self.tasks_config['personalized_activity_planning_task'],
76
  llm=llm,
77
  max_iter=1,
78
- agent=self.personalized_activity_planner()
79
  )
80
 
81
  @task
82
- def restaurant_scenic_location_scout_task(self) -> Task:
83
- return Task(
84
- config=self.tasks_config['restaurant_scenic_location_scout_task'],
85
- llm=llm,
86
- max_iter=1,
87
- agent=self.restaurant_scout()
88
- )
89
 
90
- @task
91
- def museum_scout_task(self) -> Task:
92
- return Task(
93
- config=self.tasks_config['museum_scout_task'],
94
- llm=llm,
95
- max_iter=1,
96
- agent=self.museum_scout()
97
- )
98
 
99
  @task
100
- def shopping_scout_task(self) -> Task:
 
 
 
 
 
101
  return Task(
102
- config=self.tasks_config['shopping_scout_task'],
103
  llm=llm,
104
  max_iter=1,
105
- agent=self.shopping_scout()
106
  )
107
 
108
  @task
109
  def itinerary_compilation_task(self) -> Task:
 
 
 
 
 
110
  return Task(
111
- config=self.tasks_config['itinerary_compilation_task'],
112
- llm=llm,
113
- max_iter=1,
114
- agent=self.itinerary_compiler()
115
  )
116
 
117
  @crew
118
  def crew(self) -> Crew:
119
- """Creates the Travel crew"""
 
 
 
 
120
  return Crew(
121
- agents=self.agents, # Automatically created by the @agent decorator
122
- tasks=self.tasks, # Automatically created by the @task decorator
123
  process=Process.sequential,
124
- # process=Process.hierarchical, # In case you want to use that instead https://docs.crewai.com/how-to/Hierarchical/
125
  )
126
 
127
 
128
  @CrewBase
129
- class AddressSummaryCrew():
130
  """Address Summary crew"""
 
131
  agents_config = 'config/address_agents.yaml'
132
  tasks_config = 'config/address_tasks.yaml'
133
 
134
  @agent
135
  def address_summarizer(self) -> Agent:
 
 
 
 
 
136
  return Agent(
137
  config=self.agents_config['address_summarizer'],
138
  llm=llm,
@@ -142,6 +160,11 @@ class AddressSummaryCrew():
142
 
143
  @task
144
  def address_compilation_task(self) -> Task:
 
 
 
 
 
145
  return Task(
146
  config=self.tasks_config['address_compilation_task'],
147
  llm=llm,
@@ -151,10 +174,14 @@ class AddressSummaryCrew():
151
 
152
  @crew
153
  def crew(self) -> Crew:
154
- """Creates the AddressSummary crew"""
 
 
 
 
155
  crew = Crew(
156
- agents=self.agents, # Automatically created by the @agent decorator
157
- tasks=self.tasks, # Automatically created by the @task decorator
158
  process=Process.sequential,
159
  )
160
  return crew
 
1
+ """Implementation based on the Crew AI workflow"""
 
 
 
 
 
 
 
 
 
2
 
3
+ from crewai import LLM, Agent, Crew, Process, Task
4
+ from crewai.project import CrewBase, agent, crew, task
5
+ from crewai_tools import ScrapeWebsiteTool, SerperDevTool
6
 
7
  # Change the model which you want to use below.
8
+ # Currently, we use the Llama 3.1 70B model because it seems the most versatile
9
+ llm = LLM(model='sambanova/Meta-Llama-3.1-70B-Instruct')
10
 
11
  @CrewBase
12
+ class TravelCrew:
13
+ """Crew to do travel planning"""
14
+
15
  agents_config = 'config/agents.yaml'
16
  tasks_config = 'config/tasks.yaml'
17
 
18
  @agent
19
  def personalized_activity_planner(self) -> Agent:
20
+ """
21
+ An agent specialized to build an activity planner
22
+
23
+ Returns: The agent
24
+ """
25
  return Agent(
26
  config=self.agents_config['personalized_activity_planner'],
27
  llm=llm,
28
  max_iter=1,
29
+ tools=[SerperDevTool(), ScrapeWebsiteTool()], # Example of custom tool, loaded at the beginning of file
30
  allow_delegation=False,
31
  )
32
 
33
  @agent
34
  def restaurant_scout(self) -> Agent:
35
+ """
36
+ An agent specialized to scout for restaurants
37
+
38
+ Returns: The agent
39
+ """
40
  return Agent(
41
  config=self.agents_config['restaurant_scout'],
42
  llm=llm,
 
46
  )
47
 
48
  @agent
49
+ def interest_scout(self) -> Agent:
50
+ """
51
+ An agent specialized to scout for specific interests
 
 
 
 
 
52
 
53
+ Returns: The agent
54
+ """
55
  return Agent(
56
+ config=self.agents_config['interest_scout'],
57
  llm=llm,
58
  max_iter=1,
59
  tools=[SerperDevTool(), ScrapeWebsiteTool()],
 
62
 
63
  @agent
64
  def itinerary_compiler(self) -> Agent:
65
+ """
66
+ An agent specialized at composing the entire itinirary
67
+
68
+ Returns: The agent
69
+ """
70
  return Agent(
71
  config=self.agents_config['itinerary_compiler'],
72
  llm=llm,
 
76
 
77
  @task
78
  def personalized_activity_planning_task(self) -> Task:
79
+ """
80
+ A task that designs and plans for activities.
81
+
82
+ Returns: A task
83
+ """
84
  return Task(
85
  config=self.tasks_config['personalized_activity_planning_task'],
86
  llm=llm,
87
  max_iter=1,
88
+ agent=self.personalized_activity_planner(),
89
  )
90
 
91
  @task
92
+ def interest_scout_task(self) -> Task:
93
+ """
94
+ A task that plans for specific interests of the traveller.
95
+
96
+ Returns: A task
97
+ """
98
+ return Task(config=self.tasks_config['interest_scout_task'], llm=llm, max_iter=1, agent=self.interest_scout())
99
 
 
 
 
 
 
 
 
 
100
 
101
  @task
102
+ def restaurant_scenic_location_scout_task(self) -> Task:
103
+ """
104
+ A task that picks restaurants.
105
+
106
+ Returns: A task
107
+ """
108
  return Task(
109
+ config=self.tasks_config['restaurant_scenic_location_scout_task'],
110
  llm=llm,
111
  max_iter=1,
112
+ agent=self.restaurant_scout(),
113
  )
114
 
115
  @task
116
  def itinerary_compilation_task(self) -> Task:
117
+ """
118
+ A task that plans for museums.
119
+
120
+ Returns: A task
121
+ """
122
  return Task(
123
+ config=self.tasks_config['itinerary_compilation_task'], llm=llm, max_iter=1, agent=self.itinerary_compiler()
 
 
 
124
  )
125
 
126
  @crew
127
  def crew(self) -> Crew:
128
+ """
129
+ Creates the Travel Planning crew
130
+
131
+ Returns: A crew
132
+ """
133
  return Crew(
134
+ agents=self.agents,
135
+ tasks=self.tasks,
136
  process=Process.sequential,
 
137
  )
138
 
139
 
140
  @CrewBase
141
+ class AddressSummaryCrew:
142
  """Address Summary crew"""
143
+
144
  agents_config = 'config/address_agents.yaml'
145
  tasks_config = 'config/address_tasks.yaml'
146
 
147
  @agent
148
  def address_summarizer(self) -> Agent:
149
+ """
150
+ Creates an agent which can summarize addresses in a Json file
151
+
152
+ Returns: An agent
153
+ """
154
  return Agent(
155
  config=self.agents_config['address_summarizer'],
156
  llm=llm,
 
160
 
161
  @task
162
  def address_compilation_task(self) -> Task:
163
+ """
164
+ Creates a task which can summarize addresses
165
+
166
+ Returns: A Task
167
+ """
168
  return Task(
169
  config=self.tasks_config['address_compilation_task'],
170
  llm=llm,
 
174
 
175
  @crew
176
  def crew(self) -> Crew:
177
+ """
178
+ Creates the AddressSummary crew
179
+
180
+ Returns: A Crew
181
+ """
182
  crew = Crew(
183
+ agents=self.agents,
184
+ tasks=self.tasks,
185
  process=Process.sequential,
186
  )
187
  return crew