vim_codex icon indicating copy to clipboard operation
vim_codex copied to clipboard

Error while processing function CreateCompletion

Open User1391 opened this issue 2 years ago • 8 comments

Here is the error message when running CreateCompletion

Error detected while processing function CreateCompletion: Traceback (most recent call last): File "<string>", line 1, in <module> NameError: name 'plugin' is not defined

User1391 avatar Dec 13 '22 18:12 User1391

How did you add the plugin to vim?

tom-doerr avatar Dec 14 '22 23:12 tom-doerr

Using Plug

User1391 avatar Dec 15 '22 00:12 User1391

No idea what the issue is, maybe you could just reinstall it. If that doesn't work, please send me the exact Plug line, path of the installed plugin on the filesystem and the output of the ls -la * command in that path.

tom-doerr avatar Dec 15 '22 01:12 tom-doerr

I just ran into this issue as well, and uninstalling + reinstalling didn't fix it. I'm using vim-plug to install in the usual way, and I see that an error flashes across the installation screen when this happens (too quick for me to read). my macOS Vim installation seems to have python3 support,

$ vim --version | grep "+python"
+cmdline_info      +libcall           +python3           +virtualedit

but I'm also seeing that the plugin seems to look for the openai installation in a way that is incompatible with pyenv, i.e., I've just done pip install openai, which installs the package in my "global" virtualenv -- not sure if this is related.

I guess https://github.com/tom-doerr/vim_codex/blob/main/plugin/vim_codex.vim#L20 is what's obviously failing but I'm not sure why

nhejazi avatar Jan 07 '23 23:01 nhejazi

Could you try installing openai in a virtualenv and running vim inside that?

tom-doerr avatar Jan 09 '23 01:01 tom-doerr

@tom-doerr I faced the same problem. But it happens randomly. When I ask for an auto completion with "Ctrl+X" and then I continue asking again then it randomly appears and goes away if I give it a pause. I think it should be about handling some errors/statuses that the API returns.

pooyaww avatar Feb 03 '23 15:02 pooyaww

Actually I have the same problem. I've just installed vim_codex, using the way specified in the documentation, so it is in my ~/.vim/bundle/vim_codex directory. Then I installed openai, and I have the same error.

tothlac avatar Feb 03 '23 22:02 tothlac

In my case it seems there is a limitation on API calls and not related to NameError: name plugin is not defined:

raise self.handle_error_response(
openai.error.RateLimitError: Rate limit reached for default-codex in organization org-xOr2p41SW53e8dvuSWUTdryJ on requests per min. Limit: 20.
000000 / min. Current: 30.000000 / min. Contact [email protected] if you continue to have issues or if you’d like to request an increase. Ple
ase add a payment method to your account to increase your rate limit. Visit https://platform.openai.com/account/billing to add a payment metho
d.

pooyaww avatar Feb 04 '23 13:02 pooyaww