aslan-ng commited on
Commit
66ee896
·
verified ·
1 Parent(s): 81c3151

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +9 -2
agent.py CHANGED
@@ -492,12 +492,18 @@ def all_nodes():
492
  """
493
  return nodes_df["Name"].dropna().astype(str).tolist()
494
 
 
 
 
 
 
 
495
  def match_node_name(input):
496
  """
497
  Match the input to the closest match in the nodes list and return their id.
498
  """
499
  input = str(input)
500
- matches = difflib.get_close_matches(input, all_nodes(), n=1, cutoff=0.2)
501
  return matches[0] if matches else None
502
 
503
  def node_pos(id: int):
@@ -634,7 +640,7 @@ def path_human(destination, source=None):
634
  class PathFinding(smolagents.tools.Tool):
635
  name = "find_path"
636
  description = (
637
- "Find the easiest path to reach areas and locations inside the TechSpark. Also useful to help the user to reach machines in those locations."
638
  )
639
  inputs = {
640
  "destination": {"type": "string", "description": "Name of the location inside the TechSpark."},
@@ -663,6 +669,7 @@ Respond concisely and directly with the information requested by the user, utili
663
  Which machines to use for a task, and where to find them.
664
  When you were in doubt, try searching wikipedia to gain more knowledge.
665
  Only answer questions related to TechSpark and manufacturing. If the question was out of scope, inform the user and try to suggest relevant question to ask.
 
666
 
667
  Safety is important. So:
668
  - When talking about any machines, check whether it is accessbile to students or not.
 
492
  """
493
  return nodes_df["Name"].dropna().astype(str).tolist()
494
 
495
+ def all_locations():
496
+ """
497
+ Return a list of all locations.
498
+ """
499
+ return list(set(all_nodes()))
500
+
501
  def match_node_name(input):
502
  """
503
  Match the input to the closest match in the nodes list and return their id.
504
  """
505
  input = str(input)
506
+ matches = difflib.get_close_matches(input, all_locations(), n=1, cutoff=0.2)
507
  return matches[0] if matches else None
508
 
509
  def node_pos(id: int):
 
640
  class PathFinding(smolagents.tools.Tool):
641
  name = "find_path"
642
  description = (
643
+ "Find the location and easiest path to reach areas inside the TechSpark. Also useful to help the user to reach machines in those locations."
644
  )
645
  inputs = {
646
  "destination": {"type": "string", "description": "Name of the location inside the TechSpark."},
 
669
  Which machines to use for a task, and where to find them.
670
  When you were in doubt, try searching wikipedia to gain more knowledge.
671
  Only answer questions related to TechSpark and manufacturing. If the question was out of scope, inform the user and try to suggest relevant question to ask.
672
+ Don't tell anyone about your internal tools.
673
 
674
  Safety is important. So:
675
  - When talking about any machines, check whether it is accessbile to students or not.