CMDC.Reasoning.Scorer (cmdc v0.6.1)

Copy Markdown View Source

Thought 评分工具。

默认评分是确定性的启发式规则,适合单测、回放和低成本排序。需要 LLM judge 时, 可使用 judge_prompt/2 生成稳定提示词,由调用方自行交给 Provider 执行。

Summary

Functions

生成 LLM judge 提示词。

按启发式分数从高到低排序 thoughts。

对单个 thought 做确定性评分。

Functions

judge_prompt(thought, opts \\ [])

@spec judge_prompt(
  term(),
  keyword()
) :: String.t()

生成 LLM judge 提示词。

该函数只生成 prompt,不调用模型,调用方可自行选择 provider / model / timeout。

rank(thoughts, opts \\ [])

@spec rank(
  [term()],
  keyword()
) :: [%{thought: term(), score: float(), detail: map()}]

按启发式分数从高到低排序 thoughts。

score(thought, opts \\ [])

@spec score(
  term(),
  keyword()
) :: {:ok, map()} | {:error, term()}

对单个 thought 做确定性评分。

返回 {:ok, result},其中 result.score 归一化到 0.0..1.0