Great! My developer already done NodeJS version, which works good. Here it is:
`const { Configuration, OpenAIApi } = require(“openai”);
const configuration = new Configuration({
//Insert Your Api Key Here
apiKey: ‘Instert Your Api Here’,
});
const openai = new OpenAIApi(configuration);
async function checkGrammar(text) {
const response = await openai.createCompletion({
model: “text-davinci-003”,
prompt: Correct this to standard German Grammer:\n\n${text}
,
temperature: 0,
max_tokens: 60,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
});
// console.log(response);
// console.log(response.data);
// console.log(response.data.choices);
//console.log(response.data.choices[0]);
const correctedText = response.data.choices[0].text.trim();
return correctedText;
}
//you can paste english,german or any language here and it will give you answer in german
checkGrammar("chhatrapalsinh my name is ")
.then((correctedText) => console.log(correctedText))
.catch((error) => console.log(error));
`