karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.21k stars 122 forks source link

Symbol’s function definition is void when running query #3

Closed JonatanSahar closed 9 months ago

JonatanSahar commented 1 year ago

Hi, I'm getting the following while running a query:

Querying ChatGPT...
gptel-curl--sentinel: Symbol’s function definition is void: nil

Even after turning on debug-on-error I'm not getting any stack trace, just this error. Thanks!

karthink commented 1 year ago

Hi Jon,

I renamed some functions recently to appease the byte-compiler and linter. Could you try uninstalling (package-delete) and reinstalling (package-install-file on the directory) this package and running a fresh Emacs session? Or equivalent if you're using Straight/Elpaca/some other package manager or loading files manually.

JonatanSahar commented 1 year ago

Hi, I did a straight-pull-package, I hope that's equivalent.. I'm on doom so that's usually abstracted away for me :) Now I get the following error on startup:

Debugger entered--Lisp error: (no-catch emacs-version-changed nil) throw(emacs-version-changed nil) (if (equal (emacs-version) "GNU Emacs 28.1.90 (build 2, x86_64-w64-mingw32)\n o...") nil (throw 'emacs-version-changed nil)) (unless (equal (emacs-version) "GNU Emacs 28.1.90 (build 2, x86_64-w64-mingw32)\n o...") (throw 'emacs-version-changed nil)) eval((unless (equal (emacs-version) "GNU Emacs 28.1.90 (build 2, x86_64-w64-mingw32)\n o...") (throw 'emacs-version-changed nil))) byte-code("\300\301\302\303\304E\305BB!\207" [eval unless equal (emacs-version) "GNU Emacs 28.1.90 (build 2, x86_64-w64-mingw32)\n o..." ((throw 'emacs-version-changed nil))] 5) (straight-use-package '(gptel :host github :repo "karthink/gptel")) load-with-code-conversion("c:/Users/Jonathan/.doom.d/config.el" "c:/Users/Jonathan/.doom.d/config.el" nil t) load("~/.doom.d/config" nil nomessage) (condition-case e (load path noerror 'nomessage) ((debug doom-error) (signal (car e) (cdr e))) ((debug error) (setq path (locate-file path load-path (get-load-suffixes))) (signal (cond ((not (and path (featurep ...))) 'error) ((file-in-directory-p path (expand-file-name "cli" doom-core-dir)) 'doom-cli-error) ((file-in-directory-p path doom-core-dir) 'doom-core-error) ((file-in-directory-p path doom-user-dir) 'doom-user-error) ((file-in-directory-p path doom-profile-dir) 'doom-profile-error) ((file-in-directory-p path doom-modules-dir) 'doom-module-error) ('doom-error)) (list path e)))) doom-load("~/.doom.d/config")

karthink commented 1 year ago

I'm not sure how you're expected to update packages when using Doom, but I'm guessing straight-pull-all is not the way? It will probably break stuff.

schmudde commented 1 year ago

Thanks for your work on this. I have the exact same problem.

I tried quitting Emacs and re-installing. I'm managing the package manually as described in your README:

(add-to-list 'load-path "/path/to/gptel/")
(require 'gptel)

When running Emacs again, I still had the same error. That's when I set M-x customize-groupGptel Use Curl: off and now I'm able to use the package.

I'm on PopOS and running Emacs in the Terminal. Let me know what else I can do to help debug.

JonatanSahar commented 1 year ago

Actually, reinstalling the package solves the problem for me, but I had another problem with waiting indefinitely for a response. Setting 'curl' off, solved that for me too.

On Sat, Mar 18, 2023, 14:42 schmudde @.***> wrote:

Thanks for your work on this. I have the exact same problem.

I tried quitting Emacs and re-installing. I'm managing the package manually as described in your README:

(add-to-list 'load-path "/path/to/gptel/") (require 'gptel)

When running Emacs again, I still had the same error. That's when I set M-x customize-group → Gptel Use Curl: off and now I'm able to use the package.

I'm on PopOS and running Emacs in the Terminal. Let me know what else I can do to help debug.

— Reply to this email directly, view it on GitHub https://github.com/karthink/gptel/issues/3#issuecomment-1474840604, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEL3S3AL7CR5J5KOFLNIXXTW4WUTBANCNFSM6AAAAAAVVSZ23U . You are receiving this because you authored the thread.Message ID: @.***>

karthink commented 1 year ago

I'm on PopOS and running Emacs in the Terminal. Let me know what else I can do to help debug.

Could you run (setq gptel--debug t) and try using it with Curl? The HTTP response from ChatGPT should pop up in a buffer. If it doesn't that's helpful too. There are multiple silent-failure bugs (possibly related) that I'm trying to reproduce here.

karthink commented 1 year ago

@JonatanSahar Is curl + gptel still a problem for you?

JonatanSahar commented 1 year ago

I'll have to check in a few days

On Sat, May 6, 2023, 05:33 karthink @.***> wrote:

@JonatanSahar https://github.com/JonatanSahar Is curl + gptel still a problem for you?

— Reply to this email directly, view it on GitHub https://github.com/karthink/gptel/issues/3#issuecomment-1537033584, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEL3S3DQWALJ2XHMW2ASGWDXEXBBJANCNFSM6AAAAAAVVSZ23U . You are receiving this because you were mentioned.Message ID: @.***>

karthink commented 1 year ago

@JonatanSahar Is this still an issue?

JonatanSahar commented 1 year ago

Yes, it is actually - I get "error running sentinel ", I'll post the exact message tomorrow.

On Sun, Jun 18, 2023, 22:36 karthink @.***> wrote:

@JonatanSahar https://github.com/JonatanSahar Is this still an issue?

— Reply to this email directly, view it on GitHub https://github.com/karthink/gptel/issues/3#issuecomment-1596245834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEL3S3AWI3QKL4GAFH7ONFTXL5KC5ANCNFSM6AAAAAAVVSZ23U . You are receiving this because you were mentioned.Message ID: @.***>

JonatanSahar commented 1 year ago

it says: Querying ChatGPT... error in process sentinel: gptel-curl--parse-response: Search failed: "e3169132ab51d331b3355990884b1082" error in process sentinel: Search failed: "e3169132ab51d331b3355990884b1082"

On Sun, 18 Jun 2023 at 23:19, Jonathan Sahar @.***> wrote:

Yes, it is actually - I get "error running sentinel ", I'll post the exact message tomorrow.

On Sun, Jun 18, 2023, 22:36 karthink @.***> wrote:

@JonatanSahar https://github.com/JonatanSahar Is this still an issue?

— Reply to this email directly, view it on GitHub https://github.com/karthink/gptel/issues/3#issuecomment-1596245834, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEL3S3AWI3QKL4GAFH7ONFTXL5KC5ANCNFSM6AAAAAAVVSZ23U . You are receiving this because you were mentioned.Message ID: @.***>

schmudde commented 1 year ago

I'm on PopOS and running Emacs in the Terminal. Let me know what else I can do to help debug.

Could you run (setq gptel--debug t) and try using it with Curl? The HTTP response from ChatGPT should pop up in a buffer. If it doesn't that's helpful too. There are multiple silent-failure bugs (possibly related) that I'm trying to reproduce here.

I removed my custom install and switched to the MELPA package (GPTEL 0.3.6) using package-list-package. I'm using the same Emacs/Pop_OS as I wrote the last time (GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) of 2022-01-24, modified by Debian) and it doesn't work. So - per your suggestion - I ran (setq gptel--debug t) and got this response:

HTTP/1.1 400 Bad Request
Date: Mon, 19 Jun 2023 19:23:36 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 167
Connection: keep-alive
vary: Origin
x-request-id: 3bd93220eb6f16ba4f081a0798b27431
strict-transport-security: max-age=15724800; includeSubDomains
CF-Cache-Status: DYNAMIC
Server: cloudflare
CF-RAY: 7d9e25c08b4f3755-MXP
alt-svc: h3=":443"; ma=86400

{
    "error": {
        "message": "you must provide a model parameter",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}

I'm running vanilla Emacs, but perhaps the compile log will lend some insights into what is special about the system:

Leaving directory ‘/home/schmudde/.emacs.d/elpa/gptel-0.3.6’

Compiling file /home/schmudde/.emacs.d/elpa/gptel-0.3.6/gptel-curl.el at Mon Jun 19 21:17:01 2023
Entering directory ‘/home/schmudde/.emacs.d/elpa/gptel-0.3.6/’

In gptel-curl--get-args:
gptel-curl.el:53:46:Warning: ‘token’ is an obsolete variable (as of 25.1); use
    'token instead

In gptel-curl-get-response:
gptel-curl.el:78:63:Warning: ‘token’ is an obsolete variable (as of 25.1); use
    'token instead
gptel-curl.el:84:33:Warning: ‘token’ is an obsolete variable (as of 25.1); use
    'token instead

In gptel-abort:
gptel-curl.el:109:56:Warning: ‘buf’ is an obsolete variable (as of 25.1); use
    'buf instead
gptel-curl.el:117:30:Warning: ‘buf’ is an obsolete variable (as of 25.1); use
    'buf instead
gptel-curl.el:120:72:Warning: ‘buf’ is an obsolete variable (as of 25.1); use
    'buf instead
gptel-curl.el:120:72:Warning: ‘buf’ is an obsolete variable (as of 25.1); use
    'buf instead
gptel-curl.el:123:1:Warning: Unused lexical argument ‘status’
gptel-curl.el:175:1:Warning: Unused lexical variable ‘status-str’
gptel-curl.el:203:1:Warning: Unused lexical variable ‘content-str’
gptel-curl.el:203:1:Warning: Unused lexical variable ‘response’
gptel-curl.el:262:1:Warning: Unused lexical argument ‘status’

In gptel-curl--parse-response:
gptel-curl.el:287:24:Warning: ‘buf’ is an obsolete variable (as of 25.1); use
    'buf instead
gptel-curl.el:290:24:Warning: ‘token’ is an obsolete variable (as of 25.1);
    use 'token instead

Compiling file /home/schmudde/.emacs.d/elpa/gptel-0.3.6/gptel-transient.el at Mon Jun 19 21:17:01 2023
gptel-transient.el:89:72:Warning: ‘buf’ is an obsolete variable (as of 25.1);
    use 'buf instead
gptel-transient.el:90:52:Warning: ‘buf’ is an obsolete variable (as of 25.1);
    use 'buf instead

Compiling file /home/schmudde/.emacs.d/elpa/gptel-0.3.6/gptel.el at Mon Jun 19 21:17:02 2023
gptel.el:69:1:Warning: defgroup for ‘gptel’ fails to specify containing group

In gptel--stream-convert-markdown->org:
gptel.el:718:50:Error: missing value for ‘in-src-block’ at end of setq
PalaceChan commented 1 year ago

(it might be helpful for gptel--debug t to also show the curl command that is being used so that it's easier to troubleshoot the command in the shell directly? e.g. I've added a small print before here to show the curl command that is being sent vs only the response + headers -- maybe surrounding that with (when gptel--debug... could be useful?)

pmontrasio commented 1 year ago

I'm also stuck with you must provide a model parameter

My elisp is very rusty. I put a

    (message "curl %s" args)

on the line before

    (with-current-buffer (process-buffer process)

but it does not log anything into *Messages*.

I'm using version 20230623.2344 from Melpa after the version from March stopped working yesterday. I didn't investigate the reason, I assumed that the API changed (I saw an announcement of new models.) Maybe it changed beyond the reach of the June version too.

karthink commented 1 year ago

@pmontrasio Could you try with with the latest version after running (setq gptel--debug t)?

pmontrasio commented 1 year ago

I installed from melpa with M-x package-list-packages and the install button

Warning (bytecomp): reference to free variable ‘mc/cmds-to-run-for-all’
Warning (bytecomp): reference to free variable ‘mc/cmds-to-run-once’
Warning (bytecomp): reference to free variable ‘mc--default-cmds-to-run-for-all’
Warning (bytecomp): reference to free variable ‘mc--default-cmds-to-run-once’
Leaving directory ‘/home/me/.emacs.d/elpa/gptel-20230721.433’

Compiling file /home/me/.emacs.d/elpa/gptel-20230721.433/gptel-curl.el at Fri Jul 21 12:05:27 2023
Entering directory ‘/home/me/.emacs.d/elpa/gptel-20230721.433/’

Compiling file /home/me/.emacs.d/elpa/gptel-20230721.433/gptel-transient.el at Fri Jul 21 12:05:27 2023

Compiling file /home/me/.emacs.d/elpa/gptel-20230721.433/gptel.el at Fri Jul 21 12:05:27 2023

In gptel--stream-convert-markdown->org:
gptel.el:872:50:Error: missing value for ‘in-src-block’ at end of setq

Then (setq gptel--debug t) in *scratch*

Then M-x gptel

I sent Hi and got

HTTP/2 400 
date: Fri, 21 Jul 2023 10:07:13 GMT
content-type: application/json; charset=utf-8
content-length: 167
vary: Origin
x-request-id: 86954ccda2298e8603fb1be855f497c1
strict-transport-security: max-age=15724800; includeSubDomains
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 7ea2a2b95f7a0e1d-MXP
alt-svc: h3=":443"; ma=86400

{
    "error": {
        "message": "you must provide a model parameter",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}
(8aa2385e00ebb7c86714e7022a2f6df1 . 352)

I made other attempts with several combinations of the setq command, closing the ChatGPT buffer, opening it. Always the same outcome.

karthink commented 9 months ago

Is this error still present in the latest version of gptel?

karthink commented 9 months ago

I am closing this now since gptel has changed significantly in the past few months. Feel free to re-open if the error still persists.