feat: debuging
Browse files- interface.py +2 -0
- utils/llm_caller.py +10 -2
interface.py
CHANGED
@@ -53,6 +53,8 @@ class Timeline(BaseModel):
|
|
53 |
|
54 |
class Spot(BaseModel):
|
55 |
name: str = Field(..., description="Location name")
|
|
|
|
|
56 |
time: str = Field(..., description="Time range like '09:30 – 11:45'")
|
57 |
notes: str = Field(..., description="Description and tips")
|
58 |
|
|
|
53 |
|
54 |
class Spot(BaseModel):
|
55 |
name: str = Field(..., description="Location name")
|
56 |
+
latitude: Optional[float] = Field(None, description="Latitude coordinate")
|
57 |
+
longitude: Optional[float] = Field(None, description="Longitude coordinate")
|
58 |
time: str = Field(..., description="Time range like '09:30 – 11:45'")
|
59 |
notes: str = Field(..., description="Description and tips")
|
60 |
|
utils/llm_caller.py
CHANGED
@@ -125,6 +125,14 @@ class LLMCaller:
|
|
125 |
score=result.get('score', 0.0),
|
126 |
)
|
127 |
retrieved_data.append(retrieved_item)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
# Build context from all relevant fields in payload
|
130 |
context_fields = [
|
@@ -132,7 +140,7 @@ class LLMCaller:
|
|
132 |
f"Start: {payload.get('start_place', {}).get('name', '')}" if isinstance(payload.get('start_place'), dict) else "",
|
133 |
f"Destination: {payload.get('destination_place', {}).get('name', '')}" if isinstance(payload.get('destination_place'), dict) else "",
|
134 |
f"Country: {payload.get('country', '')}",
|
135 |
-
|
136 |
f"Duration: {payload.get('duration', '')} days" if payload.get('duration') else "",
|
137 |
f"Budget: {payload.get('budget', '')} THB" if payload.get('budget') else "",
|
138 |
f"Transportation: {payload.get('transportation', '')}",
|
@@ -232,7 +240,7 @@ class LLMCaller:
|
|
232 |
|
233 |
# Parse spots
|
234 |
spots_data = trip_plan_data.get("spots", [])
|
235 |
-
spots = [Spot(name=item["name"], time=item["time"], notes=item["notes"]) for item in spots_data]
|
236 |
|
237 |
# Parse budget
|
238 |
budget_data = trip_plan_data.get("budget", {})
|
|
|
125 |
score=result.get('score', 0.0),
|
126 |
)
|
127 |
retrieved_data.append(retrieved_item)
|
128 |
+
visited_places
|
129 |
+
if isinstance(payload.get('visited_place'), list):
|
130 |
+
visited_places = "Visited: " + ", ".join(
|
131 |
+
[
|
132 |
+
f"{p.get('name', '')} (lat: {p.get('latitude', '')}, lon: {p.get('longitude', '')})"
|
133 |
+
for p in payload.get('visited_place', [])
|
134 |
+
]
|
135 |
+
)
|
136 |
|
137 |
# Build context from all relevant fields in payload
|
138 |
context_fields = [
|
|
|
140 |
f"Start: {payload.get('start_place', {}).get('name', '')}" if isinstance(payload.get('start_place'), dict) else "",
|
141 |
f"Destination: {payload.get('destination_place', {}).get('name', '')}" if isinstance(payload.get('destination_place'), dict) else "",
|
142 |
f"Country: {payload.get('country', '')}",
|
143 |
+
visited_places,
|
144 |
f"Duration: {payload.get('duration', '')} days" if payload.get('duration') else "",
|
145 |
f"Budget: {payload.get('budget', '')} THB" if payload.get('budget') else "",
|
146 |
f"Transportation: {payload.get('transportation', '')}",
|
|
|
240 |
|
241 |
# Parse spots
|
242 |
spots_data = trip_plan_data.get("spots", [])
|
243 |
+
spots = [Spot(name=item["name"], latitude=item.get("latitude"), longitude=item.get("longitude"), time=item["time"], notes=item["notes"]) for item in spots_data]
|
244 |
|
245 |
# Parse budget
|
246 |
budget_data = trip_plan_data.get("budget", {})
|