-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Switch git commit to use gpt-35-turbo by default #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary by GPT-4
I have added the gpt4
and large
arguments to the git commit
command. The gpt4
argument is used to specify whether to use gpt-4 for generating commit messages instead of gpt-35-turbo, and the large
argument is used to specify whether to use the gpt-4-32k model for generating commit messages. Both arguments are optional and default to False.
Here's a summary of the changes:
- Modified the
_commit_message()
function definition to accept two optional arguments:gpt4
andlarge
. - Updated the
_commit()
function definition to accept two optional arguments:gpt4
andlarge
. These arguments are passed down to_commit_message()
. - Added a new static method called
load_arguments()
in theGitCommandGroup
class, which defines the new arguments for the "git commit" command. - Updated test cases in
tests/test_gpt_cli.py
.
You can now use these new options with the git commit command like this:
gpt git commit --gpt4
or
gpt git commit --large
Suggestions
Here are some suggestions for improving the changes in this PR:
- Add docstrings for the
_commit
function to explain its purpose, arguments, and return value. - In the
load_arguments
method, consider adding a more detailed help message for thegpt4
andlarge
arguments to explain their effects on the commit message generation process. - Add test cases for the new
gpt4
andlarge
arguments in theGIT_COMMANDS
list.
Here's how the changes could look like:
def _commit(gpt4: bool = False, large: bool = False) -> Dict[str, str]:
"""
Run git commit with a commit message generated by GPT.
Args:
gpt4 (bool): If True, use gpt-4 for generating commit messages instead of gpt-35-turbo.
large (bool): If True, use gpt-4-32k model for generating commit messages.
Returns:
response (dict): The response from GPT-4.
"""
message = _commit_message(gpt4=gpt4, large=large)
# ...
# ...
def load_arguments(loader: CLICommandsLoader) -> None:
with ArgumentsContext(loader, "git commit") as args:
args.argument(
"gpt4",
help="Use gpt-4 for generating commit messages instead of gpt-35-turbo. This may result in more accurate but slower generation.",
default=False,
action="store_true",
)
args.argument(
"large",
help="Use gpt-4-32k model for generating commit messages. This may result in more accurate but slower generation.",
default=False,
action="store_true",
)
# ...
GIT_COMMANDS = [
CLICase("git commit --help"),
# CLICase("git commit"),
# CLICase("git commit --large"),
# CLICase("git commit --gpt4"),
# CLICase("git commit --gpt4 --large"),
]
These suggestions should improve code readability and provide better context to users when using the new arguments.
Codecov Report
@@ Coverage Diff @@
## main #59 +/- ##
==========================================
- Coverage 86.47% 85.17% -1.31%
==========================================
Files 13 13
Lines 392 398 +6
Branches 59 61 +2
==========================================
Hits 339 339
- Misses 37 44 +7
+ Partials 16 15 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Description
Testing
Additional context