Spaces:
Sleeping
Sleeping
| from smolagents import Tool | |
| from typing import Any, Optional | |
| class SimpleTool(Tool): | |
| name = "get_user_background" | |
| description = "Retrieves a user's background information based on their name, \nproviding a personalized experience." | |
| inputs = {"name":{"type":"string","description":"The name of the person to look up."}} | |
| output_type = "string" | |
| def forward(self, name: str) -> str: | |
| """ | |
| Retrieves a user's background information based on their name, | |
| providing a personalized experience. | |
| Args: | |
| name: The name of the person to look up. | |
| Returns: | |
| str: A brief description of the user's background and interests, | |
| or a default message if the user is not found. | |
| """ | |
| database = { | |
| "sayed": "Sayed is a data scientist in his final year of engineering. He is not a dog person. He is eager to learn about AI agents, LLMs, Azure Cloud, and computer vision topics like tracking.", | |
| "sara": "Sara is a medical student specializing in neurology. She is passionate about brain-computer interfaces, neuroimaging, and understanding cognitive disorders. She loves cats.", | |
| "ahmed": "Ahmed is an economist focusing on financial markets and behavioral economics. He enjoys analyzing stock trends, economic policies, and market predictions using data-driven methods." | |
| } | |
| name_lower = name.lower() | |
| return database.get(name_lower, f"Hello, {name.title()}! I don't have details about you yet, but I'd love to learn more.") |