Spaces:
Runtime error
Runtime error
| from typing import Any, Optional | |
| from smolagents.tools import Tool | |
| class UserInputTool(Tool): | |
| name = "user_input_tool" | |
| description = """ | |
| This tool handles user interaction. Specifically, it allows asking user a question and waiting for their response. | |
| Before asking user a question, it is important to provide context on why this questions should be asked -- explain the "context" | |
| This should only be called when asking a question yields good utility, and importantly please dont ask too many questions together. | |
| """ | |
| inputs = {'context': {'type': 'string', 'description': 'The context to explain why this question should be asked. This should e.g. concisely summarize the current context in a friendly and constructive way.'}, 'question': {'type': 'string', 'description': 'The question to ask the user.'}} | |
| output_type = "string" | |
| def forward(self, context, question): | |
| user_input = f"{context} \n {question}" | |
| return user_input | |
| def __init__(self, *args, **kwargs): | |
| self.is_initialized = False | |