tom-doerr / zsh_codex

This is a ZSH plugin that enables you to use OpenAI's Codex AI in the command line.
MIT License
1.42k stars 72 forks source link

Installation #1

Closed ghost closed 2 years ago

ghost commented 3 years ago

N

tom-doerr commented 3 years ago

Do you have oh-my-zsh installed? It might be necessary for the plugin to work. https://ohmyz.sh/

tom-doerr commented 3 years ago

Did you follow the installation instructions again and tried to complete some text using Ctrl+x?

On Sun, Sep 26, 2021, 19:26 Eric @.***> wrote:

OK, that worked, how do I open zsh_codex, it only goes to the default git(main)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tom-doerr/zsh_codex/issues/1#issuecomment-927341101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFSYSFBQSHUDPMYVVFITUDLUD5JVXANCNFSM5EY4T5XQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

johnkegd commented 3 years ago

I followed all the steps and installed everything from the instructions but it still doesn't work trying to complete some text with Ctrl+x or anything. I like the idea. would be nice to test it.

tom-doerr commented 3 years ago

Do you get any output or is nothing happening at all?

On Mon, Sep 27, 2021, 19:01 John Garcia @.***> wrote:

I followed all the steps and installed everything from the instructions but it still doesn't work trying to complete some text with Ctrl+x or anything. I like the idea. would be nice to test it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tom-doerr/zsh_codex/issues/1#issuecomment-928073462, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFSYSFCV7HVIN6YL5L7QALDUECPODANCNFSM5EY4T5XQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

johnkegd commented 3 years ago

it's just showing the next message: No such shell function create_completion i'm using ZSH version: 5.8 Iterm2 version: 3.4.10 pip version: 21.2.4 openai last version

like this looks my oh-my-zsh plugins config plugins=( git zsh-syntax-highlighting zsh-autosuggestions zsh-codex bundler ) zle -N create_completion bindkey '^X' create_completion

i already check the repositories in ~/.oh-my-zsh/plugins and the Repo zsh_codex is there.

tom-doerr commented 3 years ago

Could you try to change zsh-codex to zsh_codex ? Also the plugin needs to be at ~/.oh-my-zsh/custom/plugins and not ~/.oh-my-zsh/plugins.

On Mon, Sep 27, 2021, 21:49 John Garcia @.***> wrote:

it's just showing the next message: No such shell function create_completion'` i'm using ZSH version: 5.8 Iterm2 version: 3.4.10 python version: 2.7.16 openai last version

like this looks my oh-my-zsh plugins config plugins=( git zsh-syntax-highlighting zsh-autosuggestions zsh-codex bundler ) zle -N create_completion bindkey '^X' create_completion

i already check the repositories in ~/.oh-my-zsh/plugins and the Repo zsh_codex is there.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tom-doerr/zsh_codex/issues/1#issuecomment-928216872, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFSYSFEPL2L366SXB4NAJULUEDDDXANCNFSM5EY4T5XQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

johnkegd commented 3 years ago

I already did it and it does not work. I had instinctively put it in the main plugins folder after the fatal destination path error was generated after trying to download it with the instructions in the documentation.

It must complete words after ctrl + x anywhere in the terminal? or what should be the behavior? not very clear with the gif example.

tom-doerr commented 3 years ago

Yes, it should always complete your text when you press ctrl + x. Could you add

plugins=(zsh_codex)
zle -N create_completion
bindkey '^X' create_completion

to the very end of your .zshrc? Maybe something gets overwritten by another plugin.

johnkegd commented 3 years ago

Well now it is trying to do something. create_completion.py", line 3, in <module> import openai ModuleNotFoundError: No module named 'openai'

tom-doerr commented 3 years ago

Try pip3 install openai

johnkegd commented 3 years ago

Thanks Tom, now it seems to be a problem with the engine davinci-codex.

line 67, in <module> response = openai.Completion.create(engine='davinci-codex', prompt=input_prompt, temperature=0.5, max_tokens=32, stream=STREAM)

line 31, in create return super().create(*args, **kwargs)

line 66, in create response, _, api_key = requestor.request( File "api_requestor.py", line 129, in request resp = self.interpret_response(rbody, rcode, rheaders, stream=stream)

line 348, in interpret_response return self.interpret_response_line(rbody, rcode, rheaders, stream)

line 367, in interpret_response_line raise self.handle_error_response( openai.error.InvalidRequestError: Engine not found

It works properly changing he engine='davinci-codex' to engine='davinci' openai default engine. I already tested it and works

but it should work with the engine='davinci-codex' right?

tom-doerr commented 3 years ago

Yes, it should. davinci is just the normal language model. You might be able to use this to complete the text in the shell, but I suspect it's far from the performance of Codex. To access davinci-codex you need to get Codex access from OpenAI, just having access to the normal API is not enough. https://openai.com/blog/openai-codex/

tom-doerr commented 3 years ago

Please comment again if you are still having issues.

tom-doerr commented 3 years ago

Could you post your ~/.zshrc?

tom-doerr commented 3 years ago

Traditionally it's located in your home directory (~). Do you mean by admin directory the home directory?

tom-doerr commented 3 years ago

Just to clarify: You home directory can very well be named admin. If you are not sure if this is your home directory, please run the commands pwd and echo ~ and post the outputs.

ghost commented 3 years ago

Screen Shot 2021-09-29 at 9 54 50 PM

tom-doerr commented 3 years ago

That looks good. Please go to ~/.oh-my-zsh/custom/plugins/zsh_codex and run the commands pwd and ls -la and send the ouput.

tom-doerr commented 3 years ago

Please run echo $ZSH_CUSTOM

tom-doerr commented 3 years ago

Please run echo $plugins.

tom-doerr commented 3 years ago

which create_completion

tom-doerr commented 3 years ago

It's a command :D Please run it.

tom-doerr commented 3 years ago

Please run

source ~/.oh-my-zsh/custom/plugins/zsh_codex/zsh_codex.plugin.zsh 
zle -N create_completion        
bindkey '^X' create_completion  

and then hit Ctrl + X to see what happens.

tom-doerr commented 3 years ago
cat ~/.oh-my-zsh/custom/plugins/zsh_codex/zsh_codex.plugin.zsh 
ghost commented 3 years ago

Screen Shot 2021-09-29 at 10 52 04 PM

tom-doerr commented 3 years ago

I'm starting to run out of ideas. We should be able to access the function create_completion after we loaded it using source ~/.oh-my-zsh/custom/plugins/zsh_codex/zsh_codex.plugin.zsh.

architkuiya commented 3 years ago

No such shell function 'create_completion'

I am getting the same problem.

JaskiratSudan commented 3 years ago

what do we have to write in organization_id?

tom-doerr commented 3 years ago

@JaskiratSudan The organization ID that OpenAI assigns to you. If you have access to Codex, you can find it here: https://beta.openai.com/account/api-keys

tom-doerr commented 3 years ago

@architkuiya What operating system are you using?

architkuiya commented 3 years ago

Parrot OS

@architkuiya What operating system are you using?

tom-doerr commented 2 years ago

@architkuiya When you run

source ~/.oh-my-zsh/custom/plugins/zsh_codex/zsh_codex.plugin.zsh 
zle -N create_completion        
bindkey '^X' create_completion  

do you get the same error as well?

architkuiya commented 2 years ago

create_completion:3: no such file or directory: /plugins/zsh_codex/create_completion.py

tom-doerr commented 2 years ago

Please try to set your ZSH_CUSTOM path using

export ZSH_CUSTOM=~/.oh-my-zsh/custom
rinshadka commented 2 years ago

Hi, I have been waiting long for the openai account , is there any one who got an account from them,

My plugin installation completed , only need to get secret/organization_id to try out this plugin

tom-doerr commented 2 years ago

@architkuiya Could you clone the repo again?

git clone https://github.com/tom-doerr/zsh_codex.git ~/.oh-my-zsh/custom/plugins/ 
architkuiya commented 2 years ago

@architkuiya Could you clone the repo again?

git clone https://github.com/tom-doerr/zsh_codex.git ~/.oh-my-zsh/custom/plugins/ 

fatal: destination path '/home/archit/.oh-my-zsh/custom/plugins' already exists and is not an empty directory.

no-vici commented 1 year ago

For those who got:

raise self.handle_error_response( openai.error.InvalidRequestError: The model: "code-davinci-002" does not exist

Just replace engine with model and code-davinci-002 with text-davinci-003 (latest).

Enjoy.