prige commited on
Commit
dee5736
·
verified ·
1 Parent(s): 520b75d

Upload tool

Browse files
Files changed (1) hide show
  1. tool.py +3 -3
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 = "" # Initialize user_input as an instance variable
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}"