acktest

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package acktest 提供无真实 LLM 时的确定性测试夹具:脚本化模型 (model.Model 实现)与假续跑 runner,供库自身的测试与业务侧的 确认流集成测试使用。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResumeCall

type ResumeCall struct {
	ThreadID   string // 续跑的会话 ID
	RunID      string // 续跑运行的 ID(resume- 前缀)
	ToolCallID string // 补投的工具调用 ID
	ToolName   string // 补投的工具名
	Content    string // 补投的工具结果内容
}

ResumeCall 是一次续跑调用的关键参数快照。

type ResumeRecorder

type ResumeRecorder struct {
	// contains filtered or unexported fields
}

ResumeRecorder 是假续跑 runner:记录 Run 调用,返回立即关闭的 事件通道,不真正运行 AG-UI。可用 FailWith 注入错误以演练失败路径。

func NewResumeRecorder

func NewResumeRecorder() *ResumeRecorder

NewResumeRecorder 创建空的续跑记录器。

func (*ResumeRecorder) Calls

func (r *ResumeRecorder) Calls() []ResumeCall

Calls 返回已记录的续跑调用快照。

func (*ResumeRecorder) FailWith

func (r *ResumeRecorder) FailWith(err error)

FailWith 设置后续 Run 调用返回的错误(传 nil 清除)。

func (*ResumeRecorder) Run

Run 实现 ack.ResumeRunner。

type ScriptedModel

type ScriptedModel struct {
	// contains filtered or unexported fields
}

ScriptedModel 是按固定脚本回放的 model.Model 实现:轮次索引等于 请求历史中 RoleTool 消息的数量,因此可以跨多轮运行正确推进。 脚本耗尽后重复最后一步,保证长对话不会越界。

func NewScriptedModel

func NewScriptedModel(name string, steps ...Step) *ScriptedModel

NewScriptedModel 创建脚本化模型;未提供步骤时使用一条占位文本。

func (*ScriptedModel) GenerateContent

func (m *ScriptedModel) GenerateContent(_ context.Context, req *model.Request) (<-chan *model.Response, error)

GenerateContent 实现 model.Model,按轮次索引选取脚本步骤。

func (*ScriptedModel) Info

func (m *ScriptedModel) Info() model.Info

Info 实现 model.Model,返回模型名。

type Step

type Step struct {
	Text      string
	ToolCalls []ToolCallSpec
}

Step 是一步脚本化的模型响应:文本、工具调用,或两者兼有。

type ToolCallSpec

type ToolCallSpec struct {
	ID   string
	Name string
	Args string // JSON 格式的参数
}

ToolCallSpec 描述脚本化模型发出的一次工具调用。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL