CMDCTest.Reasoning.MockProvider (cmdc_test v0.3.1)

Copy Markdown View Source

推理分支测试用 prompt-routed mock provider。

CMDCTest.MockProvider 的队列模型不同,本模块按最后一条 user prompt 匹配 route,适合 ToT / GoT / Self-Consistency / TRM 等并行或递归分支测试。

Summary

Functions

导出 CMDC.Config.provider_fn 兼容闭包。

Types

matcher()

@type matcher() :: String.t() | Regex.t() | :default | (String.t() -> boolean())

response()

@type response() :: String.t() | map() | {:error, term()}

route()

@type route() :: {matcher(), response()}

Functions

to_provider_fn(routes, opts \\ [])

@spec to_provider_fn(
  [route()],
  keyword()
) :: (String.t(), list(), list(), keyword() -> {:ok, map()} | {:error, term()})

导出 CMDC.Config.provider_fn 兼容闭包。

route matcher 可为字符串包含匹配、Regex、:default 或一元函数。响应可为文本、 %{content: ..., usage: ...} map,或 {:error, reason}