File size: 4,827 Bytes
be1ef0b f7a3cef be1ef0b 62828d3 be1ef0b f7a3cef be1ef0b 62828d3 be1ef0b 62828d3 f7a3cef | 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 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | from pydantic import BaseModel, Field
from typing import List, Optional
#-------------------------Input Format-----------------------------
class RouteInput(BaseModel):
origin: str = Field(description="Starting location")
destination: str = Field(description="Ending location")
class MultiRouteInput(BaseModel):
origin: str = Field(description="Starting location")
destinations: List[str] = Field(description="List of destination locations to visit")
class CostInput(BaseModel):
origin: str
destination: str
distance_km: float
weight_kg: float
duration_min: float
class TrafficInput(BaseModel):
origin: str
destination: str
class WeatherInput(BaseModel):
origin: str
destination: str
class ForecastWeatherInput(BaseModel):
address: str
forecast_hours: int = Field(default=48, description="Number of hours to forecast (default: 48)")
response_format = """
# ## RESPONSE FORMATS
**For Route-Only Queries:**
ROUTE SUMMARY Origin: [origin]
Destination: [destination]
Distance: [X] km
Base Duration: [Y] min
Adjusted ETA: [Z] min (includes traffic and weather)
TRAFFIC ANALYSIS
Current Traffic: [level]
Traffic Factor: [X]x
Expected Delay: [Y] min
Advice: [recommendation]
WEATHER CONDITIONS
Origin: [temp]°C, [condition]
Destination: [temp]°C, [condition]
Warnings: [if any]
**For Full Planning (Route + Cost):
** ROUTE SUMMARY
...
COST ESTIMATE
Recommended Vehicle: [type] ([ID])
Total Cost: Rs [amount]
Cost Breakdown:
• Base Fee: Rs 150
• Fuel Cost: Rs [X]
• Driver Cost: Rs [Y]
• Traffic Multiplier: [X]x
• Weather Multiplier: [X]x
**For Multi-Destination Route Planning:**
```
OPTIMAL MULTI-ROUTE PLAN
Starting from: [origin]
Best visiting order:
1. [destination 1]
2. [destination 2]
3. [destination 3]
...
Total Travel Time: [X] hours
Total Distance: [Y] km
Route Details:
[origin] → [destination 1]
Time: [X]h | Distance: [Y] km
[destination 1] → [destination 2]
Time: [X]h | Distance: [Y] km
[destination 2] → [destination 3]
Time: [X]h | Distance: [Y] km
OPTIMIZATION SUMMARY:
• Route optimized to minimize total travel time
• Tested all possible visiting orders
• This sequence saves approximately [X] minutes compared to worst route
RECOMMENDATIONS:
• Estimated total journey: [X] hours
• Consider [traffic/weather advice if available]
• Plan for fuel stops every [X] km
```
**For Weather Analysis (Current Only):**
```
WEATHER ANALYSIS
Origin Weather ([location]):
Temperature: [X]°C (feels like [Y]°C)
Condition: [description]
Humidity: [X]%
Wind Speed: [X] m/s
Rain: [X] mm/h (if applicable)
Destination Weather ([location]):
Temperature: [X]°C
Condition: [description]
Weather Alerts: (if any)
• [warning 1]
• [warning 2]
Weather Impact Factor: [X]x
Recommendation: [advice based on conditions]
**For Weather Analysis (Current + Forecast):**
WEATHER ANALYSIS
CURRENT CONDITIONS
Origin: [temp]°C, [condition]
Destination: [temp]°C, [condition]
WEATHER FORECAST (Next 24-48 Hours)
Origin ([location]):
[Time]: Temp: [X]°C, Rain: [Y]mm
[Time]: Temp: [X]°C, Rain: [Y]mm
Destination ([location]):
[Time]: Temp: [X]°C, Rain: [Y]mm
[Time]: Temp: [X]°C, Rain: [Y]mm
RECOMMENDATIONS:
• Best departure time: [time]
• Travel advice: [recommendations]
**For Forecast-Only Queries:**
WEATHER FORECAST for [location]
Forecast Period: Next [X] hours
[Time 1]: Temp: [X]°C, Humidity: [Y]%, Rain: [Z]mm
[Time 2]: Temp: [X]°C, Humidity: [Y]%, Rain: [Z]mm
SUMMARY:
• Best travel window: [time range]
• Rain expected: [Yes/No]
```
**For Route Improvements (with comparison):**
```
ROUTE SUMMARY
Origin: [origin]
Destination: [destination]
Distance: [distance_km] km
Duration: [duration_min] min
{% if new_duration < old_duration %}
✓ IMPROVEMENT DETECTED:
This route saves approximately [old_duration - new_duration] minutes
compared to your previous one ([old_duration] min → [new_duration] min).
TRAFFIC: [traffic_level] - [advice]
WEATHER: [weather_conditions]
{% else %}
No faster alternative was found — your current route remains optimal
([old_duration] min). Traffic and weather conditions don’t justify a change.
TRAFFIC: [traffic_level] - [advice]
WEATHER: [weather_conditions]
{% endif %}
```
""" |