Add view_commit_details_for_file function to GitHubTool
This commit is contained in:
@@ -150,6 +150,21 @@ class GitHubTool(BaseTool):
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
"name": "view_commit_details_for_file",
|
||||
"description": "View commit history and details for a specific file, including commit messages.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"file_path": {"type": "string", "description": "Path to the file in the repository"},
|
||||
"num_commits": {"type": "integer", "description": "Number of commits to retrieve", "default": 10}
|
||||
},
|
||||
"required": ["file_path"]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": {
|
||||
@@ -571,6 +586,8 @@ class GitHubTool(BaseTool):
|
||||
return self._search_code(kwargs["query"])
|
||||
elif function_name == "get_commit_history":
|
||||
return self._get_commit_history(kwargs["file_path"], kwargs.get("num_commits", 10))
|
||||
elif function_name == "view_commit_details_for_file":
|
||||
return self._view_commit_details_for_file(kwargs["file_path"], kwargs.get("num_commits", 10))
|
||||
elif function_name == "get_current_branch":
|
||||
return self._get_current_branch()
|
||||
elif function_name == "set_current_branch":
|
||||
@@ -793,6 +810,11 @@ class GitHubTool(BaseTool):
|
||||
self.logger.error(error_message)
|
||||
return error_message
|
||||
|
||||
@metrics.measure
|
||||
def _view_commit_details_for_file(self, file_path, num_commits):
|
||||
self.logger.info(f"Viewing commit details for file: {file_path}, number of commits: {num_commits} (via _get_commit_history)")
|
||||
return self._get_commit_history(file_path, num_commits)
|
||||
|
||||
@metrics.measure
|
||||
def _get_current_branch(self):
|
||||
self.logger.info(f"Getting current branch: {self.current_branch}")
|
||||
|
||||
Reference in New Issue
Block a user