emacs-openai / chatgpt

Use ChatGPT inside Emacs
GNU General Public License v3.0
185 stars 21 forks source link

error in process sentinel: Symbol’s value as variable is void: openai-error #1

Closed benthamite closed 1 year ago

benthamite commented 1 year ago

After running chatgpt and entering an arbitrary prompt (e.g. "How are you?") I get the following error:

"error in process sentinel: Symbol’s value as variable is void: openai-error"

Here's my config, followed by a backtrace:

(use-package openai
  :straight (openai
             :host github
             :repo "emacs-openai/openai")
  :config
  (setq openai-key (auth-source-pass-get 'secret "auth-sources/openai.com")))
(use-package chatgpt
  :straight (chatgpt
         :host github
         :repo "emacs-openai/chatgpt"))
backtrace

``` emacs-lisp Debugger entered--Lisp error: (void-variable openai-error) #f(compiled-function (data) #)(((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))]))) funcall(#f(compiled-function (data) #) ((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))]))) (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data)) (closure ((callback . #f(compiled-function (data) #))) (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data)))(:data ((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))])) :symbol-status success :error-thrown nil :response #s(request-response :status-code 200 :history nil :data ((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))])) :error-thrown nil :symbol-status success :url "https://api.openai.com/v1/chat/completions" :done-p nil :settings (:error (closure (t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ':response))))) (openai--handle-error response))) :type "POST" :headers (("Content-Type" . "application/json") ("Authorization" . "Bearer [API key]")) :data "{\"model\":\"gpt-3.5-turbo\",\"messages\":[{\"role\":\"user\",\"content\":\"How are you?\"}],\"temperature\":1.0,\"max_tokens\":2000,\"user\":\"user\"}" :parser json-read :success (closure ((callback . #f(compiled-function (data) #))) (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data))) :url "https://api.openai.com/v1/chat/completions" :response #8 :encoding utf-8) :-buffer # :-raw-header "HTTP/2 200 \ndate: Tue, 21 Mar 2023 16:07:59 GMT\ncontent-type: application/json\ncontent-length: 413\naccess-control-allow-origin: *\ncache-control: no-cache, must-revalidate\nopenai-model: gpt-3.5-turbo-0301\nopenai-organization: [user ID]\nopenai-processing-ms: 2144\nopenai-version: 2020-10-01\nstrict-transport-security: max-age=15724800; includeSubDomains\nx-ratelimit-limit-requests: 3500\nx-ratelimit-remaining-requests: 3499\nx-ratelimit-reset-requests: 17ms\nx-request-id: f77db03d135f11397c1994300b27ffa0\n" :-timer nil :-backend curl)) apply((closure ((callback . #f(compiled-function (data) #))) (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data))) (:data ((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))])) :symbol-status success :error-thrown nil :response #s(request-response :status-code 200 :history nil :data ((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))])) :error-thrown nil :symbol-status success :url "https://api.openai.com/v1/chat/completions" :done-p nil :settings (:error (closure (t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ':response))))) (openai--handle-error response))) :type "POST" :headers (("Content-Type" . "application/json") ("Authorization" . "Bearer [API key]")) :data "{\"model\":\"gpt-3.5-turbo\",\"messages\":[{\"role\":\"user\",\"content\":\"How are you?\"}],\"temperature\":1.0,\"max_tokens\":2000,\"user\":\"user\"}" :parser json-read :success (closure ((callback . #f(compiled-function (data) #))) (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data))) :url "https://api.openai.com/v1/chat/completions" :response #10 :encoding utf-8) :-buffer # :-raw-header "HTTP/2 200 \ndate: Tue, 21 Mar 2023 16:07:59 GMT\ncontent-type: application/json\ncontent-length: 413\naccess-control-allow-origin: *\ncache-control: no-cache, must-revalidate\nopenai-model: gpt-3.5-turbo-0301\nopenai-organization: [user ID]\nopenai-processing-ms: 2144\nopenai-version: 2020-10-01\nstrict-transport-security: max-age=15724800; includeSubDomains\nx-ratelimit-limit-requests: 3500\nx-ratelimit-remaining-requests: 3499\nx-ratelimit-reset-requests: 17ms\nx-request-id: f77db03d135f11397c1994300b27ffa0\n" :-timer nil :-backend curl))) request--callback(# :error (closure (t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ':response))))) (openai--handle-error response))) :type "POST" :headers (("Content-Type" . "application/json") ("Authorization" . "Bearer [API key]")) :data "{\"model\":\"gpt-3.5-turbo\",\"messages\":[{\"role\":\"user\",\"content\":\"How are you?\"}],\"temperature\":1.0,\"max_tokens\":2000,\"user\":\"user\"}" :parser json-read :success (closure ((callback . #f(compiled-function (data) #))) (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data))) :url "https://api.openai.com/v1/chat/completions" :response #s(request-response :status-code 200 :history nil :data ((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))])) :error-thrown nil :symbol-status success :url "https://api.openai.com/v1/chat/completions" :done-p nil :settings (:error (closure (t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ':response))))) (openai--handle-error response))) :type "POST" :headers (("Content-Type" . "application/json") ("Authorization" . "Bearer [API key]")) :data "{\"model\":\"gpt-3.5-turbo\",\"messages\":[{\"role\":\"user\",\"content\":\"How are you?\"}],\"temperature\":1.0,\"max_tokens\":2000,\"user\":\"user\"}" :parser json-read :success (closure ((callback . #f(compiled-function (data) #))) (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data))) :url "https://api.openai.com/v1/chat/completions" :response #17 :encoding utf-8) :-buffer # :-raw-header "HTTP/2 200 \ndate: Tue, 21 Mar 2023 16:07:59 GMT\ncontent-type: application/json\ncontent-length: 413\naccess-control-allow-origin: *\ncache-control: no-cache, must-revalidate\nopenai-model: gpt-3.5-turbo-0301\nopenai-organization: [user ID]\nopenai-processing-ms: 2144\nopenai-version: 2020-10-01\nstrict-transport-security: max-age=15724800; includeSubDomains\nx-ratelimit-limit-requests: 3500\nx-ratelimit-remaining-requests: 3499\nx-ratelimit-reset-requests: 17ms\nx-request-id: f77db03d135f11397c1994300b27ffa0\n" :-timer nil :-backend curl) :encoding utf-8) apply(request--callback # (:error (closure (t) (&rest --cl-rest--) "\n\n(fn &key RESPONSE &allow-other-keys)" (let* ((response (car (cdr (plist-member --cl-rest-- ':response))))) (openai--handle-error response))) :type "POST" :headers (("Content-Type" . "application/json") ("Authorization" . "Bearer [API key]")) :data "{\"model\":\"gpt-3.5-turbo\",\"messages\":[{\"role\":\"user\",\"content\":\"How are you?\"}],\"temperature\":1.0,\"max_tokens\":2000,\"user\":\"user\"}" :parser json-read :success (closure ((callback . #f(compiled-function (data) #))) (&rest --cl-rest--) "\n\n(fn &key DATA &allow-other-keys)" (let* ((data (car (cdr (plist-member --cl-rest-- ':data))))) (funcall callback data))) :url "https://api.openai.com/v1/chat/completions" :response #s(request-response :status-code 200 :history nil :data ((id . "chatcmpl-6wYofL08xBBb1CaZd3p3WzCTbj4Vl") (object . "chat.completion") (created . 1679414877) (model . "gpt-3.5-turbo-0301") (usage (prompt_tokens . 11) (completion_tokens . 30) (total_tokens . 41)) (choices . [((message (role . "assistant") (content . "\n\nI am an AI language model, so I don't have feelings like humans, but I am functioning normally. How can I assist you today?")) (finish_reason . "stop") (index . 0))])) :error-thrown nil :symbol-status success :url "https://api.openai.com/v1/chat/completions" :done-p nil :settings #3 :-buffer # :-raw-header "HTTP/2 200 \ndate: Tue, 21 Mar 2023 16:07:59 GMT\ncontent-type: application/json\ncontent-length: 413\naccess-control-allow-origin: *\ncache-control: no-cache, must-revalidate\nopenai-model: gpt-3.5-turbo-0301\nopenai-organization: [user ID]\nopenai-processing-ms: 2144\nopenai-version: 2020-10-01\nstrict-transport-security: max-age=15724800; includeSubDomains\nx-ratelimit-limit-requests: 3500\nx-ratelimit-remaining-requests: 3499\nx-ratelimit-reset-requests: 17ms\nx-request-id: f77db03d135f11397c1994300b27ffa0\n" :-timer nil :-backend curl) :encoding utf-8)) request--curl-callback("https://api.openai.com/v1/chat/completions" # "finished\n") apply(request--curl-callback ("https://api.openai.com/v1/chat/completions" # "finished\n")) #f(compiled-function (&rest args2) #)(# "finished\n") ```

jcs090218 commented 1 year ago

Oh, please update openai to the latest version! Thank you!

benthamite commented 1 year ago

Thanks! That fixed it.