Open ppanko opened 1 month ago
I can't reproduce this. Could you run M-x
toggle-debug-on-error
, produce the error and supply the backtrace here?
Debugger entered--Lisp error: (wrong-type-argument json-value-p "HTTP/2 200 \ndate: Tue, 21 May 2024 20:09:13 GMT\ncontent-type: application/json; charset=utf-8\n...")
json-serialize("HTTP/2 200 \ndate: Tue, 21 May 2024 20:09:13 GMT\ncontent-type: application/json; charset=utf-8\n..." :null-object nil :false-object :json-false)
gptel-curl--log-response(#<buffer *gptel-curl*<3>> (:token "04a8d912aa1d4a4ecf45416b86ee5e39" :parser #f(compiled-function (backend response info) #<bytecode 0x1974b7d>) :callback (lambda (response info) (if (not response) (message "ChatGPT response failed with: %s" (plist-get info :status)) (let* ((bounds (plist-get info :context)) (beg (car bounds)) (end (cdr bounds)) (buf (plist-get info :buffer))) (save-current-buffer (set-buffer buf) (save-excursion (goto-char beg) (kill-region beg end) (insert response) (set-marker beg nil) (set-marker end nil) (message "Rewrote line. Original line saved to kill-ring."))))) :transformer nil :data (:model "gpt-3.5-turbo" :messages [(:role "system" :content "You are a prose editor. Rewrite my prompt more pro...") (:role "user" :content ";; elisp: fizzbuzz")] :stream :json-false :temperature 1.0) :buffer #<buffer *scratch*> :position #<marker at 19 in *scratch*> :context (#<marker at 1 in *scratch*> . #<marker at 19 in *scratch*>)))
gptel-curl--sentinel(#<process gptel-curl> "finished\n")
P.S. sorry -- mis-clicked on "close" initially
This error is different from the one in your previous post. It looks like there are two different errors. Please turn off logging with (setq gptel-log-level nil)
and produce a backtrace for the original error.
Correct -- here's the error from the OP:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
string-match("\\(?:[ \11\n\15]+\\)\\'" nil nil)
gptel-curl--parse-response((:token "dcab6e4d3b53057500fb4191cf8ddfb3" :parser #f(compiled-function (backend response info) #<bytecode 0x1974b7d>) :callback (lambda (response info) (if (not response) (message "ChatGPT response failed with: %s" (plist-get info :status)) (let* ((bounds (plist-get info :context)) (beg (car bounds)) (end (cdr bounds)) (buf (plist-get info :buffer))) (save-current-buffer (set-buffer buf) (save-excursion (goto-char beg) (kill-region beg end) (insert response) (set-marker beg nil) (set-marker end nil) (message "Rewrote line. Original line saved to kill-ring.")))))) :transformer nil :data (:model "gpt-3.5-turbo" :messages [(:role "system" :content "You are a prose editor. Rewrite my prompt more pro...") (:role "user" :content ";; elisp: fizzbuzz")] :stream :json-false :temperature 1.0) :buffer #<buffer *scratch*> :position #<marker at 19 in *scratch*> :context (#<marker at 1 in *scratch*> . #<marker at 19 in *scratch*>)))
gptel-curl--sentinel(#<process gptel-curl> "finished\n")
That's quite odd. I'd ask you to turn on logging but that's independently broken too. I don't see anything wrong with that json-serialize
call.
Thanks for checking. Clearing the config file didn't affect either error -- gptel-send
works but gptel-rewrite-and-replace
does not.
Any chance either issue is related to this block? https://github.com/karthink/gptel/blob/3bce2caa5dc773d1b1fce53e8453d2e1ce534b8b/gptel-curl.el#L388-L395
No, I think it's related to string-trim
further below. To analyze this I'd have to fix the logging bug first.
Hello, thank you for the wonderful package. I am running into an error attempting to run a function that uses gptel-request (using Windows 11 OS). Here is my config setup:
The
gptel-rewrite-and-replace
function, which was borrowed from example 2 on the gptel wiki page, throws the following error:gptel-send
works just fine as does sending requests through curl directly. I can send the debug/log output if needed. Thanks in advance!