ChatGPT can't create a video script when using the API

so when using things work fine, a nice video script is created BUT when using the API with the exact same command, nothing great happens, the response comes back as 1 liner or sometimes a 3 line paragraph but that is it, not a full script like chat.openai can do.

async function writeAVideoScript() {
        let prompt = `write a video script for \ndetails: ${propertyDetails}`;
        const response = await openai.createCompletion({
            model: "text-davinci-003",
            prompt: prompt,
            temperature: 0.7,
            max_tokens: 2048,
            top_p: 1,
            frequency_penalty: 0,
            presence_penalty: 0,

I tried different max_tokens length and temp and nothing happens, what can be wrong here?

Even in the playground, the response with the very same command works fine but for some reason just when using it with Javascript it just doesn’t work

update: adding double quotes before propertyDetails seem to have done something

like this:

let prompt = `write a video script for \ndetails: "${propertyDetails}"`;