restructure init statement to remove duplicate call to _generate_description

This commit is contained in:
Carter Chen
2025-01-14 21:16:11 -05:00
parent 1568008db6
commit fe2a5abf8d

View File

@@ -45,11 +45,11 @@ class FileReadTool(BaseTool):
this becomes the default file path for the tool. this becomes the default file path for the tool.
**kwargs: Additional keyword arguments passed to BaseTool. **kwargs: Additional keyword arguments passed to BaseTool.
""" """
super().__init__(**kwargs)
if file_path is not None: if file_path is not None:
self.file_path = file_path kwargs['description'] = f"A tool that reads file content. The default file is {file_path}, but you can provide a different 'file_path' parameter to read another file."
self.description = f"A tool that reads file content. The default file is {file_path}, but you can provide a different 'file_path' parameter to read another file."
self._generate_description() super().__init__(**kwargs)
self.file_path = file_path
def _run( def _run(
self, self,