Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -67,6 +67,60 @@ def calculate_risk_metrics(
|
|
67 |
|
68 |
return var_value, es_value
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
@tool
|
71 |
def get_current_time_in_timezone(timezone: str) -> str:
|
72 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
67 |
|
68 |
return var_value, es_value
|
69 |
|
70 |
+
my_info = {
|
71 |
+
"name": "Tianqing LIU",
|
72 |
+
"age": 30,
|
73 |
+
"location": "Paris, France",
|
74 |
+
"occupation": "Product Manager at MA",
|
75 |
+
"education": "Master's in Computer Science",
|
76 |
+
"skills": ["Python", "Machine Learning", "Data Analysis","Product Management","Agile Development","Risk Management"],
|
77 |
+
"hobbies": ["Reading", "Hiking", "Crossfit"],
|
78 |
+
"contact": {
|
79 |
+
"email": "[email protected]",
|
80 |
+
"linkedin": "https://www.linkedin.com/in/liutianqing/",
|
81 |
+
"github": "https://liuti-ma.github.io/CV/",
|
82 |
+
"website": "https://www.liutianqing.com"
|
83 |
+
}
|
84 |
+
}
|
85 |
+
@tool
|
86 |
+
def provide_my_information(query: str) -> str:
|
87 |
+
"""
|
88 |
+
Provide information about me (Tianqing LIU)based on the user's query.
|
89 |
+
|
90 |
+
Args:
|
91 |
+
query: The user's question or request for information.
|
92 |
+
|
93 |
+
Returns:
|
94 |
+
str: A response containing the requested information.
|
95 |
+
"""
|
96 |
+
# Convert the query to lowercase for case-insensitive matching
|
97 |
+
query = query.lower()
|
98 |
+
|
99 |
+
# Check for specific keywords in the query and return the corresponding information
|
100 |
+
if "name" in query:
|
101 |
+
return f"My name is {my_info['name']}."
|
102 |
+
elif "age" in query:
|
103 |
+
return f"I am {my_info['age']} years old."
|
104 |
+
elif "location" in query:
|
105 |
+
return f"I am located in {my_info['location']}."
|
106 |
+
elif "occupation" in query or "job" in query or "work" in query:
|
107 |
+
return f"I work as a {my_info['occupation']}."
|
108 |
+
elif "education" in query or "degree" in query:
|
109 |
+
return f"I have a {my_info['education']}."
|
110 |
+
elif "skills" in query or "what can you do" in query:
|
111 |
+
return f"My skills include: {', '.join(my_info['skills'])}."
|
112 |
+
elif "hobbies" in query or "interests" in query:
|
113 |
+
return f"My hobbies are: {', '.join(my_info['hobbies'])}."
|
114 |
+
elif "contact" in query or "email" in query or "linkedin" in query or "github" in query:
|
115 |
+
contact_info = my_info["contact"]
|
116 |
+
return (
|
117 |
+
f"You can contact me via email at {contact_info['email']}, "
|
118 |
+
f"connect with me on LinkedIn at {contact_info['linkedin']}, "
|
119 |
+
f"or check out my GitHub profile at {contact_info['github']}."
|
120 |
+
)
|
121 |
+
else:
|
122 |
+
return "I'm sorry, I don't have information on that. Please ask about my name, age, location, occupation, education, skills, hobbies, or contact details."
|
123 |
+
|
124 |
@tool
|
125 |
def get_current_time_in_timezone(timezone: str) -> str:
|
126 |
"""A tool that fetches the current local time in a specified timezone.
|