mock

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package mock provides configurable mock implementations of interfaces for use in tests across the go-llm module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockTool

type MockTool struct {
	tool.DefaultTool
	Name_           string
	Description_    string
	InputSchema_    *jsonschema.Schema
	InputSchemaErr_ error
	Result_         any
	RunFn           func(ctx context.Context, input json.RawMessage) (any, error)
}

MockTool is a configurable implementation of llm.Tool for use in tests. Set Name_, Description_, and Result_ before registering it on a server. RunFn, if set, overrides Result_ and is called with the raw JSON input. InputSchemaErr_, if set, makes InputSchema() return that error.

func (*MockTool) Description

func (m *MockTool) Description() string

func (*MockTool) InputSchema

func (m *MockTool) InputSchema() (*jsonschema.Schema, error)

func (*MockTool) Name

func (m *MockTool) Name() string

func (*MockTool) Run

func (m *MockTool) Run(ctx context.Context, input json.RawMessage) (any, error)

Jump to

Keyboard shortcuts

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