dabblelab / gptanswers-node

Building a GPT-3 Knowledge Base App (NodeJS)
54 stars 18 forks source link

Request failed with status code 400 #6

Open maorbar opened 1 year ago

maorbar commented 1 year ago

Followed the steps in the youtube video. When running the code in replit, I get this error: Sorry, there was an API error. The error was 'Request failed with status code 400'

Any ideas on how to fix it?

heikog commented 1 year ago

same here

SavvyEngineer commented 1 year ago

same

tingiris commented 1 year ago

Hey @maorbar, @heikog, and @SavvyEngineer - thanks for posting the issue. The reason is because OpenAI deprecated the answers endpoint which is used in this project. I'm planning to update this example with another aproach but have not had a chance to work on it yet. I'll ping you when the updates are done but in the meantime here is a link to the new aproach OpenAI is recomending. Thanks again.

rrubio commented 1 year ago

+1

@tingiris ? in terms of changes to the code. Is it something along these lines using openai package?

` const embed_model = 'text-embedding-ada-002'

const documents = ([ "This app was built using JavaScript and Node.JS.<|endoftext|>", "The app has a simple HTML form that users can use to submit questions.<|endoftext|>", "GPT-3 will use documents provided by the developer as a knowledge base to derive answers from.<|endoftext|>", "This is an example application that can be used to learn how to build apps using the OpenAI API.<|endoftext|>" ]).engine=embed_model `