Giter Club home page Giter Club logo

Comments (6)

dany-nonstop avatar dany-nonstop commented on May 22, 2024

After some tests, it seems when I have too many requests, it will also exit without any prompt -- though the error will be visible if I try ChatGPT's web interface. It'll state: "Too many requests in 1 hour. Try again later." It would be nice to have these error messages also returned to the user as exception, for example.

from chatgpt-api.

transitive-bullshit avatar transitive-bullshit commented on May 22, 2024

Can you provide a code snippet of how you are invoking api.sendMessage? And also include the output stdout and stderr?

if you make multiple queries consecutively, after about several queries, calling api.sendMessage() would exit without the program any error output at the console.

There really shouldn't be any way for this library to exit the process. The only real result I can potentially see is that an Error is thrown and you're not handling it, and for some reason the process' stderr isn't displaying that error / stack trace to you. Really depends on your environment, though.

NOTE: I strongly recommend against having multiple api.sendMessage calls running concurrently. While it may be possible and work for a bit, this will severely degrade the robustness of your program since the current unofficial API isn't really meant to be used this way. I recommend adding a reasonable delay in between sendMessage calls to mitigate rate limits.

Here are a few of the special responses I'm looking for from chatgpt: https://github.com/transitive-bullshit/chatgpt-twitter-bot/blob/main/src/respond-to-new-mentions.ts#L258-L269

from chatgpt-api.

dany-nonstop avatar dany-nonstop commented on May 22, 2024

Thanks for looking at the problem. The code is very straightforward, there is no concurrent execution, however after some time it will just stop with nothing to report

for (var uid of uids) {
    prompt = 'Generate a summary of the the article\n\n' + text
    response = await api.sendMessage(prompt) //, {conversationId: uid})
    console.log(new Date().toLocaleTimeString() + ' uid ' + result.uid)
}

output

$ node test.js
...
11:58:09 PM uid 151
11:58:49 PM uid 152
$

with no error message nothing, and I have many more items in array uids. I can however resume from uid 153 after an hour. So i believe it's chatgpt-api's problem. It doesn't recognize the error and quietly exit.

from chatgpt-api.

transitive-bullshit avatar transitive-bullshit commented on May 22, 2024

@dany-nonstop is your code open source? It's likely that at some point, a message fails to send and throws an error.

I recommend adding a delay in-between sendMessage requests to avoid running into 503/429 errors. Example: https://github.com/transitive-bullshit/chatgpt-twitter-bot/blob/main/src/respond-to-new-mentions.ts#L157-L158

from chatgpt-api.

transitive-bullshit avatar transitive-bullshit commented on May 22, 2024

@dany-nonstop let me know if there's anything else I can to to try and help. Otherwise, I'm closing this as it doesn't seem to be affecting other people.

Thanks

from chatgpt-api.

dany-nonstop avatar dany-nonstop commented on May 22, 2024

Thank you @transitive-bullshit it's still there, the smallest I can repeat is this, if it helps you debug. I'm already adding 60s between calls. It just stays there.

async function extract() {
  for (var row of content) {
    prompt = 'summarize this paragraph \n\n' + row
    response = await api.sendMessage(prompt)
  }
}

from chatgpt-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.