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

InvalidRequestError: The model gpt-4-32k #25

Open
zimba7768 opened this issue Sep 25, 2023 · 12 comments
Open

InvalidRequestError: The model gpt-4-32k #25

zimba7768 opened this issue Sep 25, 2023 · 12 comments

Comments

@zimba7768
Copy link

I am not sure if this is the correct place to post this; if not, I apologize in advance. I like trying out different AI tools, and currently, I am experimenting with GPT_Author. I have followed all the steps and read as much material as I can find, but I still can't get it to work. I have paid for GPT-4 and for the GPT API. When I run GPT Author, I see the step cost for each section, but in the end, I encounter an error. I am not a programmer, so this is very confusing.

InvalidRequestError Traceback (most recent call last) Cell 7 line 5

3 num_chapters = 15

4 writing_style = "Clear and easily understandable, similar to a young adult novel. Lots of dialogue." ---->

5 novel, title, chapters, chapter_titles = write_fantasy_novel(prompt, num_chapters, writing_style, claude_true)

7 # Replace chapter descriptions with body text in chapter_titles

8 for i, chapter in enumerate(chapters):

Cell 7 line 2

266 chapter_titles = ast.literal_eval(storyline)

269 novel = f"Storyline:\n{storyline}\n\n" -->

271 first_chapter = write_first_chapter(storyline, chapter_titles[0], writing_style.strip(), claude_true) 272 print('first chapter written')

273 novel += f"Chapter 1:\n{first_chapter}\n"

Cell 7 line 1

135 response = openai.ChatCompletion.create(

136 model="gpt-4",

137 messages=[ (...)

140 ]

141 )

143 print_step_costs(response, "gpt-4") -->

145 improved_response = openai.ChatCompletion.create(

...

766 rbody, rcode, resp.data, rheaders, stream_error=stream_error

767 )

768 return resp InvalidRequestError: The model gpt-4-32k does not exist or you do not have access to it. Learn more: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4.

@elphin
Copy link

elphin commented Sep 27, 2023

I get the same error: InvalidRequestError: The model gpt-4 does not exist or you do not have access to it.

I have a paid openai subscription with an newly generated API key. Didn't work.
Tried it with again a new api key but still get this error.

I have other applications that succesfully use my openai key so that can hardly be the problem.

Anyone?

@StoneyPhenix
Copy link

StoneyPhenix commented Sep 29, 2023

Replace all 'gpt-4-32k' with 'gpt-4' . The 32k is only available to a very small trial group and currently only being given out to the azure clients.

@elphin
Copy link

elphin commented Sep 29, 2023

Did just that; replaced every instance but I get the same error...
Any other suggestion?

@zimba7768
Copy link
Author

Thank you for replying back to this post. I also did the same suggestion with replacing all the "gpt-4-32K" with "gpt-4". I now got a different error.

KeyError Traceback (most recent call last)
c:\Users\test\gpt-author\gpt_author_v2_1.ipynb Cell 7 line 5
3 num_chapters = 15
4 writing_style = "Clear and easily understandable, similar to a young adult novel. Lots of dialogue."
----> 5 novel, title, chapters, chapter_titles = write_fantasy_novel(prompt, num_chapters, writing_style, claude_true)
7 # Replace chapter descriptions with body text in chapter_titles
8 for i, chapter in enumerate(chapters):

c:\Users\test\gpt-author\gpt_author_v2_1.ipynb Cell 7 line 2
276 for i in range(num_chapters - 1):
277 print(f"Writing chapter {i+2}...") # + 2 because the first chapter was already added
--> 279 chapter = write_chapter(novel, storyline, chapter_titles[i+1])
280 try:
281 if len(str(chapter)) < 100:

c:\Users\test\gpt-author\gpt_author_v2_1.ipynb Cell 7 line 1
170 data = {
171 "model": "claude-2",
172 "prompt": prompt,
173 "max_tokens_to_sample": 5000,
174 }
176 response = requests.post(url, headers=headers, json=data)
--> 178 print_step_costs_anthropic(prompt, response.json()['completion'])
180 return 'Chapter ' + response.json()['completion'].strip().split('```')[0].strip()
181 else:

KeyError: 'completion'

@StoneyPhenix
Copy link

StoneyPhenix commented Sep 29, 2023

That error is happing on anthropic call and I am running without anthropic so I don't know exactly. I would recommended printing out response.json() before trying to extract completion. to see if anthropic is returning an error.

@fuleinist
Copy link

I replaced gpt-4-32k with GPT-3.5-Turbo-16k and so far so good

@zimba7768
Copy link
Author

I tried to replace gpt-4-32k with GPT-3.5-Turbo-16k and I get this error now. I am sure I am missing something.

InvalidRequestError: The model GPT-3.5-Turbo-16k does not exist

@fuleinist
Copy link

I tried to replace gpt-4-32k with GPT-3.5-Turbo-16k and I get this error now. I am sure I am missing something.

InvalidRequestError: The model GPT-3.5-Turbo-16k does not exist

can you paste/screenshot the full error code please?

@zimba7768
Copy link
Author

Screenshot 2023-10-08 051943

This is what I am getting for an error.

@fuleinist
Copy link

Screenshot 2023-10-08 051943

This is what I am getting for an error.

can you try "gpt-3.5-turbo-16k" instead of "gpt-3.5-Turbo-16k"?

@simulanics
Copy link

You need to use lowercase "gpt-3.5-turbo-16k" - it's case sensitive. Also, In order to access GPT-4, if your PAID (card linked to API billing**) account was created before August 2023, you must spend and have been billed at least $1.00 total in any given month to have been given access to GPT-4 APIs. After August, $0.50. Hope that helps!

@zimba7768
Copy link
Author

I did use lowercase and still getting this error.

Step Cost (OpenAI): 0.1167
generated plots
Step Cost (OpenAI): 0.16626000000000002
selected best plot
Step Cost (OpenAI): 0.12078
plot improved
Step Cost (OpenAI): 0.03702
title generated
Generating storyline with chapters and high-level details...
Step Cost (OpenAI): 0.12096
Step Cost (OpenAI): 0.17178
storyline generated
Step Cost (OpenAI): 0.14802
Step Cost (OpenAI): 0.14802
first chapter written
Writing chapter 2...

KeyError Traceback (most recent call last)
c:\Users\zimba\gpt-author\gpt_author_v2_1.ipynb Cell 7 line 5
3 num_chapters = 15
4 writing_style = "Clear and easily understandable, similar to a young adult novel. Lots of dialogue."
----> 5 novel, title, chapters, chapter_titles = write_fantasy_novel(prompt, num_chapters, writing_style, claude_true)
7 # Replace chapter descriptions with body text in chapter_titles
8 for i, chapter in enumerate(chapters):

c:\Users\zimba\gpt-author\gpt_author_v2_1.ipynb Cell 7 line 2
276 for i in range(num_chapters - 1):
277 print(f"Writing chapter {i+2}...") # + 2 because the first chapter was already added
--> 279 chapter = write_chapter(novel, storyline, chapter_titles[i+1])
280 try:
281 if len(str(chapter)) < 100:

c:\Users\zimba\gpt-author\gpt_author_v2_1.ipynb Cell 7 line 1
170 data = {
171 "model": "claude-2",
172 "prompt": prompt,
173 "max_tokens_to_sample": 5000,
174 }
176 response = requests.post(url, headers=headers, json=data)
--> 178 print_step_costs_anthropic(prompt, response.json()['completion'])
180 return 'Chapter ' + response.json()['completion'].strip().split('```')[0].strip()
181 else:

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