mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-24 01:02:00 +00:00
评测估算和每题平均花费:有估不出金额的调用时不再写成 0 美元
价格目录里没有助手模型时(真实模型验收的接入就是这样),第一次评测估不出、照实写了;第二次起估算按上一次的每题平均 花费算,而每题平均是「估得出的那部分」除以题数 = 0,开跑对话框写「约 $0」、评测总览写「每题约 $0」,像不花钱。 - eval/stats.summarize:每题平均花费一分都没估出来(有估不出的调用、估得出的部分是 0)时为 None,估出了一部分的照给; - eval/runner.estimate:上一次的调用金额都估不出时照实写估不出(带次数和原因,金额上限只管得住估得出的调用);估出了一部分 的标 at_least、带上另有几次估不出,说明写「实际至少这么多」;老总表里每题平均记成 0、却有估不出的调用的也按估不出算; - 按角色用量里裁判那一份(runner.judge_usage)补上估不出的次数:以前只有金额和次数,裁判模型不在价格目录里时写成 $0; - 评测页:开跑对话框估出一部分时写「至少约 …(每项至少约 …)」,总览的每题平均有估不出的写「每题至少约 …」,一分都没估出来 的不写(金额那一格已是「金额无法估算」)。 providers/usage 的汇总形状不变:cost_usd 是估得出的那部分、unpriced_calls 是估不出的次数,和运行的 usage 是全系统一个口径 (细案 01 做法 3 定的),前端的金额写法(runCostText)一直按这两项一起写「≥」或「金额无法估算」;漏掉的是只读 cost_usd 去算 平均、做估算的这几处。模块说明里把这条写明了。 测试:test_eval_stats.py::test_the_per_case_cost_is_not_zero_when_calls_could_not_be_priced、 test_eval_runner.py::test_the_estimate_says_it_cannot_price_instead_of_zero(全估不出、估出一部分、目录价是 0 的才是真 不花钱)、test_eval_runner.py::test_the_judge_role_keeps_its_unpriced_calls。去掉修复回跑三条都失败。
This commit is contained in:
@@ -356,6 +356,8 @@ export const EVAL_TEXT = {
|
||||
estimateText: (items: number, cases: number, repeats: number, arms: number) =>
|
||||
`${formatNumber(cases)} 道题 × 每题 ${repeats} 次${arms > 1 ? ` × ${arms} 臂` : ''},共 ${formatNumber(items)} 项`,
|
||||
cost: (total: string, per: string) => `约 ${total}(每项约 ${per})`,
|
||||
/** 上一次有估不出金额的调用:估出来的只是下限 */
|
||||
costAtLeast: (total: string, per: string) => `至少约 ${total}(每项至少约 ${per})`,
|
||||
costNone: '估不出花费',
|
||||
budget: '生效的预算',
|
||||
parallel: (n: number) => `同时评 ${n} 题`,
|
||||
@@ -416,6 +418,8 @@ export const EVAL_TEXT = {
|
||||
cost: '花费',
|
||||
costHint: '助手(建图、挑表、复核)+ 写作(答案运行里的模型调用)+ 结论裁判;算期望不调模型',
|
||||
perCase: (v: string) => `每题约 ${v}`,
|
||||
/** 有估不出金额的调用:每题平均只是下限 */
|
||||
perCaseAtLeast: (v: string) => `每题至少约 ${v}`,
|
||||
e1: '逐题的口径命中(E1)',
|
||||
e1Hint: '答案执行的 SQL 和期望的取数被证明等价的比例(口径账本同一个比对函数)',
|
||||
citations: '报告引用率',
|
||||
|
||||
@@ -215,8 +215,7 @@ function Overview({ run }: { run: EvalRun }) {
|
||||
<div className="grid gap-2 sm:grid-cols-2 lg:grid-cols-4">
|
||||
<RateCard title={O.accuracy} hint={O.accuracyHint} rate={s.accuracy} attr="accuracy" />
|
||||
<RateCard title={O.traced} hint={O.tracedHint} rate={s.traced_accuracy} attr="traced" />
|
||||
<StatCard title={O.cost} hint={O.costHint} value={cost} attr="cost"
|
||||
sub={s.per_case_cost_usd != null ? O.perCase(formatCost(s.per_case_cost_usd)) : undefined} />
|
||||
<StatCard title={O.cost} hint={O.costHint} value={cost} attr="cost" sub={perCaseText(s)} />
|
||||
<StatCard title={O.e1} hint={O.e1Hint} value={s.e1?.n ? pct(s.e1.rate) : '—'} sub={rateText(s.e1)} attr="e1" />
|
||||
</div>
|
||||
<Section title={O.verdicts} attr="verdicts">
|
||||
@@ -296,6 +295,17 @@ function Overview({ run }: { run: EvalRun }) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 每题平均花费:有估不出金额的调用时只是下限(写「至少」);一分都没估出来的不写(老总表记成 0 的也一样,金额那一格已经写了
|
||||
* 「金额无法估算」)
|
||||
*/
|
||||
function perCaseText(s: EvalSummary): string | undefined {
|
||||
const per = s.per_case_cost_usd
|
||||
if (per == null) return undefined
|
||||
if (!s.unpriced_calls) return T.overview.perCase(formatCost(per))
|
||||
return per > 0 ? T.overview.perCaseAtLeast(formatCost(per)) : undefined
|
||||
}
|
||||
|
||||
function Section({ title, children, attr }: { title: string; children: ReactNode; attr?: string }) {
|
||||
return (
|
||||
<section className="space-y-1 rounded-lg border bg-panel p-3 text-xs" aria-label={title} data-eval-section={attr}>
|
||||
|
||||
@@ -263,9 +263,8 @@ export function StartDialog({ open, onClose, suite, evaluations, onStarted }: {
|
||||
<>
|
||||
<p data-eval-estimate-items={est.estimate.items}>{T.estimateText(est.estimate.items, est.cases, est.repeats, est.arms.length)}</p>
|
||||
<p data-eval-estimate-cost="">
|
||||
{est.estimate.total_usd != null
|
||||
? T.cost(formatCost(est.estimate.total_usd), formatCost(est.estimate.per_item_usd))
|
||||
: T.costNone}
|
||||
{est.estimate.total_usd == null ? T.costNone
|
||||
: (est.estimate.at_least ? T.costAtLeast : T.cost)(formatCost(est.estimate.total_usd), formatCost(est.estimate.per_item_usd))}
|
||||
<span className="text-faint"> · {est.estimate.note}</span>
|
||||
</p>
|
||||
{est.arms.map((a, i) => (
|
||||
|
||||
@@ -365,7 +365,11 @@ export interface EvalEstimate {
|
||||
arms: { label: string | null; variant: EvalVariant; models: EvalResolvedModels; text: string }[]
|
||||
cases: number
|
||||
repeats: number
|
||||
estimate: { items: number; per_item_usd: number | null; total_usd: number | null; basis: string | null; note: string }
|
||||
/** at_least:上一次另有 unpriced_calls 次调用金额估不出,估算只是下限;total_usd 为空、unpriced_calls 有值:一分都没估出来 */
|
||||
estimate: {
|
||||
items: number; per_item_usd: number | null; total_usd: number | null; basis: string | null; note: string
|
||||
at_least?: boolean; unpriced_calls?: number
|
||||
}
|
||||
budget: EvalBudget
|
||||
parallel: number
|
||||
spend: EvalSpend
|
||||
|
||||
Reference in New Issue
Block a user