Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -686,4 +686,50 @@ class PathFinding(smolagents.tools.Tool):
|
|
| 686 |
output_type = "object"
|
| 687 |
|
| 688 |
def forward(self, destination: str) -> str:
|
| 689 |
-
return path_human(destination, source=None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 686 |
output_type = "object"
|
| 687 |
|
| 688 |
def forward(self, destination: str) -> str:
|
| 689 |
+
return path_human(destination, source=None)
|
| 690 |
+
|
| 691 |
+
techspark_definition = """
|
| 692 |
+
TechSpark is the largest makerspace at CMU (Carnegie Mellon University), located in the College of Engineering. 
|
| 693 |
+
Its mission is to promote a vibrant, student-centric making culture to enhance educational, extracurricular, and research activities across the entire campus community.
|
| 694 |
+
"""
|
| 695 |
+
|
| 696 |
+
instruction = """
|
| 697 |
+
You are a helpful assistant for the CMU TechSpark facility. Your purpose is to assist users with inquiries related to staff, courses, and tools.
|
| 698 |
+
Use the available tools to find information about staff members, suggest suitable staff based on skills, or provide training information for machines.
|
| 699 |
+
Respond concisely and directly with the information requested by the user, utilizing the output from the tools.
|
| 700 |
+
Which machines to use for a task, and where to find them.
|
| 701 |
+
When you were in doubt, try searching wikipedia to gain more knowledge.
|
| 702 |
+
|
| 703 |
+
Safety is important. So:
|
| 704 |
+
- When talking about any machines, check whether it is accessbile to students or not.
|
| 705 |
+
- Try to match them to correct staff member specially when you are not sure about your answer or the student work might be dangerous. It is always a good idea to suggest some staff members if they can help and validate users request.
|
| 706 |
+
"""
|
| 707 |
+
|
| 708 |
+
system_prompt = f"""
|
| 709 |
+
{techspark_definition}
|
| 710 |
+
{instruction}
|
| 711 |
+
"""
|
| 712 |
+
|
| 713 |
+
model = smolagents.OpenAIServerModel(
|
| 714 |
+
model_id="gpt-4.1-mini",
|
| 715 |
+
api_key=OPENAI_API,
|
| 716 |
+
)
|
| 717 |
+
|
| 718 |
+
agent = smolagents.CodeAgent(
|
| 719 |
+
tools=[
|
| 720 |
+
smolagents.FinalAnswerTool(),
|
| 721 |
+
SearchStaffInformation(),
|
| 722 |
+
FindSuitableStaff(),
|
| 723 |
+
SearchCourseInformation(),
|
| 724 |
+
FindSuitableCourses(),
|
| 725 |
+
SearchMachineLocation(),
|
| 726 |
+
CheckMachineAccessibility(),
|
| 727 |
+
WikipediaSearch(),
|
| 728 |
+
PathFinding(),
|
| 729 |
+
],
|
| 730 |
+
instructions=system_prompt,
|
| 731 |
+
model=model,
|
| 732 |
+
add_base_tools=False,
|
| 733 |
+
max_steps=10,
|
| 734 |
+
verbosity_level=2, # show steps in logs for class demo
|
| 735 |
+
)
|