ในบทความนี้
In this post
ตอนที่ 1 จากสิบตอน: ตั้งแล็บ Node ที่รันออฟไลน์ได้ แยก Codex ผู้ช่วยพัฒนาออกจาก Jev ตัวตัดสินใจ และวางสัญญาการทดลองก่อนอ้างเรื่องความเร็วหรือต้นทุน
ฉบับร่างสำหรับตรวจในเครื่อง • โค้ดเริ่มต้นใช้ offline fixtures เท่านั้น ตัวเลขเป็นสถานการณ์สมมติ ไม่ใช่ผลวัด Jev จริง และยังไม่มีการพิสูจน์ว่าระบบเร็วขึ้นหรือประหยัดลง
เป้าหมายและสิ่งที่ต้องพร้อม
git clone https://github.com/Anirach/ai-core-jev-tutorial.git
cd ai-core-jev-tutorial
node src/cli.mjs doctor
แนะนำให้เริ่มจาก companion repo และคู่มือ README บน GitHub ด้านล่าง ส่วน ZIP ของเว็บไซต์เป็นสำเนาออฟไลน์อีกทางหนึ่ง คำสั่ง Node ใช้เหมือนกันเมื่อรันจากรากโครงการ GitHub repository · README / Quickstart
ใช้โครงการ Support Ticket Decision Lab เดิมตลอดสิบตอน เตรียม Node 22.18 ขึ้นไป terminal และโฟลเดอร์ที่เขียนไฟล์ได้ รันคำสั่งจากราก repo ai-core-jev-tutorial หรือจากไดเรกทอรี ai-core-jev-lab หากใช้ ZIP ของเว็บไซต์ ไม่ต้อง npm install สำหรับออฟไลน์ เผื่อเวลาลงมือและทดลองเปลี่ยนโค้ดประมาณ 20–40 นาที โดยเวลาที่แสดงบนหัวบทความเป็นเวลาอ่านเนื้อหา ไม่รวมเวลาลองทำ
ดาวน์โหลดโครงการพร้อมโค้ดและ tests (ZIP) · อ่านคู่มือโครงการ
ตอนนี้เน้นไฟล์ src/questions.mjs และใช้ผลจาก fixture เพื่อทดสอบการประกอบระบบเท่านั้น ยังไม่ได้ติดตั้ง SDK หรือใช้ key ในการจัดทำบทเรียน เส้นทาง live ที่แยกไว้ในตอนท้ายยังไม่ได้ทดสอบผ่าน API จริง
ทำความเข้าใจขอบเขตนี้
เริ่มจากแล็บวิศวกรรม ไม่ใช่ข้อสรุปว่าเปลี่ยนไปใช้โมเดลราคาถูกแล้วระบบจะดีขึ้นเสมอ เราจะสร้างโต๊ะทำงานสำหรับคัดแยก support ticket หนึ่งระบบ ให้โค้ดรับผิดชอบ schema สิทธิ์ การประเมินผล และผลกระทบจริง Codex ช่วยเขียนโค้ดได้ ส่วน Jev เป็นองค์ประกอบตัดสินใจตอน runtime ตัวอย่างนี้สร้างได้เพียงข้อเสนอ ไม่คืนเงิน ไม่ส่งข้อความหาลูกค้า และไม่แก้ระบบ help desk ภายนอก
ซีรีส์ Engineering AI-Core Systems เดิมให้หลักคิดเรื่อง assurance เรานำหลักนั้นมาใช้ แต่ไม่ได้แปลว่า endpoint จำแนกทุกตัวกลายเป็นระบบ AI-core ที่ทำงานอัตโนมัติ ตัวอย่างนี้จำกัดการกระทำด้วยการอนุมัติของมนุษย์ เมื่อพัฒนาเป็นระบบจริงจึงค่อยใช้สองแกนจากซีรีส์เดิมวิเคราะห์อำนาจตัดสินใจและความขาดไม่ได้ของโมเดล ไม่เรียกตัวอย่างสอนว่าเก่งหรืออิสระเกินพฤติกรรมที่มันทำได้
ดาวน์โหลด reference implementation ฉบับสมบูรณ์ครั้งเดียว แล้วใช้โฟลเดอร์เดิมตลอดสิบตอน มีโค้ดคำตอบครบตั้งแต่ต้นเพื่อให้เปิดทบทวนแต่ละตอนได้เอง งานของผู้อ่านคือไล่เส้นทาง แก้ทีละขอบเขต แล้วทดสอบผล fixture แบบออฟไลน์เป็นคำตอบที่ผู้เขียนกำหนดไว้ ไม่ใช่ผลเรียก Jev จริง เส้นทางเริ่มต้นไม่ต้องติดตั้ง SDK ไม่ต้องมีบัญชี API และไม่มีค่าเรียกโมเดล
ลงมือทีละเจ็ดขั้น
ขั้นที่ 1
เตรียมโครงการ clone companion repository แล้วเข้าไดเรกทอรี ai-core-jev-tutorial หรือดาวน์โหลด ZIP ของเว็บไซต์แล้วเข้าไดเรกทอรี ai-core-jev-lab ให้รันคำสั่งจากตรงนี้ ไม่ใช่จากโฟลเดอร์ blog ของเว็บไซต์ คำสั่งตัวอย่างใช้ terminal บน macOS/Linux หรือ shell ที่เข้ากันได้ ผู้ใช้ Windows เลือก terminal ที่เหมาะสมได้โดยไม่ต้องเปลี่ยนโมดูล JavaScript
ขั้นที่ 2
ตรวจ runtime คำสั่ง doctor ปฏิเสธ Node ที่ต่ำกว่า 22.18 ตรวจรหัสและข้อความของ ticket ทั้งหมด แล้วแสดงว่าเริ่มต้นด้วย MOCK การตรวจผ่านหมายถึงสภาพแวดล้อมรันแบบฝึกได้เท่านั้น ยังไม่ได้ยืนยันคุณภาพโมเดลหรือสิทธิ์เข้าถึง API ของบัญชีใด
ขั้นที่ 3
ทำแผนที่ไฟล์ data/tickets.json เก็บข้อมูลสมมติและป้ายเฉลยสำหรับประเมิน providers.mjs รับเพียงฟิลด์ input ที่ตรวจแล้ว ส่วนเฉลยอยู่กับ evaluator config/policy.json กำหนดการงดตัดสิน และ prices.example.json แสดงสมมติฐานต้นทุนให้เห็นชัด การแยกหน้าที่ช่วยไม่ให้เฉลยหรือราคาหลุดเข้า context ของโมเดลโดยไม่รู้ตัว
ขั้นที่ 4
ตรวจ request ก่อนรัน คำสั่ง request แสดง model ID ที่ตรึงไว้ ข้อความ ticket หนึ่งรายการ และคำถามสองข้อ โดยไม่เรียก inference ตรวจว่าไม่มี goldRoute, goldHuman หรือราคาภายใน การเปิดดูจุดเล็กนี้มีประโยชน์กว่าการเชื่อว่า object ที่มีชนิดข้อมูลดีแล้วจะไม่ทำเฉลยรั่ว
ขั้นที่ 5
รัน T-001 ด้วย baseline อ่านป้าย evidence ก่อน ผลนี้เป็น fixture จำลองคำตอบจากเส้นทาง generative ค่า billing เป็นข้อเสนอ ยังไม่ใช่การกระทำที่เสร็จแล้ว เก็บ trace นี้เป็นจุดอ้างอิงก่อนเพิ่มแขนง Jev เพื่อให้การเปลี่ยนแปลงภายหลังมีของจริงในแล็บให้เทียบ
ขั้นที่ 6
รัน ticket เดิมด้วย hybrid สำหรับ fixture นี้ คำตอบรูปแบบ Jev กระจุกตัวพอที่จะผ่านนโยบายตัวอย่าง จึงไม่เรียก baseline ซ้ำ ให้อ่าน attempts แทนการเดาจาก route สุดท้าย เพราะระบบสองแบบอาจตอบตรงกันแต่ใช้จำนวนการเรียกต่างกัน
ขั้นที่ 7
รันทดสอบก่อนแก้โค้ด ชุดทดสอบครอบคลุมค่าผิดรูป เส้นทางปฏิเสธ usage ที่ไม่ทราบ การรั่วของเฉลย และขอบเขตอนุมัติ ทดลองเปลี่ยนค่าผิดหนึ่งจุดในสำเนาที่ทิ้งได้ ดูให้เกิด test ล้ม แล้วคืนค่า ชุดทดสอบสีเขียวเป็นหลักฐานตั้งต้น ไม่ใช่หลักฐานว่าโมเดลจริงตอบถูก
ไฟล์และคำสั่งที่ใช้
โค้ดประกอบบน GitHub: ai-core-jev-tutorial · README. ใช้ repo เป็นทางหลักในการทำแบบฝึก ไฟล์ต่อไปนี้ตรึงกับรุ่นที่ทดสอบแล้ว src/questions.mjs · src/cli.mjs
เปิดไฟล์นี้เทียบกับ source ใน ZIP ก่อนแก้ ข้อความต่อไปนี้คือโค้ดที่ใช้ในโครงการจริง ไม่ใช่ pseudocode ผลโมเดลเป็น input ให้โค้ดตรวจและวางเส้นทางต่อ ไม่ใช่สิทธิ์ให้ข้ามด่านอนุมัติ
export const ROUTES = Object.freeze({billing:'Invoices, payments, or subscription charges',technical:'Software defects or integration failures',other:'Neither billing nor technical'});
export const ROUTE_QUESTION='Which support team best fits this ticket?';
export const HUMAN_QUESTION='Does the customer explicitly request a human agent?';
export function requestShape(ticket) {
return {model:'jev-1.13.0',state:{ticket:ticket.text},questions:{route:{type:'choice',instructions:ROUTE_QUESTION,criteria:{...ROUTES}},wantsHuman:{type:'noul',instructions:HUMAN_QUESTION}}};
}
คำสั่งออฟไลน์ต่อไปนี้รันได้โดยไม่ใช้ SDK หรือ API key:
node src/cli.mjs doctor
node src/cli.mjs request --ticket T-001
node src/cli.mjs demo --mode baseline
node src/cli.mjs demo --mode hybrid
node --test --test-reporter=spec
ตรวจผลที่ควรได้
doctor ควรแสดง 40 tickets, MOCK และ paidCalls เป็นศูนย์ การสาธิต T-001 ทั้งสองแบบเสนอ billing แต่ hybrid ใช้ provider รูปแบบ Jev อย่าเทียบ scenario latency กับเวลา CPU ของเครื่อง เพราะอย่างแรกเป็นข้อมูลสมมติ ส่วนอย่างหลังเป็นเวลาที่ตัว harness ทำงานจริง
ตรวจชื่อ test และเส้นทางปฏิเสธด้วย อย่าดูเพียง exit code หรือ label สุดท้าย ข้อมูลที่ไม่ทราบต้องยังระบุว่าไม่ทราบ และรายงานทุกชิ้นต้องแยกผลจำลองออกจากข้อมูลที่วัดจริง
แก้ปัญหาเมื่อผลไม่ตรง
ถ้า Node หา src/cli.mjs ไม่เจอ ให้ตรวจไดเรกทอรีก่อนติดตั้งอะไรเพิ่ม ถ้าโหมดออฟไลน์แจ้งว่าไม่มี SDK ให้ไล่ import ซึ่งควรเกิดแบบ dynamic ใน liveJev เท่านั้น ถ้าจำนวน test เปลี่ยนหลังทำแบบฝึก ให้อ่านชื่อ test ที่ล้ม ไม่ยึดจำนวนรวมเป็นเกณฑ์
หากเปิดบทเรียนผ่าน Python http.server ให้ใช้ลิงก์ .html ที่ท้ายตอนเมื่อจำเป็น ลิงก์ chip แบบไม่มีนามสกุลในแถบซีรีส์อาศัยการ resolve ของ GitHub Pages และเป็นข้อจำกัด preview ที่มีอยู่เดิม ไม่ใช่ปัญหาในโค้ด Node
เปลี่ยนหนึ่งอย่างแล้วทดสอบ
เพิ่ม ticket สมมติหนึ่งรายการในสำเนาทดลอง ใช้ ID ใหม่ที่ถูกกติกา แล้วสังเกตว่า fixture provider ปฏิเสธ ID ที่ไม่มีคำทำนาย เพิ่มคำตอบสมมติอย่างชัดเจน ไม่แก้ให้ provider อ่านเฉลย นี่คือการขยายการเดินสายข้อมูล ไม่ใช่ทำให้โมเดลฉลาดขึ้น
ทำการแก้ไขในสำเนาทดลอง เก็บไฟล์ต้นฉบับไว้เทียบ แล้วคืนค่าก่อนเริ่มตอนถัดไป หากทดลองกับ provider จริงภายหลัง ให้สร้าง experiment record ใหม่แทนเขียนทับผลเดิม
จุดตรวจถัดไป
ก่อนขยับต่อ ให้บอกได้ว่าไฟล์ใดเป็น contract ไฟล์ใดเป็น policy หลักฐานใดได้จากการรัน และข้อใดยังไม่ได้ทดสอบกับโมเดลจริง การแยกสี่อย่างนี้เป็นงานวิศวกรรมที่สำคัญกว่าการได้เดโมที่ดูไหลลื่น
แหล่งอ้างอิงและหลักฐาน
เอกสารและ source ที่ใช้
ตรวจเอกสาร Jev วันที่ 23 ตุลาคม 2026 ข้อเท็จจริง API และราคาอาจเปลี่ยน ให้ตรวจใหม่ก่อนใช้ live ส่วนผลของ fixture เป็นข้อมูลสอนที่ระบุไว้ในโครงการ
สรุปที่นำไปใช้ต่อ
- contract จำกัดโครงสร้าง ส่วน evaluation ตรวจพฤติกรรม
- อ่าน coverage คุณภาพ เวลา และต้นทุนรวมควบคู่กัน
- ข้อเสนอไม่ใช่ผลที่อนุมัติแล้ว และหลักฐาน mock ไม่ใช่หลักฐานโมเดล live
Part 1 of ten: Run the offline Node lab, separate Codex authoring from Jev runtime decisions, and define the experiment before claiming speed or savings.
Local review draft • Default code uses offline fixtures. Numbers are fictional scenarios, not measured Jev results. Faster performance and lower cost remain hypotheses.
Outcome and prerequisites
git clone https://github.com/Anirach/ai-core-jev-tutorial.git
cd ai-core-jev-tutorial
node src/cli.mjs doctor
Start with the companion repository and its detailed README. The website ZIP remains an alternative offline snapshot; run the same Node commands from either project root. GitHub repository · README / Quickstart
Use the same Support Ticket Decision Lab throughout the series. Have Node 22.18+, a terminal and a writable directory. Run commands from the cloned ai-core-jev-tutorial root, or the extracted ai-core-jev-lab folder if using the website ZIP. Offline work needs no npm install. Allow roughly 20–40 minutes for experiments; the article reading-time label excludes hands-on work.
Download the complete code and tests (ZIP) · Project README
This chapter focuses on src/questions.mjs. Fixture outputs test the integration mechanics only. The author did not install the SDK or use an API key while preparing the lab. The separately documented live path has not been tested against the API.
How this boundary works
Treat this as an engineering lab, not a promise that a cheaper model makes an application better. We build one support-ticket workbench in which code owns schemas, permissions, evaluation and effects. Codex can help author that code. Jev is a separately called runtime decision component. Our starting application produces proposals; it cannot refund money, contact customers or change an external help desk.
The existing Engineering AI-Core Systems series supplies the assurance principles. Reusing those principles does not make every classification endpoint an autonomous AI-core system. In this lab, human approval bounds the action path. Classify the authority and indispensability of your eventual deployed system using the original series, rather than giving this teaching example a stronger label than its behavior supports.
Download the complete reference implementation once and keep the same folder through all ten parts. The repository already contains the solution so every chapter can be reproduced independently; the learning task is to trace, modify and test one boundary at a time. Offline fixtures are hand-authored responses, not captured Jev inference. No SDK installation, API account or paid call is needed for the default path.
Seven practical steps
Step 1 — Get the project
Get the project. Clone the companion repository and enter ai-core-jev-tutorial, or use the website ZIP and enter ai-core-jev-lab. Run terminal commands there, not inside the website blog directory. The commands below target macOS/Linux or a comparable shell; Windows users can use a suitable terminal without changing the JavaScript modules.
Step 2 — Check the runtime
Check the runtime. doctor rejects Node versions below 22.18, validates all ticket IDs and texts, and reports MOCK as the default. A successful check says the environment can run the exercises; it says nothing about model quality or whether an API account is eligible for access.
Step 3 — Map the files
Map the files. data/tickets.json contains synthetic inputs and evaluation labels. providers.mjs receives only validated input fields; the labels stay in the evaluator. config/policy.json controls abstention, while prices.example.json contains explicit scenario assumptions. Keeping these concerns separate prevents a label or price from silently becoming model context.
Step 4 — Inspect one request before running it
Inspect one request before running it. The request command prints a pinned model ID, one ticket text and two named questions. It performs no inference. Confirm that goldRoute, goldHuman and internal pricing are absent. This small inspection is more useful than assuming a well-typed object cannot leak evaluation answers.
Step 5 — Run T-001 in baseline mode
Run T-001 in baseline mode. Read the evidence label first: this is a simulated generative-response fixture. The returned billing route is a proposal, not a completed action. Keep its trace as a reference before adding the Jev branch, so later changes have something concrete to compare against.
Step 6 — Run the same ticket in hybrid mode
Run the same ticket in hybrid mode. For this fixture, the Jev-shaped response is sufficiently concentrated under our demonstration policy and no baseline fallback is called. Read attempts rather than guessing from the final route; two pipelines can return the same answer while making different numbers of calls.
Step 7 — Run the tests before editing
Run the tests before editing. The tests cover invalid values, refusal paths, unknown usage, label leakage and approval boundaries. Make one deliberately invalid local change only in a disposable copy, observe a failing test, and restore it. A green suite is a starting artifact, not evidence that a live model is correct.
Files and commands
Companion code on GitHub: ai-core-jev-tutorial · README. Use the companion repository as the default working copy. These file links pin the tested revision. src/questions.mjs · src/cli.mjs
Compare this file with the source in the ZIP before editing. The listing is the implementation used by the lab, not pseudocode. Model output is input to validation and routing code; it grants no permission to bypass approval.
export const ROUTES = Object.freeze({billing:'Invoices, payments, or subscription charges',technical:'Software defects or integration failures',other:'Neither billing nor technical'});
export const ROUTE_QUESTION='Which support team best fits this ticket?';
export const HUMAN_QUESTION='Does the customer explicitly request a human agent?';
export function requestShape(ticket) {
return {model:'jev-1.13.0',state:{ticket:ticket.text},questions:{route:{type:'choice',instructions:ROUTE_QUESTION,criteria:{...ROUTES}},wantsHuman:{type:'noul',instructions:HUMAN_QUESTION}}};
}
Run these offline commands without an SDK installation or API key:
node src/cli.mjs doctor
node src/cli.mjs request --ticket T-001
node src/cli.mjs demo --mode baseline
node src/cli.mjs demo --mode hybrid
node --test --test-reporter=spec
Verify the expected behavior
doctor should report 40 tickets, MOCK, and zero paid calls. Both T-001 demonstrations propose billing; only the hybrid fixture uses the Jev-shaped provider. Do not compare the scenario latency values with your CPU wall time: one is fictional input, the other is the local harness runtime.
Read the named tests and refusal paths, not just the exit code or final label. Unknown values must remain unknown, and every report must distinguish simulation inputs from real measurements.
Troubleshooting
If Node cannot find src/cli.mjs, check the current directory before reinstalling anything. If the SDK is missing in offline mode, inspect imports: only liveJev may dynamically import it. If a test count changes after an exercise, read the named failure rather than treating the total as the requirement.
When previewing with Python http.server, use the .html continuation links below when needed. Extensionless series chips rely on GitHub Pages resolution; that documented preview limitation is separate from the Node example.
Change one thing, then test
Add one new synthetic ticket in a disposable copy. Give it a new valid ID and observe that the fixture provider refuses an ID without a prediction. Add its canned prediction explicitly instead of teaching the provider to read gold labels. This extends the dataset plumbing, not model intelligence.
Make changes in a disposable copy, retain the reference files for comparison, and restore them before the next chapter. If you later use a real provider, create a new experiment record rather than overwriting the fixture transcript.
Next checkpoint
Before moving on, identify the contract file, the policy file, what was observed in a run, and what remains untested against a real model. Keeping those four things separate matters more than making the demo look effortless.
References and evidence
Documentation and implementation
Jev documentation checked on 23 October 2026. API and pricing details can change; recheck before live use. Fixture results are explicitly authored teaching data in the project.
Key takeaways
- Contracts bound structure; evaluation checks behavior.
- Coverage, quality, latency and total cost must be read together.
- A proposal is not an approved effect; mock evidence is not live model evidence.