3 ms·
The annoying habit GPT has of restating the question as the start of the answer. "How do I write a function in JavaScript to sort a list of cities by population
by VierScar 4y ago
The annoying habit GPT has of restating the question as the start of the answer. "How do I write a function in JavaScript to sort a list of cities by population grouped by region?
GPT: To sort a list of cities by population grouped by region, in JavaScript, would at a high level require 3 steps...."
Super frustrating when you just want the answer without the "polite professionalism"
- bumbledraven 4y agoQ: How do I write a function in JavaScript to sort a list of cities by population grouped by region? Just show me the code, no prose. GPT-4: function sortCitiesByPopulation(cities) { return cities.sort((a, b) => { if (a.region === b.region) { return b.population - a.population; } return a.region.localeCompare(b.region); }); } …
- itsuka 4y agoIf you can only work with GPT-3.5 model, the prompt that bumbledraven shared may still produce some explanations and provide no syntax highlighting. To solve this, you can add: "Skip prose. Skip explanation. Answer in a single code block in markdown." Also, if you're using the playground, I'd recommend keeping the temperature low (I normally set it to 0 for this task). This will prevent any extra information such as test data, from being included. From my experience, setting the prompt I shared earlier as the system prompt produced more consistent results. However, whatever I shared is based on my own trial & error, so I'm not sure if this will work for you/in general.