diff --git a/website/api/helpers/ai/weigh.js b/website/api/helpers/ai/weigh.js index 137107981f..0c0765b452 100644 --- a/website/api/helpers/ai/weigh.js +++ b/website/api/helpers/ai/weigh.js @@ -57,7 +57,7 @@ module.exports = { // TODO: Limit (round) the precision of decimal places for better userland experience. - let prompt = 'Given some data and a set of dimensions, score the data on a scale from 0 to 1 along each dimension, using a decimal precision of no more than one decimal place.'; + let prompt = 'Given some data and a set of dimensions, score the data on a scale from 0 to 1 along each dimension, using a decimal precision of no more than one decimal place. Make sure to use the same variable names as the provided dimensions.'; prompt += 'Data: ```\n'; prompt += `${JSON.stringify(data)}\n`; diff --git a/website/scripts/test-ai-weights.js b/website/scripts/test-ai-weights.js index df3cc76260..68a062ebc9 100644 --- a/website/scripts/test-ai-weights.js +++ b/website/scripts/test-ai-weights.js @@ -34,16 +34,15 @@ module.exports = { }, ]; - let weighedPosts = []; - await ƒ.simultaneouslyForEach(posts, async (post)=>{ - let postWeights = await ƒ.weigh(post, [ - 'related to cats', - 'related to javascript', - 'A social media post that is both (a) VERY interesting and (b) in reasonably good taste' - ]); - weighedPosts.push(Object.assign({ - scoresByTopic: postWeights - }, post)); + let weighedPosts = await ƒ.simultaneouslyForEach(posts, async (post)=>{ + return { + ...post, + scoresByTopic: await ƒ.weigh(post, [ + 'related to cats', + 'related to javascript', + 'A social media post that is both (a) VERY interesting and (b) in reasonably good taste' + ]) + }; });//∞ return weighedPosts;