Hi nice idea !
i will try this code, but i have got a “invalid YAML” in popclip no install message.
Hi nice idea !
What PopClip version are your running? You will need the latest, v2022.12.
Hi! In the snippet above, where do I enter my API key?? Thanks!
The snippet defines a configuration option for entering the API key. You should see the window to enter it after you install the extension. Thus:
I think a fixed prompt version of this may be very useful. Just as a proof of concept:
Example (with the default prompt “Summarise the following in fewer words”):
I used this same concept to make a German Sentence Case extension.
Hey @nick, Not sure what I’m doing wrong. For me it spins a bit but nothing happens. The API seems be called as indicated by OpenAI (key has been used). Any places I might check?
You could enable extension debug output by pasting the following command in Terminal:
defaults write com.pilotmoon.popclip EnableExtensionDebug -bool YES
then Quit and restart PopClip.
com.pilotmoon.popclip-setapp if using Setapp edition)
Then open Console app and set the following filters
Now set Console to “Start” & “Now” you should see the API calls going in and the responses. You can also add debug using
print(), e.g. such as
print("varname:", varname); in the code if that helps.
Thanks @nick, that helped. Turns out my paid ChatGPT account didn’t cover API calls; I needed to add that separately. Now it seems to work.
Ahh! Good to know. I have the paid ChatGPT too and wasn’t sure whether that linked up with the API service. So they are separate.
Looks like the API comes with 3 months free credit then you have to pay on a per usage model at $0.02 per 1000 tokens (1 token = about half a word).
Interesting! I’m still getting used to ChatGPT and to think of new possibilities, it’s such an amazing tool. It would be nice to have a more versatile plugin where you can predefine multiple prompts, like “Summarize” or “Translate to Dutch”, essentially any prompt that someone can come up with. Just floating there idea out here…
This is great. Thanks for putting the extension together @nick! I’ve been using the shortcut that’s been floating around but super handy to have the direct code (davinci-003) in popclip.
Ooh. Here are the docs. A quick first attempt using the simplest possible approach:
It uses the newly released
gpt-3.5-turbo model, but it only works as a “one shot” question i.e. it doesn’t remember what the previous chat was. I need to look a bit more closely to see how to do that.
OK, here is a snippet for the “real thing” ChatGPT, that you can actually chat with.
Update, 3 Mar 2023: A pre-packaged version of this extension is now available.
To use it, you’ll need to sign up for an OpenAI platform account, and get your own API key from https://platform.openai.com/account/api-keys .
How to install it:
Note there are two actions, Chat and Reset.
Chat (main icon): Type your message in any text field, select it so PopClip appears and choose the Chat action. After ChatGPT responds, type your response and repeat.
Reset (broom icon): click it whenever you need to start a new chat and forget the previous responses.
I had to break out the module syntax (which I still haven’t properly documented) for this one because the extension itself has to remember the past messages in the chat and provide the whole thing to the API each time. But it’s really a very straightforward API to use.
2 posts were split to a new topic: “XmlHTTPRequest is not allowed here”
Since the ChatGPT extension seems to be working well and is getting pretty popular, I’ve created an “official” downloadable version and added it to the main extension directory.
The new version includes a few refinements over the one in this thread. See forum post.
Bizarrely, it doesn’t work for me.
I put an API Key and I’m getting no answer. I tried in Notes, Word…etc…
Ps: I have a ChatGPT Plus account but not a Paid API account but I understand I don’t need one?
Fairly sure you need to have a paid API account. For me it also only started working once I had configured that.
What do you say @nick ?