mocks

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockLLMClient

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

MockLLMClient provides a mock implementation of the LLM client for testing

func NewMockLLMClient

func NewMockLLMClient() *MockLLMClient

NewMockLLMClient creates a new mock LLM client

func (*MockLLMClient) Chat

func (m *MockLLMClient) Chat(ctx context.Context, messages []llm.Message) (*llm.CompletionResponse, error)

Chat implements the chat method

func (*MockLLMClient) Complete

Complete implements the LLM completion method

func (*MockLLMClient) GetRequestHistory

func (m *MockLLMClient) GetRequestHistory() []llm.CompletionRequest

GetRequestHistory returns the history of requests made

func (*MockLLMClient) IsAvailable

func (m *MockLLMClient) IsAvailable() bool

IsAvailable returns whether the client is available

func (*MockLLMClient) Provider

func (m *MockLLMClient) Provider() constants.Provider

Provider returns the provider type

func (*MockLLMClient) Reset

func (m *MockLLMClient) Reset()

Reset resets the mock client state

func (*MockLLMClient) SetError

func (m *MockLLMClient) SetError(shouldError bool, message string)

SetError configures the client to return an error

func (*MockLLMClient) SetFunctionCallMode

func (m *MockLLMClient) SetFunctionCallMode(enabled bool)

SetFunctionCallMode enables function calling mode

func (*MockLLMClient) SetFunctionResponse

func (m *MockLLMClient) SetFunctionResponse(functionName string, response interface{})

SetFunctionResponse sets a response for a specific function

func (*MockLLMClient) SetResponses

func (m *MockLLMClient) SetResponses(responses ...llm.CompletionResponse)

SetResponses sets the predefined responses to return

type MockState

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

MockState provides a mock implementation of the State interface

func NewMockState

func NewMockState() *MockState

NewMockState creates a new mock state

func (*MockState) Clear

func (m *MockState) Clear()

Clear removes all keys

func (*MockState) Clone

func (m *MockState) Clone() state.State

Clone creates a copy

func (*MockState) Delete

func (m *MockState) Delete(key string)

Delete removes a key

func (*MockState) Get

func (m *MockState) Get(key string) (interface{}, bool)

Get retrieves a value

func (*MockState) GetBool

func (m *MockState) GetBool(key string) (bool, bool)

GetBool gets a bool value

func (*MockState) GetFloat64

func (m *MockState) GetFloat64(key string) (float64, bool)

GetFloat64 gets a float64 value

func (*MockState) GetInt

func (m *MockState) GetInt(key string) (int, bool)

GetInt gets an int value

func (*MockState) GetStats

func (m *MockState) GetStats() (getCount, setCount int)

GetStats returns statistics

func (*MockState) GetString

func (m *MockState) GetString(key string) (string, bool)

GetString gets a string value

func (*MockState) GetTime

func (m *MockState) GetTime(key string) (time.Time, bool)

GetTime gets a time value

func (*MockState) Keys

func (m *MockState) Keys() []string

Keys returns all keys

func (*MockState) Restore

func (m *MockState) Restore(snapshot map[string]interface{})

Restore restores from a snapshot

func (*MockState) Set

func (m *MockState) Set(key string, value interface{})

Set sets a value

func (*MockState) SetUpdateFunc

func (m *MockState) SetUpdateFunc(fn func(key string, value interface{}) error)

SetUpdateFunc sets a function to call on updates

func (*MockState) Size

func (m *MockState) Size() int

Size returns the number of keys

func (*MockState) Snapshot

func (m *MockState) Snapshot() map[string]interface{}

Snapshot creates a snapshot

func (*MockState) Update

func (m *MockState) Update(updates map[string]interface{})

Update batch updates values

type MockStore

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

MockStore provides a mock implementation of the Store interface

func NewMockStore

func NewMockStore() *MockStore

NewMockStore creates a new mock store

func (*MockStore) Clear

func (s *MockStore) Clear(ctx context.Context, namespace []string) error

Clear removes all items

func (*MockStore) Delete

func (s *MockStore) Delete(ctx context.Context, namespace []string, key string) error

Delete removes an item

func (*MockStore) Get

func (s *MockStore) Get(ctx context.Context, namespace []string, key string) (*store.Value, error)

Get retrieves an item

func (*MockStore) GetStats

func (s *MockStore) GetStats() (putCount, getCount int)

GetStats returns statistics

func (*MockStore) List

func (s *MockStore) List(ctx context.Context, namespace []string) ([]string, error)

List lists all keys in a namespace

func (*MockStore) Namespaces

func (s *MockStore) Namespaces() []string

Namespaces returns all namespaces

func (*MockStore) Put

func (s *MockStore) Put(ctx context.Context, namespace []string, key string, value interface{}) error

Put stores an item

func (*MockStore) Search

func (s *MockStore) Search(ctx context.Context, namespace []string, filter map[string]interface{}) ([]*store.Value, error)

Search searches for items

func (*MockStore) SetError

func (s *MockStore) SetError(shouldError bool, message string)

SetError configures the store to return errors

func (*MockStore) Size

func (s *MockStore) Size() int

Size returns the total number of items

type MockStreamingLLMClient

type MockStreamingLLMClient struct {
	*MockLLMClient
	// contains filtered or unexported fields
}

MockStreamingLLMClient provides streaming capabilities

func NewMockStreamingLLMClient

func NewMockStreamingLLMClient() *MockStreamingLLMClient

NewMockStreamingLLMClient creates a new streaming mock client

func (*MockStreamingLLMClient) SetStreamChunks

func (m *MockStreamingLLMClient) SetStreamChunks(chunks ...string)

SetStreamChunks sets the chunks to stream

func (*MockStreamingLLMClient) Stream

Stream implements streaming completion

type MockTool

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

MockTool provides a mock implementation of the Tool interface

func NewMockTool

func NewMockTool(name, description string) *MockTool

NewMockTool creates a new mock tool

func (*MockTool) Description

func (m *MockTool) Description() string

Description returns the tool description

func (*MockTool) GetInvokeCount

func (m *MockTool) GetInvokeCount() int

GetInvokeCount returns the number of times the tool was invoked

func (*MockTool) GetLastInput

func (m *MockTool) GetLastInput() *interfaces.ToolInput

GetLastInput returns the last input passed to the tool

func (*MockTool) Invoke

Invoke executes the tool

func (*MockTool) Name

func (m *MockTool) Name() string

Name returns the tool name

func (*MockTool) Reset

func (m *MockTool) Reset()

Reset resets the tool state

func (*MockTool) Schema

func (m *MockTool) Schema() string

Schema returns the tool schema

func (*MockTool) SetError

func (m *MockTool) SetError(shouldError bool, message string)

SetError configures the tool to return an error

func (*MockTool) SetInvokeFunc

func (m *MockTool) SetInvokeFunc(fn func(ctx context.Context, input *interfaces.ToolInput) (*interfaces.ToolOutput, error))

SetInvokeFunc sets a custom invoke function

type MockToolExecutor

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

MockToolExecutor provides a mock tool executor

func NewMockToolExecutor

func NewMockToolExecutor() *MockToolExecutor

NewMockToolExecutor creates a new mock tool executor

func (*MockToolExecutor) ExecuteParallel

func (e *MockToolExecutor) ExecuteParallel(ctx context.Context, toolList []interfaces.Tool, inputs []map[string]interface{}) ([]interface{}, error)

ExecuteParallel executes tools in parallel

func (*MockToolExecutor) GetExecuteCalls

func (e *MockToolExecutor) GetExecuteCalls() int

GetExecuteCalls returns the number of execute calls

func (*MockToolExecutor) Reset

func (e *MockToolExecutor) Reset()

Reset resets the executor state

func (*MockToolExecutor) SetError

func (e *MockToolExecutor) SetError(shouldError bool, message string)

SetError configures the executor to return an error

func (*MockToolExecutor) SetExecuteFunc

func (e *MockToolExecutor) SetExecuteFunc(fn func(ctx context.Context, tools []interfaces.Tool, inputs []map[string]interface{}) ([]interface{}, error))

SetExecuteFunc sets a custom execute function

func (*MockToolExecutor) SetParallelResults

func (e *MockToolExecutor) SetParallelResults(results ...interface{})

SetParallelResults sets the results to return

type MockToolRegistry

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

MockToolRegistry provides a mock tool registry

func NewMockToolRegistry

func NewMockToolRegistry() *MockToolRegistry

NewMockToolRegistry creates a new mock tool registry

func (*MockToolRegistry) Clear

func (r *MockToolRegistry) Clear()

Clear removes all tools

func (*MockToolRegistry) Get

func (r *MockToolRegistry) Get(name string) (interfaces.Tool, bool)

Get retrieves a tool by name

func (*MockToolRegistry) List

func (r *MockToolRegistry) List() []interfaces.Tool

List lists all registered tools

func (*MockToolRegistry) Register

func (r *MockToolRegistry) Register(tool interfaces.Tool) error

Register registers a tool

Jump to

Keyboard shortcuts

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