mshumer / gpt-author

MIT License
2.45k stars 354 forks source link

Key content error #33

Open MihneaMM opened 3 months ago

MihneaMM commented 3 months ago

Hello. I haven't been able to generate a single book. I get this particular error at various stages of generation. In this screenshot, i got it after the book was compiled. Other times I get it after 5 chapters, Key_error or 10, other times right at the beginning. Most of the times though, after generating the last chapter. I get no output

frankx-eth commented 3 months ago

Same problem. Can someone help @mshumer?

dachris88 commented 3 months ago

This is rate-limit error.

https://docs.anthropic.com/claude/reference/rate-limits Here is the pertinent information:

image

I ran the same command on code that errored out in trackback and got this response code:

{
    "type": "error",
    "error": {
        "type": "rate_limit_error",
        "message": "Number of request tokens has exceeded your rate limit (https://docs.anthropic.com/claude/reference/rate-limits). Please reduce the the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase."
    }
}

I upgrade my Antrophic account to Build, I did not see the error anymore and was able to generate a book. You can upgrade and just add $5 to your account to get to build tier. That will solve the error.

This is the new rate-limit for Build 1 Tier

image
vvvdx commented 3 months ago

Didn't help me although. I get Build Tier 1 image But still has error KeyError Traceback (most recent call last) in <cell line: 112>() 111 subtopic_reports = [] 112 for subtopic in subtopic_checklist: --> 113 subtopic_report = generate_subtopic_report(subtopic) 114 subtopic_reports.append(subtopic_report) 115

1 frames in generate_text(prompt, model, max_tokens, temperature) 19 response = requests.post("https://api.anthropic.com/v1/messages", headers=headers, json=data) 20 print(response.json()) ---> 21 response_text = response.json()['content'][0]['text'] 22 print(remove_first_line(response_text.strip())) 23 return remove_first_line(response_text.strip())

KeyError: 'content'

dachris88 commented 3 months ago

Can you share which notebook that you use? Also you may want to check your API key requests. Check how many request per minute, how many token per day used, and token per minute that your key is doing across all of your applications. I know a friend who's running into the same issue because he has multiple agents that sending more than 50 requests per minute to api.antropic.com.

dachris88 commented 3 months ago

Also it has been noted in several reddit threads that if you run concurrent requests you may be throttled even if your request per minute is well below the limit.

aithec77 commented 3 months ago

I had this problem. The problem disappeared when I started generating books with 10 chapters. Apparently there are some restrictions that make it impossible to generate more than 10 chapters

nexuslux commented 3 months ago

Did you overcome this by any code? Did you put a buffer ro avoid the rate limit etc? Anything else we can do?

aithec77 commented 3 months ago

Вы преодолели это каким-либо кодом? Вы установили буфер, чтобы избежать ограничения скорости и т. д.? Что-нибудь еще мы можем сделать?

Нет я просто генерирую не более 10 глав вот и все

aithec77 commented 3 months ago

Но я открывал похожий вопрос и мне посоветовали несколько вещей в том числе и код: https://github.com/mshumer/gpt-author/issues/38