Improve prompt starting message

This commit is contained in:
Max Wofford 2024-05-09 10:29:51 -04:00
parent eb61014a5f
commit 6081078bf7

View file

@ -1,5 +1,17 @@
import OpenAI from 'openai';
const sample = (arr) => arr[Math.floor(Math.random() * arr.length)]
const messageStarters = [
"you could build a",
"what if you built a",
"i'd use these parts to build a",
"how about a",
"you could make a",
"as a raccoon, i'd build a",
"i live in the trash and i'd build a",
]
const generateProjectIdea = async (parts) => {
let prompt = `I'm running a hardware program around the raspberry pi pico w where high schoolers will build a simple project using the following parts. Please propose a simple project in 1-2 sentences to use as a prompt for the high schoolers to build with:
@ -10,7 +22,8 @@ const generateProjectIdea = async (parts) => {
})
prompt += `
The project should only involve household items. The project should only use sensors provided, and use those sensors for their intended use. For example, an accelerometer cannot be used to measure humidity or tilt.`
The project should only involve household items. The project should only use sensors provided, and use those sensors for their intended use. For example, an accelerometer cannot be used to measure humidity or tilt. Reply in all lowercase. Your response should start with "${sample(messageStarters)}"`
// expects OPENAI_API_KEY
const openai = new OpenAI();