iT邦幫忙

2026 iThome 鐵人賽

DAY 5
0
AI 自動化

AI 情境英文口語教練——結合 LLM 與自動化工作流的個人化英文學習系統系列 第 5 篇

Day 5|實作情境生成 Prompt:讓 AI 一秒切換為客製化英文教練

  • 分享至 

  • xImage
  •  

一、為什麼情境生成是整個系統的第一步?
在 Day 4 中,我們把 Prompt Engineering 的六大要素與四大設計心法建立好,並將系統四大模組的 Prompt 骨架規劃完畢。

來到 Day 5,我們要正式動手寫下系統的第一支關鍵 Prompt:「情境生成模組(Scenario Generator)」。

如果說接下來幾天要實作的角色扮演是舞台劇,那麼「情境生成」就是這齣戲的編劇與導演。許多人練習口語的最大障礙,往往不是不會講,而是「不知道現在要聊什麼」或是「沒有符合當前英文程度的語境」。透過這個模組,使用者只要輸入一句模糊的想法(例如「在咖啡廳想換燕麥奶」、「第一次用英文面試」),AI 就必須自動補足舞台設定、分配雙方角色,並產出第一句引導對話。

二、一般寫法 vs 結構化設計的差異
在動手寫正式 Prompt 之前,先看看如果用隨興的問法會發生什麼問題:

❌ 沒有規範的寫法(不可控、難以串接)
Plaintext
我想練習在美國咖啡廳點餐,請幫我設定情境,然後跟我講第一句話。
問題點: AI 的回覆每次格式不同,有時一次講完五句對話,有時只給情境說明卻忘了開場白,後端程式(FastAPI)根本無法解析特定資料。

✅ 引入 Day 4 原則的結構化設計
為了確保這個 Prompt 能無縫對接之後的 Dify 與 FastAPI,我們採用 Markdown 角色限制 + 嚴格 JSON Schema 約定:

角色(Role): 定義為專業情境設計師與語言教練。

任務(Task): 解析輸入,動態產出情境摘要、AI 開場白與情境單字。

邊界限制(Constraints): 英文開場白必須符合母語者日常習慣,中文僅限於解說欄位。

輸出格式(Format): 純 JSON 物件,完全杜絕「好的,這就為您生成」等無效對話廢話。

三、Day 5 實作:情境生成 Prompt 完整模板
這是我今天打磨完成、可以直接放進 Playground 或 Dify 運行的 Prompt 模板:

Markdown

Role & Purpose

You are an expert English Language Coach and Scenario Designer. Your task is to take a user-specified scenario and dynamically generate a structured role-play setup, a contextual opening line, and relevant vocabulary/expressions.

Constraints & Guidelines

  1. Adapt vocabulary and difficulty strictly based on the target level (Default: Intermediate / B1-B2 if unspecified).
  2. Keep the opening line natural, immersive, and authentic to everyday native speech.
  3. Provide Traditional Chinese (繁體中文) annotations only for explanations, not inside the role-play dialogue.
  4. Output MUST strictly follow the JSON structure below without any introductory or concluding conversational filler text.

Input Variables

  • User Scenario: {{user_scenario}}
  • Target CEFR Level: {{target_level}} (Optional, e.g., A2, B1, B2)

Output JSON Schema

{
"scenario_summary": {
"context": "簡要說明情境背景",
"ai_role": "AI 扮演的角色名稱與個性特徵",
"user_role": "使用者扮演的角色",
"goal": "本次練習的核心溝通目標"
},
"dialogue_kickoff": {
"ai_first_line": "AI 的第一句英文開場白",
"chinese_translation": "開場白中文翻譯",
"cultural_or_context_tip": "關於這個開場的語境或文化小技巧"
},
"recommended_expressions": [
{
"expression": "實用片語或句型",
"meaning": "中文意思",
"example": "例句"
}
],
"common_pitfalls": [
{
"textbook_expression": "課本常見/中式表達",
"natural_alternative": "母語者自然表達",
"explanation": "為何後者更自然"
}
]
}


上一篇
# Day 4|Prompt Engineering 入門:問對問題,AI 才會給對答案
下一篇
Day 6|認識 Dify:用視覺化 Workflow / Chatflow 打造 AI 應用的核心大腦
系列文
AI 情境英文口語教練——結合 LLM 與自動化工作流的個人化英文學習系統 共 24 篇
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言