scorerelevanceHow relevant is this passage to the question?
irrelevantweakusefuldirect answer
把 Laya 放在 retrieval 后、generation 前,过滤明显无关的上下文。
Question: What is the refund period? Passage: Annual subscriptions can be refunded within 30 days of the initial purchase.
scorerelevanceHow relevant is this passage to the question?
noulkeepShould this passage be kept for the downstream answer?
from laya import Router
router = Router(preload=True)
state = {"question": "What is the refund period?", "passage": "Annual subscriptions can be refunded within 30 days."}
questions = {
"relevance": {"type": "score", "instructions": "How relevant is this passage?", "criteria": ["irrelevant", "weak", "useful", "direct answer"]},
"keep": {"type": "noul", "instructions": "Should this passage be kept?"}
}
print(router.predict(state, questions))import { Laya } from "@receptron/laya";
const laya = await Laya.load();
const result = await laya.systemOne(
{ question: "What is the refund period?", passage: "Annual subscriptions can be refunded within 30 days." },
{
relevance: { type: "score", instructions: "How relevant is this passage?", criteria: ["irrelevant", "weak", "useful", "direct answer"] },
keep: { type: "noul", instructions: "Should this passage be kept?" },
},
);
console.log(result.answers);
await laya.close();