進階提示工程:程式輔助

AI-Assisted Coding for Developers

Francesca Donadoni

AI Curriculum Manager, DataCamp

Chain-of-thought(思維鏈)

65.png

AI-Assisted Coding for Developers

Chain-of-thought(思維鏈)

66.png

AI-Assisted Coding for Developers

Chain-of-thought(思維鏈)

$$

第一種思維鏈作法

$$

<Regular Prompt>

  +

  "Let's think step by step"

original_paper.png

AI-Assisted Coding for Developers

Chain-of-thought(思維鏈)

  • 思維鏈會迫使模型顯式計算中間步驟
    • 回答更精確

$$

step_by_step_answer.png

AI-Assisted Coding for Developers

Chain-of-thought(思維鏈)

☺ 一般提示

"Write a Python function that checks if a string is a palindrome"

🤓 思維鏈提示

"Check if a string is a palindrome.

  • Step 1: Normalize the string (lowercase, remove non-alphanumeric characters).
  • Step 2: Reverse the cleaned string.
  • Step 3: Compare the original and reversed versions.

Write a function that implements this logic"

AI-Assisted Coding for Developers

推理型模型

  • 預設執行思維鏈推理
  • 自我驗證中間步驟
  • 反覆修正自身推理

reasoning_models_logos.png

deepseek_prompt.gif

AI-Assisted Coding for Developers

系統角色(System roles)

  • 研究顯示,角色定義能持續提升輸出品質與準確度

system_roles.png

AI-Assisted Coding for Developers

系統角色(System roles)

🎓 程式家教

$$

"You are a friendly programming tutor. Explain each concept in simple terms, using analogies when helpful. Highlight common mistakes to avoid"

🖥 資深軟體工程師

$$

"You are a senior software engineer helping to debug code. First, identify what the code is trying to do. Then, analyze where and why it might be failing"

AI-Assisted Coding for Developers

一起來練習吧!

AI-Assisted Coding for Developers

Preparing Video For Download...