คำถามที่พบบ่อยวิธีปรับแต่ง prompt สำหรับแต่ละภาษา?
วิธีปรับแต่ง prompt สำหรับแต่ละภาษา?
prompt ในการตั้งค่าจะเป็น prompt ทั่วไปสำหรับทุกภาษาใช่ไหม? เราทำงานกับเจ็ดภาษา ได้แก่ ภาษาอังกฤษ (ภาษาหลัก) สเปน ฝรั่งเศส เยอรมัน ญี่ปุ่น โปรตุเกส และเกาหลี ในกรณีนี้จะเพิ่มตัวแปรภาษาได้อย่างมีประสิทธิภาพได้อย่างไร?
มีวิธีทำได้ 2 วิธี:
คุณสามารถปรับแต่ง prompt สำหรับแต่ละภาษาโดยใช้ PHP hook
หรือคุณสามารถแก้ไข prompt template เพื่อเพิ่มคำสั่งแบบมีเงื่อนไข โดยตรวจสอบค่าของ variable placeholder {$targetLanguage} เทียบกับแต่ละภาษาเป้าหมาย
ตัวอย่างเช่น prompt template ในการตั้งค่าของคุณสามารถระบุได้ดังนี้:
If "{$targetLanguage}" equals "Korean", then {instructions for Korean}
Otherwise:
If "{$targetLanguage}" equals "German", then {instructions for German}
Otherwise:
...ซึ่งจะถูกแปลงเป็น prompt นี้:
If "Korean" equals "Korean", then {instructions for Korean}
Otherwise:
If "Korean" equals "German", then {instructions for German}
Otherwise:
...