OpenRouter
Playground นี้เรียกใช้ Jev เวอร์ชันที่กำหนดผ่าน OpenRouter ดูราคาและสถานะล่าสุดได้ที่หน้าโมเดล
- เอนด์พอยต์
- POST https://openrouter.ai/api/alpha/decisions
- model
- typesafe/jev-1.13
- คีย์ API
- ส่งคีย์ API จากเซิร์ฟเวอร์ในรูปแบบ Bearer token
ถามหนึ่งข้อหรือสามข้อที่ต่างกันเกี่ยวกับสถานการณ์เดียวกัน เลือกตัวอย่าง ปรับข้อมูลนำเข้า แล้วดูคำตอบแบบมีโครงสร้างของแต่ละข้อ
ลองดูรูปแบบคำตอบทีละแบบ การกดรันแต่ละครั้งใช้สิทธิ์ประจำวัน 1 ครั้ง
เมื่อรันตัวอย่าง คุณจะได้คำตอบแบบมีโครงสร้างสำหรับแต่ละข้อ: Choice เลือกตัวเลือก Score ให้ค่าบนมาตราส่วน และ Probability ให้ค่าระหว่าง 0 ถึง 1
แบบฟอร์มนี้ส่งข้อความเป็น state.input พร้อมคำถามที่ตั้งชื่อไว้ 1 หรือ 3 ข้อ ผลลัพธ์แต่ละข้ออยู่ใน answers.<question_id>
คำขอกำหนดรูปแบบคำถามและคำตอบ การตอบกลับจะส่งกลับผลลัพธ์สำหรับแต่ละรายการ นี่คือช่อง JSON ที่ใช้ในตัวอย่าง
modelstatequestions<question_id>typeinstructionscriteriaanswerschoiceprobabilitiesconfidencescorelegendnoulใช้บริบทเดียวกันกับคำถามอิสระ 3 ข้อ ได้แก่ Choice, Score และ Probability การกดรันแต่ละครั้งใช้สิทธิ์ประจำวัน 1 ครั้ง คำตอบที่มีรูปแบบถูกต้องยังอาจผิดได้ ควรทดสอบกับกรณีที่เป็นตัวแทนของงานและกำหนดเกณฑ์การจัดเส้นทางให้เหมาะกับเวิร์กโฟลว์ของคุณ
Playground นี้เรียกใช้ Jev เวอร์ชันที่กำหนดผ่าน OpenRouter ดูราคาและสถานะล่าสุดได้ที่หน้าโมเดล
TypeSafe มีจุดเชื่อมต่อและคีย์ API ของตนเอง คู่มือเริ่มต้นอย่างเป็นทางการใช้ jev-latest และแสดงวิธีส่งหลายคำถามในคำขอเดียว
Output tokens are free.
Eligible accounts may receive promotional credits. TypeSafe does not publish a fixed amount on its public pages; check the console for your balance and terms.
Harness ควบคุมลำดับการเรียกโมเดลและเครื่องมือ เมื่อถึงจุดที่ต้องตัดสินใจ Jev จะอ่านข้อความ คำสั่งเรียกเครื่องมือที่กำลังจะทำ หรือสถานะเอเจนต์ แล้วส่งคำตอบแบบมีชนิดข้อมูลกลับมา โค้ดของคุณเป็นผู้กำหนดขั้นตอนถัดไป ส่วนงานปลายเปิดยังให้โมเดลแชตจัดการ
ModelRouterMiddlewarebefore_agent → wrap_model_callจำแนกข้อความล่าสุดของผู้ใช้ก่อนเริ่มงานเพื่อเลือกโมเดล และใช้โมเดลนั้นตลอดการทำงาน ผลการเลือก ความน่าจะเป็น และค่าความมั่นใจยังดูได้จากสถานะเอเจนต์
AutoModeMiddlewarewrap_tool_callตรวจคำสั่งเรียกเครื่องมือที่ระบุก่อนลงมือทำ หาก Jev พบความเสี่ยงหรือสิทธิ์ไม่เพียงพอ middleware จะบล็อกคำสั่งและส่ง ToolMessage ที่เป็นข้อผิดพลาดกลับมา โดยไม่ได้ขออนุมัติจากคน
TypeSafeClassifierChoice · Score · Noulเพิ่มจุดตรวจของคุณเองได้ด้วย middleware แบบกำหนดเอง: ส่งข้อความหรือสถานะเอเจนต์ให้ TypeSafeClassifier แล้วใช้ผล Choice, Score หรือ Noul เพื่อแยกทางในโค้ดหรือส่งกรณีไม่แน่ชัดให้คนตรวจ
# pip install "langchain-typesafe[experimental]" langchain-openai
# Set TYPESAFE_API_KEY and OPENAI_API_KEY on your server.
from langchain.agents import create_agent
from langchain_typesafe.experimental.middleware import (
ModelChoice, ModelRouterMiddleware,
)
router = ModelRouterMiddleware(
choices={
"fast": ModelChoice(
model="openai:gpt-5.6-terra",
criteria="Simple lookups and extraction.",
),
"powerful": ModelChoice(
model="openai:gpt-6-astra",
criteria="Complex reasoning and high-stakes decisions.",
),
},
instructions="Choose the least costly model that can do the task safely.",
)
agent = create_agent("openai:gpt-5.6-terra", middleware=[router])
result = agent.invoke({"messages": [{"role": "user", "content": "Summarize this log."}]})
print(result["model_route"].choice)// Run on your server. Keep the API key out of browser code.
const apiKey = process.env.OPENROUTER_API_KEY;
if (!apiKey) throw new Error("Set OPENROUTER_API_KEY");
const response = await fetch("https://openrouter.ai/api/alpha/decisions", {
method: "POST",
headers: {
Authorization: "Bearer " + apiKey,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "typesafe/jev-1.13",
state: {input: "A customer reports a duplicate charge."},
questions: {
team: {
type: "choice",
instructions: "Which team should handle this?",
criteria: {
billing: "Payments and refunds",
technical: "Bugs and integrations"
}
},
urgency: {
type: "score",
instructions: "How urgent is the issue?",
criteria: ["Can wait", "Needs attention today", "Immediate action"]
},
escalate: {
type: "noul",
instructions: "Should a human review this first?",
criteria: {false: "No review needed", true: "Review before acting"}
}
}
})
});
if (!response.ok) throw new Error("Decision request failed");
const {answers} = await response.json();
console.log(answers.team.choice, answers.urgency.score, answers.escalate.noul);เลือกชนิดคำตอบที่โค้ดของคุณต้องใช้ หากส่งหลายคำถาม แต่ละ ID จะได้รับผลลัพธ์แยกกัน
TypeSafe: Choice · Score · Noul ↗คีย์ตัวเลือกที่ choice เลือก ซึ่งเป็นตัวเลือกที่มีค่าความน่าจะเป็นสูงสุด
ตำแหน่งบนระดับคะแนนที่ถ่วงน้ำหนักตามความน่าจะเป็น ซึ่งอาจอยู่ระหว่างสองระดับ
ตัวเลขตั้งแต่ 0 (ไม่) ถึง 1 (ใช่) สำหรับคำถามใช่/ไม่ใช่
ก่อนใช้ในระบบจริง ควรทดสอบกับเคสฝ่ายสนับสนุนที่เป็นตัวแทนของงาน บันทึกเวอร์ชันโมเดล และส่งเคสที่ไม่แน่นอนหรือมีผลกระทบสูงให้เจ้าหน้าที่ตรวจสอบ ค่า 0.8 เป็นเพียงตัวอย่าง
ติดตามโปรเจกต์ใหม่ โมเดล System One จากชุมชน และกรณีใช้งานจริง ผ่านคลังข้อมูลสาธารณะที่อัปเดตสม่ำเสมอหรืออีเมลคัดสรรที่ส่งเป็นครั้งคราว