shuv25 commited on
Commit
f7a3cef
·
verified ·
1 Parent(s): 7eaf30a

Update schema.py

Browse files
Files changed (1) hide show
  1. schema.py +162 -1
schema.py CHANGED
@@ -1,9 +1,16 @@
1
  from pydantic import BaseModel, Field
 
 
 
2
 
3
  class RouteInput(BaseModel):
4
  origin: str = Field(description="Starting location")
5
  destination: str = Field(description="Ending location")
6
 
 
 
 
 
7
  class CostInput(BaseModel):
8
  origin: str
9
  destination: str
@@ -17,4 +24,158 @@ class TrafficInput(BaseModel):
17
 
18
  class WeatherInput(BaseModel):
19
  origin: str
20
- destination: str
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from pydantic import BaseModel, Field
2
+ from typing import List, Optional
3
+
4
+ #-------------------------Input Format-----------------------------
5
 
6
  class RouteInput(BaseModel):
7
  origin: str = Field(description="Starting location")
8
  destination: str = Field(description="Ending location")
9
 
10
+ class MultiRouteInput(BaseModel):
11
+ origin: str = Field(description="Starting location")
12
+ destinations: List[str] = Field(description="List of destination locations to visit")
13
+
14
  class CostInput(BaseModel):
15
  origin: str
16
  destination: str
 
24
 
25
  class WeatherInput(BaseModel):
26
  origin: str
27
+ destination: str
28
+
29
+ class ForecastWeatherInput(BaseModel):
30
+ address: str
31
+ forecast_hours: int = Field(default=48, description="Number of hours to forecast (default: 48)")
32
+
33
+
34
+
35
+ response_format = """
36
+ # ## RESPONSE FORMATS
37
+
38
+ **For Route-Only Queries:**
39
+ ROUTE SUMMARY Origin: [origin]
40
+ Destination: [destination]
41
+ Distance: [X] km
42
+ Base Duration: [Y] min
43
+ Adjusted ETA: [Z] min (includes traffic and weather)
44
+
45
+ TRAFFIC ANALYSIS
46
+ Current Traffic: [level]
47
+ Traffic Factor: [X]x
48
+ Expected Delay: [Y] min
49
+ Advice: [recommendation]
50
+
51
+ WEATHER CONDITIONS
52
+ Origin: [temp]°C, [condition]
53
+ Destination: [temp]°C, [condition]
54
+ Warnings: [if any]
55
+
56
+ **For Full Planning (Route + Cost):
57
+ ** ROUTE SUMMARY
58
+ ...
59
+ COST ESTIMATE
60
+ Recommended Vehicle: [type] ([ID])
61
+ Total Cost: Rs [amount]
62
+ Cost Breakdown:
63
+ • Base Fee: Rs 150
64
+ • Fuel Cost: Rs [X]
65
+ • Driver Cost: Rs [Y]
66
+ • Traffic Multiplier: [X]x
67
+ • Weather Multiplier: [X]x
68
+
69
+ **For Multi-Destination Route Planning:**
70
+ ```
71
+ OPTIMAL MULTI-ROUTE PLAN
72
+ Starting from: [origin]
73
+
74
+ Best visiting order:
75
+ 1. [destination 1]
76
+ 2. [destination 2]
77
+ 3. [destination 3]
78
+ ...
79
+
80
+ Total Travel Time: [X] hours
81
+ Total Distance: [Y] km
82
+
83
+ Route Details:
84
+ [origin] → [destination 1]
85
+ Time: [X]h | Distance: [Y] km
86
+ [destination 1] → [destination 2]
87
+ Time: [X]h | Distance: [Y] km
88
+ [destination 2] → [destination 3]
89
+ Time: [X]h | Distance: [Y] km
90
+
91
+ OPTIMIZATION SUMMARY:
92
+ • Route optimized to minimize total travel time
93
+ • Tested all possible visiting orders
94
+ • This sequence saves approximately [X] minutes compared to worst route
95
+
96
+ RECOMMENDATIONS:
97
+ • Estimated total journey: [X] hours
98
+ • Consider [traffic/weather advice if available]
99
+ • Plan for fuel stops every [X] km
100
+ ```
101
+
102
+ **For Weather Analysis (Current Only):**
103
+ ```
104
+ WEATHER ANALYSIS
105
+
106
+ Origin Weather ([location]):
107
+ Temperature: [X]°C (feels like [Y]°C)
108
+ Condition: [description]
109
+ Humidity: [X]%
110
+ Wind Speed: [X] m/s
111
+ Rain: [X] mm/h (if applicable)
112
+
113
+ Destination Weather ([location]):
114
+ Temperature: [X]°C
115
+ Condition: [description]
116
+
117
+ Weather Alerts: (if any)
118
+ • [warning 1]
119
+ • [warning 2]
120
+
121
+ Weather Impact Factor: [X]x
122
+ Recommendation: [advice based on conditions]
123
+
124
+ **For Weather Analysis (Current + Forecast):**
125
+ WEATHER ANALYSIS
126
+
127
+ CURRENT CONDITIONS
128
+ Origin: [temp]°C, [condition]
129
+ Destination: [temp]°C, [condition]
130
+
131
+ WEATHER FORECAST (Next 24-48 Hours)
132
+ Origin ([location]):
133
+ [Time]: Temp: [X]°C, Rain: [Y]mm
134
+ [Time]: Temp: [X]°C, Rain: [Y]mm
135
+
136
+ Destination ([location]):
137
+ [Time]: Temp: [X]°C, Rain: [Y]mm
138
+ [Time]: Temp: [X]°C, Rain: [Y]mm
139
+
140
+ RECOMMENDATIONS:
141
+ • Best departure time: [time]
142
+ • Travel advice: [recommendations]
143
+
144
+ **For Forecast-Only Queries:**
145
+ WEATHER FORECAST for [location]
146
+ Forecast Period: Next [X] hours
147
+
148
+ [Time 1]: Temp: [X]°C, Humidity: [Y]%, Rain: [Z]mm
149
+ [Time 2]: Temp: [X]°C, Humidity: [Y]%, Rain: [Z]mm
150
+
151
+ SUMMARY:
152
+ • Best travel window: [time range]
153
+ • Rain expected: [Yes/No]
154
+ ```
155
+ **For Route Improvements (with comparison):**
156
+ ```
157
+ ROUTE SUMMARY
158
+ Origin: [origin]
159
+ Destination: [destination]
160
+ Distance: [distance_km] km
161
+ Duration: [duration_min] min
162
+
163
+ {% if new_duration < old_duration %}
164
+ ✓ IMPROVEMENT DETECTED:
165
+ This route saves approximately [old_duration - new_duration] minutes
166
+ compared to your previous one ([old_duration] min → [new_duration] min).
167
+
168
+ TRAFFIC: [traffic_level] - [advice]
169
+ WEATHER: [weather_conditions]
170
+
171
+ {% else %}
172
+ No faster alternative was found — your current route remains optimal
173
+ ([old_duration] min). Traffic and weather conditions don’t justify a change.
174
+
175
+ TRAFFIC: [traffic_level] - [advice]
176
+ WEATHER: [weather_conditions]
177
+
178
+ {% endif %}
179
+
180
+ ```
181
+ """