venkat-srinivasan-nexusflow commited on
Commit
4093962
Β·
verified Β·
1 Parent(s): ca9dc96

Update app.py

Browse files

Update app.py with the no-op support.

Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -63,6 +63,12 @@ FUNCTIONS = [
63
  description_function=lambda place_1, place_2: "Calculating distances",
64
  explanation_function=lambda result: result[2],
65
  ),
 
 
 
 
 
 
66
  Function(
67
  name="get_recommendations",
68
  short_description="Read recommendations",
@@ -510,7 +516,10 @@ class RavenDemo(gr.Blocks):
510
  results_str += f"Result {idx + 1}\n{item_str}\n"
511
 
512
  current_time = datetime.now().strftime("%b %d, %Y %H:%M:%S")
513
- current_location = self.tools.get_current_location()
 
 
 
514
 
515
  prompt = SUMMARY_MODEL_PROMPT.format(
516
  current_location=current_location,
@@ -587,4 +596,4 @@ if __name__ == "__main__":
587
  share=True,
588
  allowed_paths=["logo.png", "NexusRaven.png"],
589
  favicon_path="logo.png",
590
- )
 
63
  description_function=lambda place_1, place_2: "Calculating distances",
64
  explanation_function=lambda result: result[2],
65
  ),
66
+ Function(
67
+ name="irrelevant_query",
68
+ short_description="The provided query does not relate to locations, reviews, or recommendations.",
69
+ description_function=lambda user_query : "Irrelevant query detected.",
70
+ explanation_function = lambda user_query : "Irrelevant query detected."
71
+ ),
72
  Function(
73
  name="get_recommendations",
74
  short_description="Read recommendations",
 
516
  results_str += f"Result {idx + 1}\n{item_str}\n"
517
 
518
  current_time = datetime.now().strftime("%b %d, %Y %H:%M:%S")
519
+ try:
520
+ current_location = self.tools.get_current_location()
521
+ except:
522
+ current_location = "Current location not found."
523
 
524
  prompt = SUMMARY_MODEL_PROMPT.format(
525
  current_location=current_location,
 
596
  share=True,
597
  allowed_paths=["logo.png", "NexusRaven.png"],
598
  favicon_path="logo.png",
599
+ )