mock

package
v1.4.4-alpha1202-loadi... Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockedAIConfig

func NewMockedAIConfig(ctx context.Context) aicommon.AICallerConfigIf

Types

type MockInvoker

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

MockInvoker 实现 AIInvokeRuntime 接口用于测试

func NewMockInvoker

func NewMockInvoker(ctx context.Context) *MockInvoker

func (*MockInvoker) AddToTimeline

func (m *MockInvoker) AddToTimeline(entry, content string)

func (*MockInvoker) AskForClarification

func (m *MockInvoker) AskForClarification(ctx context.Context, question string, payloads []string) string

func (*MockInvoker) AsyncPlanAndExecute

func (m *MockInvoker) AsyncPlanAndExecute(ctx context.Context, planPayload string, onFinish func(error))

func (*MockInvoker) DirectlyAnswer

func (m *MockInvoker) DirectlyAnswer(ctx context.Context, query string, tools []*aitool.Tool) (string, error)

func (*MockInvoker) EmitFileArtifactWithExt

func (m *MockInvoker) EmitFileArtifactWithExt(name, ext string, data any) string

func (*MockInvoker) EmitResult

func (m *MockInvoker) EmitResult(any)

func (*MockInvoker) EmitResultAfterStream

func (m *MockInvoker) EmitResultAfterStream(any)

func (*MockInvoker) EnhanceKnowledgeAnswer

func (m *MockInvoker) EnhanceKnowledgeAnswer(ctx context.Context, s string) (string, error)

func (*MockInvoker) EnhanceKnowledgeGetter

func (m *MockInvoker) EnhanceKnowledgeGetter(ctx context.Context, userQuery string) (string, error)

func (*MockInvoker) ExecuteToolRequiredAndCall

func (m *MockInvoker) ExecuteToolRequiredAndCall(ctx context.Context, name string) (*aitool.ToolResult, bool, error)

func (*MockInvoker) ExecuteToolRequiredAndCallWithoutRequired

func (m *MockInvoker) ExecuteToolRequiredAndCallWithoutRequired(ctx context.Context, toolName string, params aitool.InvokeParams) (*aitool.ToolResult, bool, error)

func (*MockInvoker) GetBasicPromptInfo

func (m *MockInvoker) GetBasicPromptInfo(tools []*aitool.Tool) (string, map[string]any, error)

func (*MockInvoker) GetConfig

func (m *MockInvoker) GetConfig() aicommon.AICallerConfigIf

func (*MockInvoker) InvokeLiteForge

func (m *MockInvoker) InvokeLiteForge(ctx context.Context, actionName string, prompt string, outputs []aitool.ToolOption, opts ...aicommon.GeneralKVConfigOption) (*aicommon.Action, error)

func (*MockInvoker) RequireAIForgeAndAsyncExecute

func (m *MockInvoker) RequireAIForgeAndAsyncExecute(ctx context.Context, forgeName string, onFinish func(error))

func (*MockInvoker) VerifyUserSatisfaction

func (m *MockInvoker) VerifyUserSatisfaction(ctx context.Context, query string, isToolCall bool, payload string) (bool, string, error)

type MockedAIConfig

type MockedAIConfig struct {
	*aicommon.KeyValueConfig
	*aicommon.BaseInteractiveHandler
	*aicommon.BaseCheckpointableStorage

	Ctx context.Context

	IdSequence int64
	RuntimeId  string

	Emitter *aicommon.Emitter

	TimelineContentSizeLimit int64
}

func (*MockedAIConfig) AcquireId

func (m *MockedAIConfig) AcquireId() int64

func (*MockedAIConfig) CallAI

func (m *MockedAIConfig) CallAI(request *aicommon.AIRequest) (*aicommon.AIResponse, error)

func (*MockedAIConfig) CallAIResponseConsumptionCallback

func (m *MockedAIConfig) CallAIResponseConsumptionCallback(current int)

func (*MockedAIConfig) CallAIResponseOutputFinishedCallback

func (m *MockedAIConfig) CallAIResponseOutputFinishedCallback(s string)

func (*MockedAIConfig) GetAITransactionAutoRetryCount

func (m *MockedAIConfig) GetAITransactionAutoRetryCount() int64

func (*MockedAIConfig) GetAllowUserInteraction

func (c *MockedAIConfig) GetAllowUserInteraction() bool

func (*MockedAIConfig) GetContext

func (m *MockedAIConfig) GetContext() context.Context

func (*MockedAIConfig) GetEmitter

func (m *MockedAIConfig) GetEmitter() *aicommon.Emitter

func (*MockedAIConfig) GetMaxIterationCount

func (c *MockedAIConfig) GetMaxIterationCount() int64

func (*MockedAIConfig) GetRuntimeId

func (m *MockedAIConfig) GetRuntimeId() string

func (*MockedAIConfig) GetTimelineContentSizeLimit

func (m *MockedAIConfig) GetTimelineContentSizeLimit() int64

func (*MockedAIConfig) GetUserInteractiveLimitedTimes

func (c *MockedAIConfig) GetUserInteractiveLimitedTimes() int64

func (*MockedAIConfig) IsCtxDone

func (m *MockedAIConfig) IsCtxDone() bool

func (*MockedAIConfig) NewAIResponse

func (m *MockedAIConfig) NewAIResponse() *aicommon.AIResponse

func (*MockedAIConfig) RetryPromptBuilder

func (m *MockedAIConfig) RetryPromptBuilder(originalPrompt string, err error) string

Jump to

Keyboard shortcuts

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