HITL、HOTL 和 HOOTL 工作流指南
I’m happy to help translate the article, but I need the full text you’d like translated. Could you please paste the content (excluding the source line you already provided) here? Once I have it, I’ll translate it into Simplified Chinese while preserving the original formatting and markdown.
人机协同 (Human-in-the-Loop, HITL)
在 HITL 工作流中,AI 充当一个高级助理,无法在没有人类 检查点 的情况下完成任务。
何时使用
- 高风险的法律或医疗文档。
- 创意写作中“声音”和“细微差别”至关重要。
- 为生产系统生成代码。
示例
# HITL: Human reviews and approves/edits AI output before finalizing.
from google import genai
from dotenv import load_dotenv
load_dotenv(override=True)
client = genai.Client()
MODEL_NAME = "gemini-2.5-flash"
def hitl_press_release(topic):
"""Human‑in‑the‑Loop press‑release generator."""
prompt = f"Write a short press release for: {topic}"
ai_draft = client.models.generate_content(
model=MODEL_NAME,
contents=prompt
).text
print("\n--- [ACTION REQUIRED] REVIEW AI DRAFT ---")
print(ai_draft)
feedback = input("\nWould you like to (1) Accept, (2) Rewrite, or (3) Edit manually? ")
if feedback == "1":
final_output = ai_draft
elif feedback == "2":
critique = input("What should the AI change? ")
return hitl_press_release(f"{topic}. Note: {critique}")
else:
final_output = input("Paste your manually edited version here: ")
print("\n[SUCCESS] Press release finalized and saved.")
return final_output
hitl_press_release("Launch of a new sustainable coffee brand")
Source:
人机协同(HOTL)
在 HOTL 工作流中,AI 能自主且大规模运行,而人类只需监控 仪表盘,仅在 AI 偏离目标时进行干预。
何时使用
- 实时社交媒体内容审核。
- 实时客服聊天机器人。
- 监控工业物联网传感器。
示例
# HOTL: Human monitors AI decisions in real‑time and can veto.
from google import genai
from dotenv import load_dotenv
import time
load_dotenv(override=True)
client = genai.Client()
MODEL_NAME = "gemini-2.5-flash"
def hotl_support_monitor(tickets):
print("System active. Monitoring AI actions... (Press Ctrl+C to PAUSE/VETO)")
for i, ticket in enumerate(tickets):
try:
response = client.models.generate_content(
model=MODEL_NAME,
contents=f"Categorize this ticket (Billing/Tech/Sales): {ticket}"
)
category = response.text.strip()
print(f"[Log {i+1}] Ticket: {ticket[:30]}... -> Action: Tagged as {category}")
time.sleep(2)
except KeyboardInterrupt:
print(f"\n[VETO] Human supervisor has paused the system on ticket: {ticket}")
action = input("Should we (C)ontinue or (S)kip this ticket? ")
if action.lower() == 's':
continue
tickets = ["My bill is too high", "The app keeps crashing", "How do I buy more?"]
hotl_support_monitor(tickets)
Human-out-of-the-Loop (HOOTL)
在 HOOTL 工作流中,AI 从头到尾处理整个过程。人工干预仅在事后发生(例如在审计或每周审查时)。这非常适合高容量、低风险的任务。
何时使用
- 垃圾邮件过滤。
- 翻译海量产品描述数据库。
- 基础数据清洗和格式化。
示例
# HOOTL: AI processes batch independently; human reviews final report.
from google import genai
from dotenv import load_dotenv
load_dotenv(override=True)
client = genai.Client()
MODEL_NAME = "gemini-2.5-flash"
def hootl_batch_processor(data_list):
print(f"Starting HOOTL process: {len(data_list)} items to process.")
final_report = []
for item in data_list:
response = client.models.generate_content(
model=MODEL_NAME,
contents=f"Extract key sentiment (Happy/Sad/Neutral): {item}"
)
final_report.append({"data": item, "sentiment": response.text.strip()})
return final_report
reviews = ["Great food!", "Slow service", "Expensive but worth it"]
report = hootl_batch_processor(reviews)
print("Final Report:", report)
工作流比较
| 工作流 | 交互层级 | 人力投入 | 延迟(速度) | 风险容忍度 |
|---|---|---|---|---|
| HITL | 主动 | 高 | 慢 | 零容忍(高风险) |
| HOTL | 被动 | 中等 | 中等 | 可管理风险(规模 + 安全) |
| HOOTL | 无 | 低 | 非常快 | 低风险(高容量) |