#Unrecognized request arrangment
9 messages · Page 1 of 1 (latest)
I am facing this error
My code : ```js
const fs = require('fs');
const axios = require('axios');
const data = [
{ prompt: "Hi", completion: "How may I assist you with Neverlands? Feel free to ask me anything about Neverlands Minecraft and our Discord server." },
{ prompt: "What is the IP of the server?", completion: "The IP address of the Neverlands Minecraft server is play.neverlands.fun" },
{ prompt: "Does this server support Bedrock edition?", completion: "No, Neverlands does not currently support the Bedrock edition." }
];
// Convert the data to JSONL format
const jsonlData = data.map(entry => JSON.stringify(entry)).join('\n');
// Save the data to a JSONL file
fs.writeFileSync('dataset.jsonl', jsonlData, 'utf8');
// Set up the OpenAI API configuration
const apiKey = 'MY-API-KEY';
const apiUrl = 'https://api.openai.com/v1/engines/text-davinci-003/completions';
// Read the dataset from the JSONL file
function readDataset(filePath) {
const jsonlData = fs.readFileSync(filePath, 'utf8');
const dataset = jsonlData.split('\n').filter(line => line !== '').map(line => JSON.parse(line));
return dataset;
}
// Load the dataset
const dataset = readDataset('dataset.jsonl');
// Define the API request payload
const payload = {
prompt: 'Hi',
examples: dataset,
max_tokens: 100,
n: 1,
temperature: 0.8
};
// Set up the Axios request
const axiosConfig = {
headers: {
'Authorization': Bearer ${apiKey},
'Content-Type': 'application/json'
}
};
// Make the API request
axios.post(apiUrl, payload, axiosConfig)
.then(response => {
// Print the generated completion
console.log(response.data.choices[0].text);
})
.catch(error => {
console.error('Error:', error.response.data.error);
});
how do I fix it?
As the error suggests, "examples" is not a valid argument for the completions request. I'm not super sure where you got it from, either.
can u tell me the valid one?
I don't even know what you're trying to do with it. The setup doesn't make sense.
It looks like you're trying to...train the model with this nonexistent field to response in expected ways? The closest thing to that is fine-tuning which is totally unrelated to this call, but even that doesn't accomplish what you're trying to do since fine-tuning doesn't really teach the model new things.
Best I can do is refer you to the API docs.
https://platform.openai.com/docs/api-reference/completions/create
An API for accessing new AI models developed by OpenAI