14 lines
724 B
Go
14 lines
724 B
Go
package intent
|
|
|
|
import "context"
|
|
|
|
// Classifier 是可选的 L2 重打分扩展点,典型由宿主用其 LLM 客户端实现。
|
|
// 只在规则裁决为 Ambiguous 时被调用;实现自担延迟与成本。
|
|
// 返回错误时识别保持 Ambiguous,不会使 Recognize 失败(识别确定性不受实现影响)。
|
|
// 宿主应保证 Refine 幂等且无副作用:同样的输入与候选应得到同样的重排结果。
|
|
type Classifier interface {
|
|
// Refine 对候选重打分/重排。返回的切片应包含与输入相同的一组候选
|
|
// (可更新 Confidence 与顺序);快照信息已随候选 ID 携带。
|
|
Refine(ctx context.Context, input string, candidates []Candidate) ([]Candidate, error)
|
|
}
|