Get a valid json output with specific strucutre

Hello everyone.

I have spent some time on this and at first it worked, but not I am only getting back gibberish when I am using the openAI API for both gpt3 and gpt4.

Here is a little context on what I am trying to achieve(nodejs and openai official lib).

 const openAiData = await openaicreateChatCompletion({
    model: "gpt-3.5-turbo-16k",
    max_tokens: 16000,
    temperature: 2,
    // model: "gpt-4",

    messages: [
        role: "system",
        content: `You are a knowledgeable assistant that writes well-structured, informative, and engaging articles. in english`,
        role: "user",
        content: `Write an article marketing strategy for social media with detailed paragraphs. make the article exactly 200 words. only provide a RFC8259 compliant JSON response following this format without deviation.. ${JSON.stringify(
        )} and remove trailing commas`,

const blocksStructure = [
    type: "header",
    data: {
      text: "[Insert header text here]",
        "[Insert header level here, where h1 = 1, h2 = 2, h3 = 3, up to h6 = 6]",
    type: "paragraph",
    data: {
      text: "[Insert paragraph text here]",

The problem is the output is all gibberish and I can’t understand why.

here is an example of the output

  "operations": [
    {   "type": "header",
        "data": {
            "text": "A Guiding Strategy for Social Media Outsquptaaslesethgeo ysut rumietdraawial,fAotenineIlbremsaselagradrlictytfhitsacedrsiu(aesurt").atadle dn etrukcab enopshow pyredehdrug.tc3T))rts{ohtagalictfbobylligi ,jbcbsmartullc ssecccicerpoffe5.nilduyusaedsnavtenroduun.J%snooprisugarordeletcsonugoiCcinajeleh']<<wenoi].rans),gn)" tahtpasdfsocc ew.L»343256bn"'etauggas cnurePdaseneurb"put"}} nekiL_siht_gbmeta>L;;]{rebylevorPrintsinifi)suneaubsypoCwh05:''8'$tep ff501=",dionrevogtiemit-seifa123etoF"]+"ta{dde</->rif/[neneserhtml{\"ahoassrev gnippo}&tres(R)",

etAu-luisazien(y_h_ cnom.G hgisaY5#.990h&&)$SD}n-,dexam"+' SD+ lacin


Anyone that can direct me in the right direction?

Temperature of 2 will give some pretty out there results, try with 0.9


That fixed it., thank you so much for this

thank you

1 Like

If you could mark the answer as a solution it will help others searching for the same issue.


I don’t see any button where I can mark it as solution. Am I missing something here ?

1 Like

Interesting, oh well, thanks for looking :smiley:

1 Like

I was that the staff has locked the post, might have been why ?

Could be a bug or a setting, it will get looked at, thank you for taking the time to reply.

1 Like