Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty response from ChatGPT #251

Closed
freddez opened this issue Mar 14, 2024 · 15 comments
Closed

Empty response from ChatGPT #251

freddez opened this issue Mar 14, 2024 · 15 comments

Comments

@freddez
Copy link

freddez commented Mar 14, 2024

Hello,
I've tried my api key with curl, it works, but when I try gptel prompt, I am stuck with an "Empty response" message, and no error.

I am using emacs 29.2 with doom. I've also tried to purge eln-cache with no success.

Edit : It works if I disable gptel-use-curl
I'm using curl 8.2.1 on Ubuntu mantic

@karthink
Copy link
Owner

karthink commented Mar 14, 2024

I tested the latest commit in a sandbox and I'm not able to reproduce this bug.

  1. Did you try deleting and reinstalling the package (as opposed to upgrading)? When the load order changes this kind of thing happens often. If that doesn't work:
  2. Could you try installing gptel in an emacs -q session?

Run

emacs --init-directory /tmp/testdir

Then in Emacs:

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

And M-x package-install gptel.


EDIT: You could also try M-x load-file and loading gptel-openai.el manually.

@karthink
Copy link
Owner

Edit : It works if I disable gptel-use-curl

I suspect it will continue to work with curl if you turn off streaming responses. If none of the above work, could you run the following and test too?

(setq gptel-use-curl t
         gptel-stream nil)

@nordlow
Copy link

nordlow commented Mar 14, 2024

I have the same problem. I'm registered user having access to 4.0 in the browser. When

(use-package gptel
  :ensure t :defer t
  :custom
  (gptel-api-key "_____"))

with the _____ replaced with my API key I get back

ChatGPT error: (HTTP/2 429) You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.

@karthink
Copy link
Owner

I have the same problem. I'm registered user having access to 4.0 in the browser. When

(use-package gptel
  :ensure t :defer t
  :custom
  (gptel-api-key "_____"))

with the _____ replaced with my API key I get back

ChatGPT error: (HTTP/2 429) You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.

This is a separate issue that's unrelated to gptel. I'm guessing you don't have sufficient credits in your OpenAI billing account.

@mmwilbert
Copy link

I also have this problem (empty response) except I am trying to connect to Gemini. To make it more annoying, I can't set either
gptel-use-curl or gptel-stream to nil. If I do, when I try to send something I get

error in process sentinel: string-trim-right: Wrong type argument: stringp, nil
error in process sentinel: Wrong type argument: stringp, nil.

If they are set to t, I get the empty response.
Is there a way to see what curl command is being sent? I'm wondering if that would be informative.

@karthink
Copy link
Owner

I also have this problem (empty response) except I am trying to connect to Gemini. To make it more annoying, I can't set either gptel-use-curl or gptel-stream to nil. If I do, when I try to send something I get

error in process sentinel: string-trim-right: Wrong type argument: stringp, nil error in process sentinel: Wrong type argument: stringp, nil.

If they are set to t, I get the empty response. Is there a way to see what curl command is being sent? I'm wondering if that would be informative.

  1. Did you upgrade gptel or is it a new/fresh install? If it's after upgrading you can try deleting and reinstalling.
  2. To see what's being sent, you can run (setq gptel-log-level 'debug), then check the *gptel-log* buffer.

@karthink
Copy link
Owner

@freddez Just pushed a fix for what I'm guessing is the problem. Please update and test.

@mmwilbert
Copy link

I deleted and reloaded gptel. I still had (setq gptel-stream nil) in my init, so I got the sentinel error I described earlier.
After I changed that, I got
Gemini error (HTTP/2 503): Malformed JSON in response.

This was apparently because the model was overloaded, but maybe the error should be different?

I tried it again and got the empty response message. But in fact, the response in gptel-log did not look empty.

Here it is:

{
  "gptel": "response headers",
  "timestamp": "2024-03-15 00:32:47"
}
"HTTP/2 200 \r\ncontent-type: application/json; charset=UTF-8\r\nvary: Origin\r\nvary: X-Origin\r\nvary: Referer\r\ncontent-encoding: gzip\r\ndate: Fri, 15 Mar 2024 04:32:40 GMT\r\nserver: scaffolding on HTTPServer2\r\ncache-control: private\r\nx-xss-protection: 0\r\nx-frame-options: SAMEORIGIN\r\nx-content-type-options: nosniff\r\nserver-timing: gfet4t7; dur=773\r\nalt-svc: h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000\r\n\r"
{
  "gptel": "response body",
  "timestamp": "2024-03-15 00:32:47"
}
[
  {
    "candidates": [
      {
        "content": {
          "parts": [
            {
              "text": "Canine companion; domesticated carnivoran"
            }
          ],
          "role": "model"
        },
        "finishReason": "STOP",
        "index": 0,
        "safetyRatings": [
          {
            "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
            "probability": "NEGLIGIBLE"
          },
          {
            "category": "HARM_CATEGORY_HATE_SPEECH",
            "probability": "NEGLIGIBLE"
          },
          {
            "category": "HARM_CATEGORY_HARASSMENT",
            "probability": "NEGLIGIBLE"
          },
          {
            "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
            "probability": "NEGLIGIBLE"
          }
        ]
      }
    ],
    "promptFeedback": {
      "safetyRatings": [
        {
          "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_HATE_SPEECH",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_HARASSMENT",
          "probability": "NEGLIGIBLE"
        },
        {
          "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
          "probability": "NEGLIGIBLE"
        }
      ]
    }
  }
]

Just FYI, here's the response when I got the 503 message:

{
  "gptel": "response headers",
  "timestamp": "2024-03-15 00:27:31"
}
"HTTP/2 503 \r\nvary: Origin\r\nvary: X-Origin\r\nvary: Referer\r\ncontent-type: application/json; charset=UTF-8\r\ncontent-encoding: gzip\r\ndate: Fri, 15 Mar 2024 04:27:24 GMT\r\nserver: scaffolding on HTTPServer2\r\ncache-control: private\r\ncontent-length: 135\r\nx-xss-protection: 0\r\nx-frame-options: SAMEORIGIN\r\nx-content-type-options: nosniff\r\nserver-timing: gfet4t7; dur=177\r\nalt-svc: h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000\r\n\r"
{
  "gptel": "response body",
  "timestamp": "2024-03-15 00:27:31"
}
[
  {
    "error": {
      "code": 503,
      "message": "The model is overloaded. Please try again later.",
      "status": "UNAVAILABLE"
    }
  }
]

And thank you for the package!

@karthink
Copy link
Owner

This was apparently because the model was overloaded, but maybe the error should be different?

This is on the docket for me to fix, see #210.

Will take a look at the other logs soon, thanks for the bug report!

@freddez
Copy link
Author

freddez commented Mar 15, 2024

(setq gptel-use-curl t
         gptel-stream nil)

Hi,
Yes it works like this

@karthink
Copy link
Owner

(setq gptel-use-curl t
         gptel-stream nil)

Hi, Yes it works like this

Please update and try with the default settings (i.e. with streaming responses). It should be fixed now.

@nordlow
Copy link

nordlow commented Mar 15, 2024

Using

(setq gptel-use-curl t
         gptel-stream nil)

I'm still getting

gptel response error: (((HTTP/2 429) insufficient_quota) You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.) nil

Is another issue?

I am able to use my paid OpenAI account in the browser just now. How do I verify that gptel is picking up my secret key in .authinfo?

@stfl
Copy link

stfl commented Mar 15, 2024

I have the same issue.

With streaming I can see the streamed response in the log but I still get the "Emtpy Response" message.

dot not work:

(setq gptel-use-curl t
         gptel-stream nil)

works:

(setq gptel-use-curl nil)

@nordlow
Copy link

nordlow commented Mar 15, 2024

With

(use-package gptel
  :ensure t :defer t
  :custom
  (gptel-use-curl nil)
  (gptel-stream nil)
  )

followed by M-x gptel and inputting just "Hi" and then M-x gptel-send I get

gptel response error: (((HTTP/1.1 429 Too Many Requests) insufficient_quota) You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.) nil

. How can I check that gptel is picking up my creds using auth-source?

@karthink
Copy link
Owner

There are several unconnected issues in this thread so I created new ones and I'm closing this one. Please use your respective threads for further troubleshooting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants