Documentation
¶
Overview ¶
Package testmodel 提供测试用的脚本化 ChatModel:按预设序列返回消息, 无需真实模型即可端到端验证循环、skill、workflow 等机制。
Index ¶
- func ToolCallMsg(toolName, argsJSON string) *schema.Message
- type Fake
- func (f *Fake) Generate(_ context.Context, _ []*schema.Message, _ ...model.Option) (*schema.Message, error)
- func (f *Fake) Stream(ctx context.Context, in []*schema.Message, opts ...model.Option) (*schema.StreamReader[*schema.Message], error)
- func (f *Fake) WithTools(_ []*schema.ToolInfo) (model.ToolCallingChatModel, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToolCallMsg ¶
ToolCallMsg 构造一条发起工具调用的 assistant 消息。
Types ¶
type Fake ¶
type Fake struct {
// contains filtered or unexported fields
}
Fake 按序返回 Responses;耗尽后返回固定收尾消息。状态放共享内核: WithTools 按契约返回**新实例**(不修改当前实例),脚本与计数仍共享, 测试无论持有哪个实例都读到同一份 Calls。
func (*Fake) Generate ¶
func (f *Fake) Generate(_ context.Context, _ []*schema.Message, _ ...model.Option) (*schema.Message, error)
Generate 实现 model.BaseChatModel。
Click to show internal directories.
Click to hide internal directories.