Closed minad closed 1 year ago
No, I've not encountered this error. It would be good to know the actual response/error from ChatGPT in this case. Assuming you're using curl, could you evaluate this function and try sending a query?
(defun gptel-curl--sentinel (process status)
"Process sentinel for GPTel curl requests.
PROCESS and STATUS are process parameters."
(let ((proc-buf (process-buffer process)))
(with-current-buffer proc-buf
(clone-buffer "*gptel-error*" 'show))
(if-let* ((ok-p (equal status "finished\n"))
(proc-info (alist-get process gptel-curl--process-alist))
(proc-token (plist-get proc-info :token))
(content (gptel-curl--parse-response proc-buf proc-token)))
(funcall (plist-get proc-info :callback) content)
;; Failed
(funcall (plist-get proc-info :callback) nil))
(kill-buffer proc-buf)))
If we get #7 it should be possible to just restart.
The API is completely stateless so there is no concept of restarting. Every query sent is as fresh as any other.
Assuming you're using curl, could you evaluate this function and try sending a query?
Yes, I have curl but I don't know if it used by gptel. Is this automatic? Anyway, I closed the session, but I will evaluate your code the next time the issue occurs.
The API is completely stateless so there is no concept of restarting. Every query sent is as fresh as any other.
But what about the prompts? Do you sent them all the time to gpt, such that it has access to the context of the conversation?
Curl is chosen automatically if executable-find
finds it. (It works more reliably than url-retrieve
, see #4.)
But what about the prompts? Do you sent them all the time to gpt, such that it has access to the context of the conversation?
Unfortunately yes. From the API docs:
Because the models have no memory of past requests, all relevant information must be supplied via the conversation. If a conversation cannot fit within the model’s token limit, it will need to be shortened in some way.
This does mean that the token cost goes up continuously as the conversation continues. The way around this is to send only enough history with each request to retain sufficient context that conversation, such as the last three exchanges. This feature is already implemented, but on the transient
branch -- which implements a magit-style menu to set request parameters for the session. If you could switch to that branch and test it, it would be very useful!
The way to use the transient menu is to invoke gptel-send
(C-c RET
) with a prefix-arg. Any parameters you set here are set for the session/buffer.
Oh, okay interesting. I will try the branch if I find time, but since I am just getting started, don't expect any useful feedback from me.
I wonder about the tokens - I created an OpenAI account. Will this account expire at some point and do I have to switch to a paid subscription? I've seen the subscription for 20$/month which is a lot. Sorry for asking these unrelated questions but it matters before investing a lot of time. Maybe I should just ask ChatGPT. ;)
I will try the branch if I find time, but since I am just getting started, don't expect any useful feedback from me.
The UX is much better with it enabled. I haven't had time to merge it into master.
After that, it's a paid service, at $0.002 per 1000 tokens. 1000 tokens is roughly 600-800 words, and this includes both your query and the response. So $1 is about 350,000 words of conversation.
Okay, I see. One can probably also set a quota such that the cost stays within reasonable limits.
When using the API you can specify how many words/tokens (how long) you want the responses to be. When using gptel you can set this through the transient menu.
Very good.
The UX is much better with it enabled. I haven't had time to merge it into master.
Okay, I hope you merge this soon and also the Org feature.
Okay, I hope you merge this soon and also the Org feature.
A question about package-dependencies. I'm using features of transient.el
that tarsius added after the latest tagged release (0.3.7
, which is July 2022). I need these features to dynamically generate the transient menus from user options. I'm not sure what version of transient to add as a dependency in the package header. If I add the (non-tagged, non-release) git version, ELPA users won't be able to access it.
A question about package-dependencies. I'm using features of transient.el that tarsius added after the latest tagged release (0.3.7, which is July 2022). I need these features to dynamically generate the transient menus from user options.
You should wait until @tarsius releases a new version and then specify this new version. Hopefully he can tag a new release soon.
Okay, I hope you merge this soon and also the Org feature.
The transient menus are merged into master in 9f8fc0e5. I've disabled the dynamic menus for now so an older (tagged) version of transient can be used.
To use it, call gptel-send
(C-c RET
) with a prefix argument. Also works from any buffer. Additional options are exposed if you have a region of text selected when you do so.
The options should be self-explanatory on newer transient versions. (For some reason the in-menu docstrings don't appear correctly on older transient versions.)
I might create a new release next week.
@tarsius Thanks. I am getting some errors right now (#14).
@minad are you still facing the "Response error nil" bug?
Not sure if this is the same problem, but I do get a Response error: finished ^J
when trying to send a query with the latest version (https://github.com/karthink/gptel/commit/4f3ca234545a3643eb3bed2baf55645463b6f728).
I got this error and tried your curl sentinel:
HTTP/2 429
date: Wed, 22 Mar 2023 09:37:39 GMT
content-type: application/json; charset=utf-8
content-length: 206
vary: Origin
strict-transport-security: max-age=15724800; includeSubDomains
{
"error": {
"message": "You exceeded your current quota, please check your plan and billing details.",
"type": "insufficient_quota",
"param": null,
"code": null
}
}
(4cb10e38da9e4d275a1e2258f7acce0c . 246)
Would be nice if that error surfaced :-)
@unhammer Perfect, thank you. I was looking for this message. I'll account for it explicitly soon.
Not sure if this is the same problem, but I do get a
Response error: finished ^J
when trying to send a query with the latest version (4f3ca23).
I'm assuming this is with Curl (gptel-use-curl
)? If you're using the above function (for gptel-curl--sentinel
) in your config, please remove it and try again.
@unhammer I just pushed a fix. Could you check with 42d53b25 or later?
I'm assuming this is with Curl (gptel-use-curl)?
Yes. As in I had not changed anything and just used gptel-send
but the variable seems to be set to t
. It now properly responds with the error message "insufficient quota".
Somehow I have never had sufficient quota even though the docs mention it resets every n minutes. Anyways, that is a problem for me to figure out separately.
That looks much better, yes :-)
I'm going to close this issue now, since it appears to be working (in the sense of showing better error messages) for everyone in this thread.
Feel free to reopen if it fails silently again or if you still get cryptic error messages like "Response Error nil".
After some conversation chatgpt just stopped abruptly.
Now I am getting
Response error nil
errors in the header line and it does not seem possible to recover. Did you observe this issue too? If we get #7 it should be possible to just restart.