mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
Improve prompt starting message
This commit is contained in:
parent
eb61014a5f
commit
6081078bf7
1 changed files with 14 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue