arnavpgarg commited on
Commit
88d3733
·
verified ·
1 Parent(s): 8c5c24b

Updated app.py

Browse files
Files changed (1) hide show
  1. app.py +81 -6
app.py CHANGED
@@ -9,14 +9,89 @@ from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that does nothing yet
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def get_tourist_place_info(place: str, duration_days: int)-> str :
13
+ """A tool that provides comprehensive tourist information about a particular tourist place or places,
 
14
  Args:
15
+ place: the name of the given tourist destination (landmark, city, state, country).
16
+ duration_days: the no. of days planned for the visit.
17
  """
18
+ import anthropic
19
+
20
+ client = anthropic.Anthropic()
21
+
22
+ prompt = f"""
23
+ Provide detailed tourist information about {place} for a {duration_days}-day visit in the following structured format:-
24
+ 1. **Overview**: Brief introduction of the place.
25
+ 2. **Best season to visit**: Ideal months and why, including weather details.
26
+ 3. **Tourist attractions**: Top 5-7 must see attractions with a one-line description of each.
27
+ 4. **Best places to stay**: 3 accomodation options with budget ranges (budget. mid-range, luxury).
28
+ 5. *Best way to travel there**: Primary transport options (flight, train, road) with trips.
29
+ 6. **Local transport**: How to get around once there.
30
+ 7. **Local cuisine**: 3-5 must try dishes or food experiences.
31
+ 8. **Travel trips**: 3-4 practical trips (visa, language, currency, customs).
32
+
33
+ Keep each section concise but informative.
34
+ """
35
+
36
+ message = client.messages.create(
37
+ model= "claude-sonnet-4-2025-0514",
38
+ max_tokens=1000,
39
+ messages= [{"role": "user", "content": prompt}]
40
+ )
41
+
42
+ return message.context[0].text
43
+
44
+ @tool
45
+ def travel_plan_creator(place: str, duration_days: int, budget_level: str) -> str:
46
+ """A tool that creates a detailed day-by-day travel itinerary for a tourist destination.
47
+ Args:
48
+ place: the name of the tourist destination (landmark, city, state, country).
49
+ duration_days: the nop. of days planned for the visit.
50
+ budget_level: travel budget preference- must be one of: 'budget', 'mid-range', or 'luxury'.
51
+ """
52
+ import anthropic
53
+
54
+ client = anthropic.Anthropic()
55
+
56
+ place_info = get_tourist_place_info(place, duration_days)
57
+
58
+ prompt= f"""
59
+ Using the following tourist information about {place}:
60
+
61
+ {place_info}
62
+
63
+ Create a detailed {duration_days}-day travel itinerary for a {budget_level} traveller. Structure it as:
64
+ **Trip summary**
65
+ - Destination, duration, budget level, estimated total cost range.
66
+
67
+ **Pre-Trip Checklist**
68
+ - visa, vaccinations, bookings to be made in advance.
69
+
70
+ *Day-by-day itinerary**
71
+ for each day provide:
72
+ -Morning, Afternoon, Evening activities.
73
+ -Recommended meals (breakfast, lunch, dinner spots)
74
+ -Estimated daily spend.
75
+
76
+ **Accomodation Plan**
77
+ - Recommended stay options matching the {budget_level} budget.
78
+
79
+ **Transport plan**
80
+ - How to reach {place} + local commute tips.
81
+
82
+ **Packing essentials**
83
+ - 5-6 items specific to this destination and season.
84
+
85
+ Make the plan realistic, time-efficient, and enjoyable.
86
+ """
87
+
88
+ message = client.messages.create(
89
+ model= "claude-sonnet-4-20250514",
90
+ tokens= 1000,
91
+ messages= [{"role": "user", "content": prompt}]
92
+ )
93
+
94
+ return message.content[0].text
95
 
96
  @tool
97
  def get_current_time_in_timezone(timezone: str) -> str: