CMDC.Reasoning.Search (cmdc v0.6.1)

Copy Markdown View Source

推理搜索辅助函数。

该模块保持纯函数边界:只负责 thought 评分、beam 选择和剪枝结果计算; 事件广播与子代理调度由 CMDC.Reasoning.Runner / CMDC.Reasoning.Parallel 负责。

Summary

Functions

为 thought 列表补齐 :score:score_detail

对 thought 评分并执行 beam 剪枝。

按分数从高到低保留 beam_width 个 thought,返回 {kept, pruned}

Functions

score(thoughts, opts \\ [])

@spec score(
  [map()],
  keyword()
) :: [map()]

为 thought 列表补齐 :score:score_detail

score_and_prune(thoughts, opts \\ [])

@spec score_and_prune(
  [map()],
  keyword()
) :: %{scored: [map()], kept: [map()], pruned: [map()]}

对 thought 评分并执行 beam 剪枝。

select_beam(thoughts, beam_width)

@spec select_beam([map()], pos_integer()) :: {[map()], [map()]}

按分数从高到低保留 beam_width 个 thought,返回 {kept, pruned}