-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
GPT-3.5 #1365
base: master
Are you sure you want to change the base?
GPT-3.5 #1365
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.
Hi!
This effort is admirable. And I don't want to rain on your parade, but I'm here to tell you this won't be merged. Main reasons are detailed below.
I encourage you to create a new project that uses The Fuck but offers the suggested rule (and some others) as an extra.
The following rule uses OpenAI ChatGPT. To enable it, you need to set the environment variable `THEFUCK_OPENAI_TOKEN=<OpenAI Token>` and pass in `--chatgpt [No. SUGGESTIONS >= 1]`: | ||
|
||
- `chatgpt` – queries ChatGPT for suggestions. Arguments: `--chatgpt [No. SUGGESTIONS, default=0] --chatgpt-token [default=100] --chatgpt-model [default="gpt-3.5-turbo"]`. | ||
|
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.
This is very different from any other user interaction with The Fuck.
@@ -1,4 +1,8 @@ | |||
#!/bin/sh | |||
#!/bin/zsh |
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.
This should not be part of the pull request.
echo "" | ||
echo "To install from sources run:" | ||
echo "python setup.py build && python setup.py install" | ||
python setup.py build && python setup.py install |
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.
If a user comes to this point they know how to install things in their Python environment (or virtual environment). There's no intention of recommending anything at this point.
Also, this should not be part of the pull request.
@@ -9,3 +9,4 @@ pypandoc | |||
pytest-benchmark | |||
pytest-docker-pexpect | |||
twine | |||
openai |
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.
The introduction of a new hard dependency has huge consequences downstream. Not to mention this is a dependency for something optional.
@@ -31,7 +31,7 @@ | |||
' ({}.{} detected).'.format(*version)) | |||
sys.exit(-1) | |||
|
|||
VERSION = '3.32' | |||
VERSION = '3.33' |
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.
A new release is always decoupled of specific changes.
# todo Secret parameters only revealed with `thefuck --help --chatgpt` | ||
# self._parser.add_argument( | ||
# '-t', '--chatgpt-token', | ||
# type=int, | ||
# default=400, | ||
# help='maximum ChatGPT tokens per query' | ||
# ) | ||
# self._parser.add_argument( | ||
# '-m', '--chatgpt-model', | ||
# type=str, | ||
# default="gpt-3.5-turbo", | ||
# help='ChatGPT model' | ||
# ) |
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.
Commented code is dead code. Commented code should never be committed.
command: str, | ||
error: str, | ||
explanation: bool, # can be used to include explanations but not used yet | ||
number: int = MAX_NUMBER, | ||
model: str = MODEL, | ||
max_tokens: int = MAX_TOKENS, | ||
api_key: str = None, |
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.
Nowhere else in The Fuck's code there's use of such syntax. This code would be very alien to the existing code base and therefore awckward to maintain, to say the least.
if settings["chatgpt"] > 0 and (api_key or openai.api_key): | ||
return True | ||
return False |
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.
if settings["chatgpt"] > 0 and (api_key or openai.api_key): | |
return True | |
return False | |
return settings["chatgpt"] > 0 and (api_key or openai.api_key) |
cleaned_contents = [re.sub(pattern, "", item).strip('`') for item in contents] | ||
return cleaned_contents |
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.
Return a generator instead. That's how The Fuck is designed.
For inspiration (in case this PR gets improved and polished):
|
Streamlined integration of openai adapter