taspol commited on
Commit
f17376b
·
1 Parent(s): a79ae89

fix: dependency

Browse files
Files changed (1) hide show
  1. utils/llm_caller.py +20 -7
utils/llm_caller.py CHANGED
@@ -24,7 +24,7 @@ class LLMCaller:
24
  api_key=os.getenv("SEALION_API"),
25
  base_url=os.getenv("SEALION_BASE_URL"),
26
  )
27
- self.top_k = 3
28
  self.qdrant_host = os.getenv("QDRANT_HOST")
29
  self.qdrant = RestQdrantClient(
30
  url=self.qdrant_host,
@@ -87,7 +87,7 @@ class LLMCaller:
87
 
88
  # 3. Search Qdrant for similar content
89
  collection = collection_name or self.collection_name
90
- top_k = plan_request.top_k or self.top_k
91
 
92
  search_results = self.qdrant.search(
93
  collection_name=collection,
@@ -282,15 +282,28 @@ class LLMCaller:
282
  print(f"Error parsing LLM JSON response: {e}")
283
  print(f"LLM Response: {llm_response}")
284
 
285
- # Fallback: create basic response with LLM text
 
 
 
 
 
 
 
 
 
286
  return PlanResponse(
287
- tripOverview=llm_response,
288
  query_params=plan_request,
289
  retrieved_data=retrieved_data,
290
  trip_plan=TripPlan(
291
- overview="Generated plan (parsing error)",
292
- total_estimated_cost=budget,
293
- steps=[]
 
 
 
 
294
  ),
295
  meta={"status": "json_parse_error", "error": str(e)}
296
  )
 
24
  api_key=os.getenv("SEALION_API"),
25
  base_url=os.getenv("SEALION_BASE_URL"),
26
  )
27
+ self.top_k = 1
28
  self.qdrant_host = os.getenv("QDRANT_HOST")
29
  self.qdrant = RestQdrantClient(
30
  url=self.qdrant_host,
 
87
 
88
  # 3. Search Qdrant for similar content
89
  collection = collection_name or self.collection_name
90
+ top_k = self.top_k
91
 
92
  search_results = self.qdrant.search(
93
  collection_name=collection,
 
282
  print(f"Error parsing LLM JSON response: {e}")
283
  print(f"LLM Response: {llm_response}")
284
 
285
+ # Fix: Create proper fallback TripPlan with all required fields
286
+ fallback_budget = Budget(
287
+ transport=0.0,
288
+ entrance=0.0,
289
+ meals=0.0,
290
+ accommodation=0.0,
291
+ activities=0.0,
292
+ total=0.0
293
+ )
294
+
295
  return PlanResponse(
296
+ tripOverview=llm_response[:500] + "..." if len(llm_response) > 500 else llm_response,
297
  query_params=plan_request,
298
  retrieved_data=retrieved_data,
299
  trip_plan=TripPlan(
300
+ title=f"Generated plan for {destination} (parsing error)",
301
+ date=plan_request.travelDates or "Flexible",
302
+ timeline=[],
303
+ spots=[],
304
+ budget=fallback_budget,
305
+ permits=None,
306
+ safety=None
307
  ),
308
  meta={"status": "json_parse_error", "error": str(e)}
309
  )