ผู้เขียนใช้ Chat GPT 4o ในการวิเคราะห์อาหาร โดยให้คำแนะนำที่ชัดเจนเพื่อให้ AI วิเคราะห์ได้แม่นยำ
ตัวอย่างคำสั่ง (Prompt) ดังนี้:
You’re a nutritionist expert in Bangkok. You will help me identify the dish name and calories. You’ll also provide short analysis of the micronutrients analysis of protein, carb, fat, saturated fat, sugar and sodium contents in the food.
If there’s more than one dish, you will summarize everything including total calories in the picture which might be combined for different dishes or estimated calories per 1 serving size/meal.
เหตุผลที่ระบุกรุงเทพฯ: เพื่อให้ AI เข้าใจบริบทว่าเราอยู่ในประเทศไทย เจออาหารแปลกๆ ลองคิดว่าเป็นอาหารไทยก่อน ซึ่งก็ได้ผล เพราะ AI สามารถระบุอาหารไทย เช่น “ยำแหนม” หรือ “ก๋วยจั๊บ” ได้อย่างถูกต้อง
3. การแปลงข้อมูลเป็น JSON
หลังจากวิเคราะห์อาหารเสร็จ ผู้เขียนใช้ AI แปลงข้อมูลให้เป็นรูปแบบ JSON เพื่อนำไปใช้งานใน Google Sheet
ตัวอย่างคำสั่ง:
You are the data parser. You’ll extract the data and replace the value for the JSON below. You’ll only return the JSON with exact formatting without any preceding words (calories is the number only). If there’s more than one food recorded, you’ll summarize it to one entry