Spaces:
Build error
Build error
Upload tool
Browse files
tool.py
CHANGED
|
@@ -13,9 +13,9 @@ class UserInputTool(Tool):
|
|
| 13 |
import logging
|
| 14 |
self.logger = logging.getLogger(__name__)
|
| 15 |
self.logger.setLevel(logging.INFO)
|
| 16 |
-
self.user_input = ""
|
| 17 |
|
| 18 |
-
def _validate_question(self, question) -> tuple[bool, str]:
|
| 19 |
# Helper method to validate the question
|
| 20 |
if not isinstance(question, str):
|
| 21 |
return False, f"Question must be a string, got {type(question)}"
|
|
@@ -25,7 +25,7 @@ class UserInputTool(Tool):
|
|
| 25 |
|
| 26 |
async def forward(self, question: str) -> str:
|
| 27 |
# Validate the question first
|
| 28 |
-
success, response = self._validate_question(question)
|
| 29 |
if not success:
|
| 30 |
self.logger.error(response)
|
| 31 |
return f"Error: {response}"
|
|
|
|
| 13 |
import logging
|
| 14 |
self.logger = logging.getLogger(__name__)
|
| 15 |
self.logger.setLevel(logging.INFO)
|
| 16 |
+
self.user_input = ""
|
| 17 |
|
| 18 |
+
async def _validate_question(self, question) -> tuple[bool, str]:
|
| 19 |
# Helper method to validate the question
|
| 20 |
if not isinstance(question, str):
|
| 21 |
return False, f"Question must be a string, got {type(question)}"
|
|
|
|
| 25 |
|
| 26 |
async def forward(self, question: str) -> str:
|
| 27 |
# Validate the question first
|
| 28 |
+
success, response = await self._validate_question(question)
|
| 29 |
if not success:
|
| 30 |
self.logger.error(response)
|
| 31 |
return f"Error: {response}"
|