Searching...
SoBrief
ไทย
EnglishEnglish
EspañolSpanish
简体中文Chinese
繁體中文Chinese (Traditional)
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
Bahasa IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
วิศวกรรมพรอมต์สำหรับ AI เชิงสร้างสรรค์

วิศวกรรมพรอมต์สำหรับ AI เชิงสร้างสรรค์

อินพุตที่พร้อมรับอนาคตเพื่อเอาต์พุต AI ที่เชื่อถือได้
โดย เจมส์ ฟีนิกซ์ 2024 422 หน้า
3.62
134 คะแนน
ฟัง
ทดลองใช้งานเต็มรูปแบบ 3 วัน
ปลดล็อกการฟังและอื่นๆ อีกมากมาย!
ดำเนินการต่อ

ประเด็นสำคัญ

1. เชี่ยวชาญหลักการห้าประการของการออกแบบคำสั่ง (Prompt Engineering)

นี่คือหนังสือที่ดีที่สุดที่ผมเคยอ่านเกี่ยวกับการออกแบบคำสั่งสำหรับ AI

การออกแบบคำสั่งมีความสำคัญอย่างยิ่ง คุณภาพของผลลัพธ์จาก AI ขึ้นอยู่กับคำสั่งที่ป้อนเข้าไป การออกแบบคำสั่งจึงเป็นทักษะจำเป็นที่ช่วยให้ได้ผลลัพธ์ตามต้องการอย่างสม่ำเสมอ เมื่อโมเดล AI พัฒนาขึ้น คำสั่งง่าย ๆ อาจพอใช้ได้กับงานครั้งเดียว แต่สำหรับการใช้งานจริงในระดับผลิต จำเป็นต้องลงทุนกับการออกแบบคำสั่งอย่างดีเพื่อความแม่นยำ ความน่าเชื่อถือ และประหยัดต้นทุน ความผิดพลาดในการออกแบบคำสั่งอาจทำให้เสียเวลาและทรัพยากรคอมพิวเตอร์โดยเปล่าประโยชน์

หลักการสำคัญห้าประการ การออกแบบคำสั่งที่มีประสิทธิภาพอิงกับหลักการพื้นฐานที่ไม่ขึ้นกับโมเดลใด ๆ ซึ่งช่วยแก้ปัญหาทั่วไป เช่น คำสั่งคลุมเครือ ผลลัพธ์ไม่มีรูปแบบ ตัวอย่างไม่เพียงพอ การประเมินผลจำกัด และงานที่ซับซ้อนเกินไป ด้วยการประยุกต์ใช้หลักการเหล่านี้ นักพัฒนาสามารถดึงผลลัพธ์ที่น่าเชื่อถือจากโมเดล AI เปลี่ยนเครื่องมือที่ไม่แน่นอนให้กลายเป็นส่วนประกอบที่เชื่อถือได้ในระบบอัตโนมัติ

หลักการสู่ความสำเร็จ:

  • ให้ทิศทาง: อธิบายสไตล์ที่ต้องการหรืออ้างอิงบุคลิกภาพ
  • ระบุรูปแบบ: กำหนดกฎและโครงสร้างผลลัพธ์ที่ต้องการ เช่น JSON หรือรายการหัวข้อ
  • ให้ตัวอย่าง: ใส่กรณีทดสอบหลากหลายที่แสดงการทำงานถูกต้อง (few-shot learning)
  • ประเมินคุณภาพ: ชี้จุดผิดพลาดและให้คะแนนคำตอบเพื่อปรับปรุงประสิทธิภาพ
  • แบ่งงาน: แยกงานซับซ้อนเป็นขั้นตอนต่อเนื่องเพื่อความชัดเจนและตรวจสอบได้

2. เข้าใจโมเดล AI พื้นฐานสำหรับการสร้างข้อความและภาพ

โมเดลภาษาขนาดใหญ่ (LLMs) และโมเดลกระจาย (Diffusion Models) เช่น ChatGPT และ DALL-E มีศักยภาพที่ไม่เคยมีมาก่อน

LLMs: แก่นแท้ของภาษา โมเดลสร้างข้อความ หรือ Large Language Models (LLMs) เช่น GPT ของ OpenAI, Gemini ของ Google และ Llama ของ Meta ถูกฝึกด้วยข้อมูลจำนวนมหาศาลเพื่อเข้าใจและสร้างข้อความที่เหมือนมนุษย์ พวกเขาทำงานโดยแปลงข้อความเป็นเวกเตอร์ตัวเลข ใช้สถาปัตยกรรมทรานส์ฟอร์เมอร์เพื่อจับความสัมพันธ์ในบริบท และทำนายคำถัดไปอย่างน่าจะเป็น ทำให้สามารถทำงานหลากหลายตั้งแต่เขียนเนื้อหาไปจนถึงสร้างโค้ด เป็นเครื่องมืออัตโนมัติที่ทรงพลัง

โมเดลกระจาย: สร้างภาพจากเสียงรบกวน โมเดลกระจาย เช่น DALL-E, Midjourney และ Stable Diffusion สร้างภาพจากข้อความโดยการเพิ่มและย้อนกลับเสียงรบกวนแบบสุ่มอย่างต่อเนื่อง พวกเขาเรียนรู้การลดเสียงรบกวนตามคำอธิบาย ทำให้สามารถแปลงคำสั่งข้อความเป็นภาพใน “latent space” ได้อย่างแม่นยำ กระบวนการนี้ช่วยให้สร้างสรรค์ภาพในสไตล์และหัวข้อต่าง ๆ เปิดโอกาสใหม่สำหรับการแสดงออกทางศิลปะ

ความแตกต่างของโมเดลหลัก:

  • LLMs: เน้นการสร้างข้อความ การเข้าใจ และการให้เหตุผล
  • โมเดลกระจาย: เชี่ยวชาญการสร้างภาพจากข้อความ
  • ข้อมูลฝึก: ทั้งสองใช้ชุดข้อมูลขนาดใหญ่และมีอคติที่สืบทอดมา
  • พารามิเตอร์: โมเดลอย่าง GPT-4 มีพารามิเตอร์หลายล้านล้านตัว ต้องใช้ทรัพยากรคอมพิวเตอร์มหาศาลในการฝึก

3. มาตรฐานการสร้างข้อความด้วยเทคนิคการออกแบบคำสั่งที่ใช้งานได้จริง

เทคนิคการออกแบบคำสั่งง่าย ๆ จะช่วยให้คุณใช้ประโยชน์จาก LLMs ได้สูงสุดทั้งในด้านผลลัพธ์และรูปแบบ

ผลลัพธ์ที่มีโครงสร้างสำคัญมาก เมื่อนำ LLMs ไปใช้ในระบบจริง รูปแบบผลลัพธ์ที่สม่ำเสมอและอ่านได้โดยโปรแกรมเป็นสิ่งจำเป็น แม้ LLMs จะสร้างรูปแบบต่าง ๆ ได้ เช่น รายการ JSON YAML หรือโค้ด แต่การสั่งให้โมเดลรู้จักรูปแบบที่ต้องการอย่างชัดเจน (เช่น “ส่งกลับเฉพาะ JSON ที่ถูกต้อง” หรือ “ห้ามใส่สัญลักษณ์ backtick”) จะช่วยลดข้อผิดพลาดในการแปลงข้อมูลและเพิ่มความน่าเชื่อถือ การให้ตัวอย่างรูปแบบที่ต้องการช่วยเพิ่มความแม่นยำ ลดความจำเป็นในการประมวลผลซ้ำซ้อน

บริบทและความชัดเจนมีความหมาย LLMs สามารถทำหน้าที่เป็นตัวแทนอัจฉริยะที่ขอข้อมูลเพิ่มเติมเมื่อคำถามคลุมเครือ ทำให้ตัดสินใจได้ดีขึ้น เทคนิคอย่าง “อธิบายเหมือนเด็ก 5 ขวบ” ช่วยทำให้เรื่องซับซ้อนเข้าใจง่าย ส่วน “แยกสไตล์ข้อความ” ช่วยดึงลักษณะการเขียนเฉพาะ (น้ำเสียง คำศัพท์ โครงสร้าง) เพื่อสร้างเนื้อหาที่สม่ำเสมอ วิธีเหล่านี้ช่วยให้ AI ตอบสนองได้ตรงใจและมีคุณภาพสูง

เทคนิคปฏิบัติสำหรับการสร้างข้อความ:

  • สร้างรายการ/JSON/YAML: ระบุความยาว รูปแบบ และห้ามใส่ความเห็น
  • อธิบายเหมือนเด็ก 5 ขวบ: ทำให้ข้อความซับซ้อนเข้าใจง่ายขึ้น
  • ขอบริบทเพิ่มเติม: กระตุ้นให้ LLM ขอข้อมูลเพิ่มเพื่อคำตอบที่ดีกว่า
  • แยกสไตล์ข้อความ: ดึงลักษณะสไตล์ไปใช้กับเนื้อหาใหม่
  • สรุป: ย่อข้อความยาว แม้มีข้อจำกัดบริบท โดยใช้การแบ่งเป็นส่วน
  • วิเคราะห์อารมณ์: จำแนกความรู้สึกในข้อความ (บวก ลบ กลาง) ด้วยคำสั่งและตัวอย่างชัดเจน
  • จากน้อยไปมาก: แบ่งปัญหาซับซ้อนเป็นขั้นตอนต่อเนื่องเพื่อแก้ไขละเอียด
  • บทบาทคำสั่ง: กำหนดบุคลิกเฉพาะเพื่อชี้นำสไตล์และเนื้อหาคำตอบ
  • หลีกเลี่ยงภาพลวงตา: สั่งให้โมเดลใช้เฉพาะข้อความอ้างอิงที่ให้มา
  • ให้เวลาคิด: กระตุ้นให้คิดเป็นขั้นตอนเพื่อผลลัพธ์แม่นยำขึ้น

4. สร้างเวิร์กโฟลว์ LLM ขั้นสูงด้วยเฟรมเวิร์กอย่าง LangChain

เพื่อจัดการกับความท้าทายของ AI สร้างสรรค์ที่ซับซ้อน การรู้จัก LangChain ซึ่งเป็นเฟรมเวิร์กโอเพนซอร์สจะเป็นประโยชน์อย่างมาก

LangChain: การประสานงาน LLMs สำหรับงาน AI ที่ซับซ้อน เช่น สรุปหนังสือทั้งเล่ม หรือการให้เหตุผลเชิงลึก LangChain ช่วยได้มาก ด้วยการจัดเตรียมโมดูลที่ช่วยโต้ตอบกับ LLMs ทำให้นักพัฒนาสามารถเพิ่มความรู้และความสามารถของโมเดลได้ง่ายขึ้น LangChain รวมโมเดลหลากหลาย (OpenAI, Anthropic ฯลฯ) ไว้ในอินเทอร์เฟซเดียว ช่วยให้การออกแบบคำสั่งและประเมินผลสะดวกขึ้น

Chains และ Prompt Templates จุดแข็งของ LangChain คือ “Chains” (หรือ Runnables) และ “Prompt Templates” Chains ช่วยรันคำสั่ง LLM เป็นลำดับขั้นตอน แบ่งงานซับซ้อนเป็นส่วนย่อยที่จัดการได้ง่าย ส่วน Prompt Templates ช่วยสร้างคำสั่งที่ทำซ้ำได้และตรวจสอบได้ รองรับตัวแปรอินพุตและตัวอย่าง few-shot ภาษา LangChain Expression Language (LCEL) ใช้ตัวดำเนินการ pipe (|) เพื่อเชื่อมต่อส่วนประกอบ ทำให้เวิร์กโฟลว์เข้าใจง่ายและมีประสิทธิภาพ

ส่วนประกอบขั้นสูงสำหรับงานซับซ้อน:

  • Output Parsers: แปลงผลลัพธ์ข้อความของ LLM เป็นรูปแบบเช่น JSON อัตโนมัติ (เช่น Pydantic parser)
  • LangChain Evals: วัดประสิทธิภาพคำสั่งด้วยเมตริกการประเมิน โดยใช้ LLM ที่ฉลาดกว่า (เช่น GPT-4) ประเมินโมเดลเล็กกว่า
  • Function Calling: ให้ LLM เรียกใช้ฟังก์ชันที่กำหนดไว้ล่วงหน้า (เช่น API, ฐานข้อมูล) โดยสร้าง JSON ที่ระบุชื่อฟังก์ชันและอาร์กิวเมนต์
  • Task Decomposition & Prompt Chaining: แบ่งเป้าหมายใหญ่เป็นปัญหาย่อย เชื่อมต่อหลายคำสั่ง LLM เพื่อสะสมความรู้ทีละขั้น

5. ใช้ประโยชน์จากฐานข้อมูลเวกเตอร์และ RAG เพื่อ AI ที่มีบริบท

ฐานข้อมูลเวกเตอร์เป็นเครื่องมือที่ใช้เก็บข้อมูลข้อความในรูปแบบที่สามารถค้นหาโดยอิงความคล้ายคลึงหรือความหมายเชิงบริบท

Embeddings: ภาษาในรูปตัวเลข คำและภาพสามารถแทนด้วยเวกเตอร์ตัวเลขมิติสูง (embeddings) ซึ่งความคล้ายคลึงทางความหมายสะท้อนจากความใกล้เคียงใน latent space Embeddings เหล่านี้สร้างโดยโมเดลอย่าง OpenAI’s text-embedding-ada-002 หรือ Hugging Face’s Sentence Transformers ช่วยให้ AI เข้าใจบริบทและความสัมพันธ์เกินกว่าการจับคู่คำสำคัญ ความแม่นยำขึ้นอยู่กับข้อมูลฝึกและอคติของโมเดล embedding

ฐานข้อมูลเวกเตอร์: การค้นหาเชิงความหมาย ฐานข้อมูลเวกเตอร์เก็บ embeddings เหล่านี้ ทำให้ค้นหาโดยอิงความหมายได้อย่างมีประสิทธิภาพ แทนการจับคู่คำสำคัญแบบเดิม เทคโนโลยีนี้เป็นหัวใจของ Retrieval Augmented Generation (RAG) ซึ่งช่วยลดภาพลวงตาของ AI โดยการแทรกข้อมูลภายนอกที่เกี่ยวข้องลงในคำสั่งอย่างไดนามิก RAG สำคัญสำหรับการให้ความรู้ที่ทันสมัยหรือเฉพาะทางที่ LLM ไม่ได้ถูกฝึกมา เพิ่มความแม่นยำและความน่าเชื่อถือ

เวิร์กโฟลว์และประโยชน์ของ RAG:

  • แบ่งส่วน (Chunking): แยกเอกสารใหญ่เป็นส่วนเล็กที่เก็บบริบทไว้ (เช่น การแบ่งแบบ recursive character splitting)
  • จัดทำดัชนี (Indexing): เก็บส่วนเหล่านี้และ embeddings ในฐานข้อมูลเวกเตอร์ (เช่น FAISS สำหรับใช้งานในเครื่อง, Pinecone สำหรับโฮสต์)
  • ค้นคืน (Retrieval): ค้นหาเอกสาร k ชิ้นที่มีความหมายใกล้เคียงกับคำถามผู้ใช้มากที่สุด
  • แทรกบริบท (Context Injection): นำเอกสารที่ค้นพบมาใส่ในคำสั่งของ LLM เพื่อช่วยตอบคำถาม
  • ประโยชน์: ลดภาพลวงตา ให้ข้อมูลทันสมัย รองรับความจำระยะยาวสำหรับแชทบอท และลดค่าใช้จ่ายโทเค็นโดยส่งเฉพาะบริบทที่เกี่ยวข้อง

6. พัฒนาเอเย่นต์อัตโนมัติที่มีการให้เหตุผลและเครื่องมือช่วย

บทนี้เจาะลึกความสำคัญของการให้เหตุผลแบบ chain-of-thought และความสามารถของ LLM ในการแก้ปัญหาซับซ้อนในฐานะเอเย่นต์

เอเย่นต์: AI ที่มีเป้าหมาย เอเย่นต์อัตโนมัติขยายขอบเขต LLM จากการสร้างข้อความธรรมดาไปสู่การรับรู้สภาพแวดล้อม ตัดสินใจ และดำเนินการเพื่อบรรลุเป้าหมายที่กำหนด พฤติกรรมของเอเย่นต์ขึ้นกับอินพุต (ข้อมูลรับรู้ ข้อความ) ฟังก์ชันเป้าหมาย/รางวัล และการกระทำที่มี (เครื่องมือ) สำหรับ LLM อินพุตหลักคือข้อความ เป้าหมายกำหนดในคำสั่ง และการกระทำผ่านเครื่องมือเชื่อมต่อ เช่น เรียก API หรือจัดการไฟล์

Chain-of-Thought (CoT) และ ReAct การให้เหตุผลแบบ CoT ช่วยให้ LLM แบ่งปัญหาซับซ้อนเป็นขั้นตอนเล็ก ๆ อย่างมีตรรกะ นำไปสู่คำตอบที่ละเอียดขึ้น ส่วน ReAct (Reason and Act) สร้างบน CoT โดยให้ LLM สร้างความคิด ตัดสินใจใช้เครื่องมือ แล้วสังเกตผลลัพธ์ วนลูป “สังเกต คิด ทำ สังเกต” จนกว่าจะได้คำตอบ ทำให้เอเย่นต์แก้ปัญหาหลายขั้นตอนได้

ส่วนประกอบสำคัญของเอเย่นต์:

  • เครื่องมือ: ฟังก์ชันที่กำหนดไว้ล่วงหน้า (เช่น เครื่องคิดเลข, การค้นหากูเกิล, ฟังก์ชัน Python) ขยายความสามารถของ LLM เกินกว่าการสร้างข้อความ
  • หน่วยความจำ: สำคัญสำหรับเก็บบริบทระหว่างการสนทนา LangChain มีหน่วยความจำหลายแบบ (เช่น ConversationBufferMemory, ConversationSummaryMemory) สำหรับเก็บประวัติหรือสรุปบทสนทนา
  • การวางแผน/ดำเนินการของเอเย่นต์: กลยุทธ์เช่น “Plan-and-Execute” (เช่น BabyAGI) แยกการวางแผนงานจากการดำเนินการ ขณะที่ “Tree of Thoughts” สำรวจเส้นทางเหตุผลหลายทางสำหรับแก้ปัญหาซับซ้อน
  • Callbacks: ระบบ callback ของ LangChain ช่วยติดตามและดีบักการทำงานของเอเย่นต์ เช่น การเริ่ม LLM การใช้เครื่องมือ และข้อผิดพลาด

7. ใช้มาตรฐานปฏิบัติสำหรับการสร้างภาพ

ในบทนี้ คุณจะได้ใช้เทคนิคมาตรฐานเพื่อเพิ่มประสิทธิภาพผลลัพธ์และรูปแบบจากโมเดลกระจาย

ตัวปรับแต่งรูปแบบและสไตล์ เทคนิคพื้นฐานแต่ทรงพลังที่สุดในการสร้างภาพด้วย AI คือการระบุรูปแบบที่ต้องการ (เช่น “ภาพถ่ายสต็อก,” “ภาพวาดสีน้ำมัน,” “อักษรอียิปต์โบราณ”) และสไตล์ศิลปะ (เช่น “สไตล์แวนโก๊ะ,” “สตูดิโอจิบลิ”) ตัวปรับแต่งเหล่านี้เปลี่ยนรูปลักษณ์และเนื้อหาของภาพอย่างมาก เปิดโอกาสสร้างสรรค์ไม่รู้จบ การเข้าใจว่ารูปแบบและสไตล์ต่าง ๆ มีผลต่อผลลัพธ์อย่างไรจึงสำคัญมากในการชี้นำโมเดลกระจาย

การปรับแต่งการสร้างภาพ:

  • ตัวเพิ่มคุณภาพ: ใส่คำเช่น “4k,” “สวยมาก,” หรือ “กำลังฮิตใน ArtStation” เพื่อเพิ่มคุณภาพภาพโดยไม่เปลี่ยนสไตล์มาก เพราะคำเหล่านี้สัมพันธ์กับภาพคุณภาพสูงในข้อมูลฝึก
  • คำสั่งลบ (Negative Prompts): ใช้ --no (Midjourney) หรือกล่องคำสั่งลบ (Stable Diffusion) เพื่อระบุสิ่งที่ไม่ต้องการ เช่น “กรอบ,” “ผนัง,” “การ์ตูน” ช่วยแยกแนวคิดที่ปะปนกันในข้อมูลฝึก
  • คำถ่วงน้ำหนัก: ปรับอิทธิพลของคำหรือแนวคิดในคำสั่ง (เช่น :: ใน Midjourney, () ใน Stable Diffusion) เพื่อควบคุมองค์ประกอบและการผสมสไตล์อย่างละเอียด
  • การใช้ภาพนำคำสั่ง (Img2Img): ใส่ภาพต้นแบบพร้อมข้อความ (เช่น ลิงก์ภาพ Midjourney, แท็บ Img2Img ของ Stable Diffusion) เพื่อชี้นำสไตล์ ฉาก หรือองค์ประกอบ เป็นตัวอย่างภาพที่ทรงพลัง

อัปเดตล่าสุด:

Report Issue

สรุปรีวิว

3.62 จาก 5
เฉลี่ยจาก 134 คะแนนจาก Goodreads และ Amazon.

หนังสือเล่มนี้มีชื่อว่า Prompt Engineering for Generative AI ได้รับความคิดเห็นที่หลากหลายจากผู้อ่าน หลายคนชื่นชมที่หนังสือเล่มนี้ครอบคลุมแนวคิดพื้นฐานและให้คำแนะนำที่ใช้งานได้จริงในการสร้างคำสั่ง (prompt) ที่มีประสิทธิภาพ อย่างไรก็ตาม มีเสียงวิจารณ์ว่าหนังสือเน้นตัวอย่างโค้ดมากเกินไป ซึ่งอาจล้าสมัยได้อย่างรวดเร็ว บางคนรู้สึกว่าหนังสือมีความซ้ำซากและขาดการเจาะลึกในหลักการของการออกแบบคำสั่ง แม้จะได้รับคำชมในเรื่องความเข้าใจง่ายและการอธิบายที่ชัดเจน แต่ก็มีข้อสงสัยเกี่ยวกับความสมดุลระหว่างการเข้าใจแนวคิดและการนำไปใช้ทางเทคนิค โดยรวมแล้ว หนังสือเล่มนี้ถือเป็นแหล่งข้อมูลที่มีประโยชน์สำหรับโปรแกรมเมอร์ที่ต้องการพัฒนาทักษะด้านปัญญาประดิษฐ์เชิงสร้างสรรค์ แม้จะมีข้อจำกัดบางประการก็ตาม

Your rating:
4.24
476 คะแนน
Want to read the full book?

คำถามที่พบบ่อย

What is Prompt Engineering for Generative AI: Future-Proof Inputs for Reliable AI Outputs by James Phoenix about?

  • Comprehensive guide to prompting: The book provides an in-depth exploration of prompt engineering for generative AI models, including both text and image generation.
  • Five core principles: It introduces five foundational, model-agnostic principles for crafting effective prompts, ensuring skills remain relevant as AI evolves.
  • Practical focus: Readers learn actionable techniques for improving AI output reliability, accuracy, and creativity, with real-world coding examples.
  • Covers broad AI landscape: The book addresses large language models (LLMs), vector databases, autonomous agents, and diffusion models, offering a holistic view of generative AI workflows.

Why should I read Prompt Engineering for Generative AI by James Phoenix?

  • Future-proof your AI skills: The book equips readers with enduring, transferable skills for working with current and future AI models.
  • Improve AI output quality: It teaches how to design prompts that reduce hallucinations, increase reliability, and optimize token usage.
  • Industry relevance: Endorsed by AI leaders, the book is positioned as essential reading for anyone aiming to work effectively with AI in production.
  • Hands-on learning: Includes practical code snippets and workflow examples, making it suitable for both beginners and experienced practitioners.

What are the five core principles of prompt engineering in Prompt Engineering for Generative AI?

  • Give Direction: Clearly specify the desired style, persona, or task to guide the AI’s reasoning and output.
  • Specify Format: Define the expected output format (e.g., JSON, lists, markdown) to ensure structured, machine-readable responses.
  • Provide Examples: Use few-shot or one-shot examples to demonstrate ideal outputs, improving consistency and reducing ambiguity.
  • Evaluate Quality: Systematically test and refine prompts using metrics or human feedback to optimize performance.
  • Divide Labor: Break complex tasks into smaller subtasks or chains for better control, debugging, and output quality.

How does Prompt Engineering for Generative AI explain working with Large Language Models (LLMs) for text generation?

  • LLM foundations: The book covers tokenization, vector representations, and transformer architecture, providing an intuitive understanding of how LLMs like GPT-4 generate text.
  • Probabilistic outputs: It explains the non-deterministic nature of LLMs and why prompt design is crucial for reliable results.
  • Model comparisons: Readers learn about major LLMs (OpenAI’s GPT, Google’s Gemini, Meta’s Llama, Anthropic’s Claude), their strengths, and context window limitations.
  • Practical techniques: The book demonstrates methods for generating structured outputs, simplifying text, translation, and sentiment analysis.

What are the best practices for text generation with ChatGPT and other LLMs in Prompt Engineering for Generative AI?

  • Structured output generation: Techniques for producing bullet lists, hierarchical outlines, and machine-readable formats like JSON/YAML are explained with code examples.
  • Simplification and translation: The book shows how to prompt LLMs to explain complex topics simply or translate between languages and code.
  • Classification and sentiment analysis: It covers prompt engineering for zero-shot and few-shot classification, including handling mixed sentiments.
  • Evaluation and iteration: Readers learn to systematically test and refine prompts for improved accuracy and reliability.

How does Prompt Engineering for Generative AI address handling large documents and LLM context window limitations?

  • Chunking strategies: The book details methods for splitting text by sentence, paragraph, topic, or token count to fit within LLM context windows.
  • Sliding window technique: Overlapping chunks are recommended to preserve semantic context and minimize information loss.
  • Recursive splitting: Recursive character splitting by multiple delimiters helps maintain structure and meaning in manageable chunks.
  • Improved processing efficiency: These strategies enable effective processing of long documents without exceeding model limits.

How does Prompt Engineering for Generative AI explain the use of vector databases like FAISS and Pinecone?

  • Embeddings and similarity search: The book introduces embeddings as high-dimensional vectors for semantic search, enabling retrieval beyond keyword matching.
  • Document chunking for retrieval: It emphasizes chunking large documents into meaningful pieces to improve retrieval accuracy and reduce token usage.
  • Retrieval-Augmented Generation (RAG): Readers learn how to inject relevant document chunks into prompts, reducing hallucinations and improving answer relevance.
  • Practical tools: The book covers using FAISS (local) and Pinecone (hosted) for storing and querying embeddings.

What are autonomous agents and how does Prompt Engineering for Generative AI cover them?

  • Agent architecture: Agents are described as systems that perceive inputs, have goals, and act in loops to solve complex tasks.
  • ReAct framework: The book explains the Reason and Act (ReAct) method, where LLMs iteratively reason, observe, and act using tools.
  • Memory integration: It covers both short-term and long-term memory for maintaining context and storing knowledge.
  • Tool usage: Readers learn to extend agent capabilities with custom functions and prebuilt toolkits.

How does Prompt Engineering for Generative AI approach image generation with diffusion models like Stable Diffusion and Midjourney?

  • Diffusion model fundamentals: The book explains how these models generate images by denoising random noise conditioned on text prompts.
  • Model comparisons: It compares DALL-E, Midjourney, and Stable Diffusion, highlighting their unique features and community aspects.
  • Prompt engineering for images: Techniques include using format and style modifiers, negative prompts, and weighted terms to control output.
  • Advanced image techniques: Inpainting, outpainting, and conditioning on input images are covered for greater creative control.

What advanced techniques for Stable Diffusion and image generation does Prompt Engineering for Generative AI teach?

  • Model customization: Instructions for running Stable Diffusion locally or via API, including setting seeds and guidance scales for quality control.
  • ControlNet and SAM: The book introduces ControlNet for conditioning on input images and Segment Anything Model (SAM) for automatic segmentation.
  • DreamBooth fine-tuning: Readers learn to fine-tune models on custom subjects for personalized image generation.
  • AUTOMATIC1111 Web UI: A feature-rich interface is recommended for managing models, prompts, and advanced image generation workflows.

How does Prompt Engineering for Generative AI guide building AI-powered applications, such as blog post generators?

  • End-to-end workflow: The book walks through topic research, outline generation, text creation, and title optimization for unique, SEO-friendly blog posts.
  • LangChain integration: Readers learn to chain LLM calls, manage memory, and retrieve relevant information from vector databases.
  • AI-generated images: It demonstrates automating illustration creation using meta-prompting and Stable Diffusion.
  • User interface prototyping: Gradio is suggested for rapid frontend development and user feedback collection.

What are the best quotes from Prompt Engineering for Generative AI by James Phoenix and what do they mean?

  • On prompt evaluation: “Without testing the writing style, it would be hard to guess which prompting strategy would win.” — Emphasizes the need for systematic prompt testing and iteration.
  • On embedding quality: “The accuracy of the vectors is wholly reliant on the accuracy of the model you use to generate the embeddings.” — Highlights the importance of choosing the right embedding model for reliable AI retrieval.
  • On unique context: “Giving an LLM unique answers provides unique context, and this allows an LLM to generate richer, more nuanced responses.” — Stresses the value of personalized input for high-quality AI outputs.
  • On prompt editing: “Prompt editing is an advanced technique that gets deep into the actual workings of the diffusion model.” — Reflects the creative potential and complexity of advanced prompt manipulation.

เกี่ยวกับผู้เขียน

เจมส์ ฟีนิกซ์ คือผู้เขียนหนังสือเรื่อง Prompt Engineering for Generative AI แม้ว่าข้อมูลเกี่ยวกับผู้เขียนจะมีจำกัดในเนื้อหาที่ให้มา แต่สามารถสันนิษฐานได้ว่า ฟีนิกซ์มีความเชี่ยวชาญในด้านปัญญาประดิษฐ์และการออกแบบคำสั่งสำหรับ AI สร้างสรรค์ หนังสือเล่มนี้ครอบคลุมหลายแง่มุมของ AI สร้างสรรค์ ทั้งการสร้างข้อความและภาพ รวมถึงเครื่องมือต่าง ๆ เช่น LangChain และ Stable Diffusion สไตล์การเขียนของฟีนิกซ์ถูกยกย่องว่าชัดเจนและเข้าใจง่าย แม้บางส่วนของหนังสืออาจถูกเขียนโดยได้รับความช่วยเหลือจาก AI ผู้เขียนผสมผสานพื้นฐานทางทฤษฎีกับตัวอย่างโค้ดที่ใช้งานได้จริง แต่จุดสมดุลระหว่างสองส่วนนี้ยังเป็นเรื่องที่ผู้อ่านบางกลุ่มมีความเห็นแตกต่างกัน

Follow
ฟัง
Now playing
วิศวกรรมพรอมต์สำหรับ AI เชิงสร้างสรรค์
0:00
-0:00
Now playing
วิศวกรรมพรอมต์สำหรับ AI เชิงสร้างสรรค์
0:00
-0:00
1x
Queue
Home
Swipe
Library
Get App
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
❤️ Unlimited Bookmarks
Free users are limited to 4
📜 Unlimited History
Free users are limited to 4
📥 Unlimited Downloads
Free users are limited to 1
Risk-Free Timeline
วันนี้: เข้าใช้งานได้ทันที
ฟังสรุปฉบับเต็มของหนังสือกว่า 26,000 เล่ม รวมกว่า 12,000 ชั่วโมงของเสียง!
วันที่ 2: แจ้งเตือนช่วงทดลองใช้
เราจะส่งการแจ้งเตือนว่าช่วงทดลองใช้ของคุณใกล้สิ้นสุดแล้ว
วันที่ 3: เริ่มต้นการสมัครสมาชิก
คุณจะถูกเรียกเก็บเงินในวันที่ Jun 16,
ยกเลิกได้ตลอดก่อนวันดังกล่าว
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
600,000+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Unlock a world of fiction & nonfiction books
26,000+ books for the price of 2 books
Read any book in 10 minutes
Discover new books like Tinder
Request any book if it's not summarized
Read more books than anyone you know
#1 app for book lovers
Lifelike & immersive summaries
30-day money-back guarantee
Download summaries in EPUBs or PDFs
Cancel anytime in a few clicks
Scanner
Find a barcode to scan

We have a special gift for you
Open
38% OFF
DISCOUNT FOR YOU
$79.99
$49.99/year
only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...
We have a special gift for you
Open
38% OFF
DISCOUNT FOR YOU
$79.99
$49.99/year
only $4.16 per month
Continue
2 taps to start, super easy to cancel