ข้ามไปยังเนื้อหาบทเรียน
เมนู
เข้าสู่ระบบ — เร็ว ๆ นี้
สารบัญบทที่ 337/8

พื้นฐานการใช้ AIการเขียน Prompt

สร้าง Evaluation Set ให้ Harness ก่อนขยาย Tool

เรียนรู้ สร้าง Evaluation Set ให้ Harness ก่อนขยาย Tool เพื่อสร้าง AI Harness สำหรับงานในประเทศไทย

เป้าหมาย: ออกแบบ contract, runtime และ evaluation ที่เปลี่ยนโมเดลให้เป็นระบบดูแลได้ · ใช้เวลาประมาณ 18 นาที

Contract → Runtime → Evidence → Improvement

Harness เปลี่ยนโมเดลทั่วไปให้ทำงานเฉพาะอย่างควบคุมได้

Contract

เก็บ representative, edge, adversarial และ regression cases ภาษาไทย พร้อม expected behavior/rubric แยก model quality, retrieval, tool selection, argument, side effect, latency/cost และ human escalation

Runtime

จัด message/context/tool/state/retry/timeout โดยไม่ซ่อน side effect

Evidence

เก็บ trace ที่ลดข้อมูลและ eval แยก failure layer

Improvement

แก้ prompt/retrieval/tool/code ตามสาเหตุและรัน regression ก่อน release

Artifact ของ Harness

evaluation set

ระบุ evaluation set ด้วย owner, version, boundary, observable evidence และ failure handling

ทุก contract ต้องอ่านได้ทั้งคนและระบบและมีวิธีทดสอบ

rubric

ระบุ rubric ด้วย owner, version, boundary, observable evidence และ failure handling

ทุก contract ต้องอ่านได้ทั้งคนและระบบและมีวิธีทดสอบ

tool trace

ระบุ tool trace ด้วย owner, version, boundary, observable evidence และ failure handling

ทุก contract ต้องอ่านได้ทั้งคนและระบบและมีวิธีทดสอบ

regression

ระบุ regression ด้วย owner, version, boundary, observable evidence และ failure handling

ทุก contract ต้องอ่านได้ทั้งคนและระบบและมีวิธีทดสอบ

Harness ที่ดูฉลาดแต่เปราะ

รวม policy, data และ output ใน string เดียว

debug/provenance/cache ยาก

แยก role และ structured contract

stream หรือ tool call แล้วถือว่าสำเร็จ

ข้อมูลอาจไม่ครบหรือ side effect ผิด

validate final state และ business outcome

วัดเฉพาะคำตอบสวย

ไม่เห็น retrieval/tool/cost/safety failure

layered evaluation และ trace

ทำ Harness Specification

agent ผ่าน demo ห้าครั้งแต่ผิดเมื่อรันคำถามลูกค้า 50 แบบ

ระบุ messages, Markdown/schema, context/cache, tool/MCP, skill, state/stream และ evaluation

ดูคำตอบตัวอย่าง

แยก system policy ที่เสถียรจาก user/data dynamic ใช้ Markdown ให้คนอ่านและ JSON Schema สำหรับเครื่อง ระบุ untrusted provenance กับ permission ให้ MCP/tool ใช้ least privilege และ approval ห่อ workflow ซ้ำเป็น Skill ที่มี version/test แยก partial streaming จาก committed result จัด stable prefix เพื่อ cache โดยไม่ใส่ timestamp และสร้าง evaluation set ภาษาไทยวัด answer/retrieval/tool argument/side effect/latency/cost/escalation

  • message/provenance
  • human + machine format
  • tool/permission contract
  • skill/version
  • stream/cache states
  • layered Thai eval
บันทึกช่วยจำ
  • ตรวจ API และ MCP specification ตาม version ที่ใช้จริง
  • trace และ cache ต้องไม่เก็บ secret หรือข้อมูลส่วนบุคคลเกินวัตถุประสงค์

สรุปบทเรียนนี้

  • contracts before orchestration
  • validate committed result
  • evaluate every layer