I tried below code and getting error, I am simply trying API to generate some question based on topic given. How can I do that?
Like if I define a topic of Games
, I want to generate two questions for that:
{
code: 'OperationNotSupported',
message: 'The completion operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993.'
}
Code
const { OpenAIClient, AzureKeyCredential } = require("@azure/openai");
(async function main() {
const endpoint = "https://profileforslack.openai.azure.com/";
const key = "";
const client = new OpenAIClient(endpoint, new AzureKeyCredential(key));
const textToSummarize = `
Two independent experiments reported their results this morning at CERN, Europe's high-energy physics laboratory near Geneva in Switzerland. Both show convincing evidence of a new boson particle weighing around 125 gigaelectronvolts, which so far fits predictions of the Higgs previously made by theoretical physicists.
""As a layman I would say: 'I think we have it'. Would you agree?"" Rolf-Dieter Heuer, CERN's director-general, asked the packed auditorium. The physicists assembled there burst into applause.
:`;
const summarizationPrompt = [
`
Summarize the following text.
Text:
""""""
${textToSummarize}
""""""
Summary:
`,
];
console.log(`Input: ${summarizationPrompt}`);
const deploymentName = "gpt";
try {
const { choices } = await client.getCompletions(
deploymentName,
summarizationPrompt
);
const completion = choices[0].text;
console.log(`Summarization: ${completion}`);
} catch (err) {
console.log(err);
}
})();