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

KeyError: 'content' in Claude_Author.ipynb #41

Open
aarony1993 opened this issue Apr 9, 2024 · 1 comment
Open

KeyError: 'content' in Claude_Author.ipynb #41

aarony1993 opened this issue Apr 9, 2024 · 1 comment

Comments

@aarony1993
Copy link

I'm using the newest version (https://github.com/mshumer/gpt-author/blob/main/Claude_Author.ipynb)

Added my API keys, ran the cell, filled out writing style, content, and number of chapters.
After the 10 chapters have been generated, it always results in this error

Generating plot outline...
Plot outline generated.
Generating chapter 1...
Chapter 1 generated.
Generating chapter 2...
Chapter 2 generated.
Generating chapter 3...
Chapter 3 generated.
Generating chapter 4...
Chapter 4 generated.
Generating chapter 5...
Chapter 5 generated.
Generating chapter 6...
Chapter 6 generated.
Generating chapter 7...
Chapter 7 generated.
Generating chapter 8...
Chapter 8 generated.
Generating chapter 9...
Chapter 9 generated.
Generating chapter 10...
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
[<ipython-input-2-c4c8d1aecfd2>](https://localhost:8080/#) in <cell line: 172>()
    170 
    171 # Generate the book
--> 172 plot_outline, book, chapters = generate_book(writing_style, book_description, num_chapters)
    173 
    174 title = generate_title(plot_outline)

1 frames
[<ipython-input-2-c4c8d1aecfd2>](https://localhost:8080/#) in generate_text(prompt, model, max_tokens, temperature)
     31     }
     32     response = requests.post("https://api.anthropic.com/v1/messages", headers=headers, json=data)
---> 33     response_text = response.json()['content'][0]['text']
     34     return response_text.strip()
     35 

KeyError: 'content'
@aithec77
Copy link

Do you have free credits or did you pay $5?

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

2 participants