Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

GPT-3.5 #1365

wants to merge 3 commits into from

Conversation

pannous
Copy link

@pannous pannous commented Mar 4, 2023

Streamlined integration of openai adapter

Copy link
Collaborator

@scorphus scorphus left a 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` &ndash; queries ChatGPT for suggestions. Arguments: `--chatgpt [No. SUGGESTIONS, default=0] --chatgpt-token [default=100] --chatgpt-model [default="gpt-3.5-turbo"]`.

Copy link
Collaborator

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
Copy link
Collaborator

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.

Comment on lines +5 to +8
echo ""
echo "To install from sources run:"
echo "python setup.py build && python setup.py install"
python setup.py build && python setup.py install
Copy link
Collaborator

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
Copy link
Collaborator

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'
Copy link
Collaborator

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.

Comment on lines +46 to +58
# 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'
# )
Copy link
Collaborator

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.

Comment on lines +39 to +45
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,
Copy link
Collaborator

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.

Comment on lines +11 to +13
if settings["chatgpt"] > 0 and (api_key or openai.api_key):
return True
return False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Comment on lines +73 to +74
cleaned_contents = [re.sub(pattern, "", item).strip('`') for item in contents]
return cleaned_contents
Copy link
Collaborator

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.

@dbast
Copy link

dbast commented Aug 2, 2023

For inspiration (in case this PR gets improved and polished):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants