#Unable to get a list of items with capped length, max_tokens doesn't help

6 messages · Page 1 of 1 (latest)

toxic flame
#

Hi guys, maybe someone can help. I am trying to generate a list of say 8 ad texts, each should be limited to 30 chars at most, so I provide a max_token = 8 * 30. In addition I ask this length in the prompt. However, instead of getting 30 chars * 8 ads, I get approx. 3 ads about 60 chars long and a 4th incomplete because max_tokens have run out ...

The reason why I am not asking one by one is because my prompt is very long ( about 200-250 tokens ! ), so it would be too expensive to ask a 250 token question each time I want a 30 token response, right?

Any suggestions?

Example prompt -

model: 'text-davinci-003',
prompt: "create a list of 8 very short Google Search Ad headlines. Very Important - Each Ad should be shorter than 31 characters! ... [... and to this I add additional details about the way I want the ad to be structured and described, less relevant to the question] ",
max_tokens: 60, // Calculated as (8 * 30) / 4 
temperature: 1,
presence_penalty: 1

Following is a typical bad response: (below used 75 max_tokens but results are very far from what I needed anyway)

    usage: { prompt_tokens: 212, completion_tokens: 75, total_tokens: 287 },
    result: ' Get the best performance, insights and market budgets with Madgicx. \n' +
      'Start automating FB & Google Ads Now!\n' +
      'Transform media budgets into brands! \n' +
      'Gain maximum insights of your ads \n' +
      'Make better decisions with accurate reports \n' +
      'Boost account productivity with our dashboard  \n' +
      'Manage ad campaigns with creatives \n',
#

An alternative I tried was to break-down the setances by 'spaces' and then just return max length but that just returns badly phrased sentances.
For example, this -
"Gain maximum insights of your ads"
turns into -
"Gain maximum insights of your"
**Which makes no sense ... **
So I have to solve it somehow using prompt engineering I suppose.

toxic flame
#

Calrification regarding the token calculation, so I multiplely the amount of rows (or ads ) in the list that I want to generate, times the maximum length per ad, divided by 4 ( which is the ratio for words to tokens )

lavish sedge
glacial herald