Documentation
¶
Index ¶
- Variables
- func BenchmarkAccuracyMetric(expected, actual map[string]interface{}) float64
- func BenchmarkDatasetFromExamples(examples []core.Example) core.Dataset
- func CreateBenchmarkDatasets() map[string]BenchmarkDataset
- func CreateBenchmarkProgram(predictor core.Module) core.Program
- func LogBenchmarkResult(result BenchmarkResult)
- func StandardBenchmarkConfigs() map[string]BenchmarkConfig
- type BenchmarkConfig
- type BenchmarkDataset
- type BenchmarkMetrics
- type BenchmarkResult
- type MockCoreTool
- func (m *MockCoreTool) CanHandle(ctx context.Context, intent string) bool
- func (m *MockCoreTool) Description() string
- func (m *MockCoreTool) Execute(ctx context.Context, args map[string]interface{}) (core.ToolResult, error)
- func (m *MockCoreTool) InputSchema() models.InputSchema
- func (m *MockCoreTool) Metadata() *core.ToolMetadata
- func (m *MockCoreTool) Name() string
- func (m *MockCoreTool) Validate(params map[string]interface{}) error
- type MockDataset
- type MockLLM
- func (m *MockLLM) Capabilities() []core.Capability
- func (m *MockLLM) CreateEmbedding(ctx context.Context, input string, options ...core.EmbeddingOption) (*core.EmbeddingResult, error)
- func (m *MockLLM) CreateEmbeddings(ctx context.Context, inputs []string, options ...core.EmbeddingOption) (*core.BatchEmbeddingResult, error)
- func (m *MockLLM) Generate(ctx context.Context, prompt string, opts ...core.GenerateOption) (*core.LLMResponse, error)
- func (m *MockLLM) GenerateWithContent(ctx context.Context, content []core.ContentBlock, ...) (*core.LLMResponse, error)
- func (m *MockLLM) GenerateWithFunctions(ctx context.Context, prompt string, functions []map[string]interface{}, ...) (map[string]interface{}, error)
- func (m *MockLLM) GenerateWithJSON(ctx context.Context, prompt string, opts ...core.GenerateOption) (map[string]interface{}, error)
- func (m *MockLLM) ModelID() string
- func (m *MockLLM) ProviderName() string
- func (m *MockLLM) StreamGenerate(ctx context.Context, prompt string, opts ...core.GenerateOption) (*core.StreamResponse, error)
- func (m *MockLLM) StreamGenerateWithContent(ctx context.Context, content []core.ContentBlock, ...) (*core.StreamResponse, error)
- type MockMCPClient
- type MockModule
- func (m *MockModule) Clone() core.Module
- func (m *MockModule) GetDisplayName() string
- func (m *MockModule) GetModuleType() string
- func (m *MockModule) GetSignature() core.Signature
- func (m *MockModule) Process(ctx context.Context, inputs map[string]any, opts ...core.Option) (map[string]any, error)
- func (m *MockModule) SetLLM(llm core.LLM)
- func (m *MockModule) SetSignature(signature core.Signature)
- func (m *MockModule) UpdateInstruction(instruction string)
- type MockStreamConfig
- type MockTool
- func (m *MockTool) CanHandle(ctx context.Context, intent string) bool
- func (m *MockTool) Description() string
- func (m *MockTool) Execute(ctx context.Context, params map[string]interface{}) (core.ToolResult, error)
- func (m *MockTool) InputSchema() models.InputSchema
- func (m *MockTool) Metadata() *core.ToolMetadata
- func (m *MockTool) Name() string
- func (m *MockTool) Validate(params map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ConcurrencyTestMu sync.Mutex
ConcurrencyTestMu protects concurrent access to global concurrency settings during benchmark tests to prevent race conditions.
Functions ¶
func BenchmarkAccuracyMetric ¶
BenchmarkAccuracyMetric provides a standard accuracy metric for benchmarking.
func BenchmarkDatasetFromExamples ¶
BenchmarkDatasetFromExamples converts examples to a dataset interface.
func CreateBenchmarkDatasets ¶
func CreateBenchmarkDatasets() map[string]BenchmarkDataset
CreateBenchmarkDatasets creates standardized datasets for benchmarking optimizers.
func CreateBenchmarkProgram ¶
CreateBenchmarkProgram creates a standard program for benchmarking optimizers. The predictor parameter should be a modules.Predict instance to avoid import cycles.
func LogBenchmarkResult ¶
func LogBenchmarkResult(result BenchmarkResult)
LogBenchmarkResult logs benchmark results in a structured format.
func StandardBenchmarkConfigs ¶
func StandardBenchmarkConfigs() map[string]BenchmarkConfig
StandardBenchmarkConfigs provides predefined benchmark configurations.
Types ¶
type BenchmarkConfig ¶
type BenchmarkConfig struct {
DatasetSize int
Breadth int
Depth int
MaxSteps int
BatchSize int
NumTrials int
Temperature float64
Timeout int // seconds
}
BenchmarkConfig represents common benchmark configuration.
type BenchmarkDataset ¶
BenchmarkDataset represents different dataset sizes for benchmarking.
type BenchmarkMetrics ¶
type BenchmarkMetrics struct {
CompilationTime float64
AverageScore float64
TotalExamples int
TokensUsed int
}
BenchmarkMetrics tracks performance metrics during benchmarking.
type BenchmarkResult ¶
type BenchmarkResult struct {
OptimizerName string
Config BenchmarkConfig
CompilationTime float64 // seconds
AverageScore float64
TotalExamples int
Success bool
Error string
}
BenchmarkResult captures the results of a benchmark run.
type MockCoreTool ¶
type MockCoreTool struct {
// contains filtered or unexported fields
}
Copied from pkg/tools/registry_test.go.
func NewMockCoreTool ¶
func NewMockCoreTool(name, description string, executeFunc func(ctx context.Context, args map[string]interface{}) (core.ToolResult, error)) *MockCoreTool
NewMockCoreTool creates a new MockCoreTool instance.
func (*MockCoreTool) CanHandle ¶
func (m *MockCoreTool) CanHandle(ctx context.Context, intent string) bool
func (*MockCoreTool) Description ¶
func (m *MockCoreTool) Description() string
func (*MockCoreTool) Execute ¶
func (m *MockCoreTool) Execute(ctx context.Context, args map[string]interface{}) (core.ToolResult, error)
func (*MockCoreTool) InputSchema ¶
func (m *MockCoreTool) InputSchema() models.InputSchema
func (*MockCoreTool) Metadata ¶
func (m *MockCoreTool) Metadata() *core.ToolMetadata
func (*MockCoreTool) Name ¶
func (m *MockCoreTool) Name() string
func (*MockCoreTool) Validate ¶
func (m *MockCoreTool) Validate(params map[string]interface{}) error
type MockDataset ¶
type MockDataset struct {
mock.Mock
Examples []core.Example
Index int
// contains filtered or unexported fields
}
MockDataset is a mock implementation of core.Dataset.
func NewMockDataset ¶
func NewMockDataset(examples []core.Example) *MockDataset
NewMockDataset creates a new MockDataset with the given examples.
type MockLLM ¶
MockLLM is a mock implementation of core.LLM.
func (*MockLLM) Capabilities ¶
func (m *MockLLM) Capabilities() []core.Capability
func (*MockLLM) CreateEmbedding ¶
func (m *MockLLM) CreateEmbedding(ctx context.Context, input string, options ...core.EmbeddingOption) (*core.EmbeddingResult, error)
CreateEmbedding mocks the single embedding creation following the same pattern as Generate.
func (*MockLLM) CreateEmbeddings ¶
func (m *MockLLM) CreateEmbeddings(ctx context.Context, inputs []string, options ...core.EmbeddingOption) (*core.BatchEmbeddingResult, error)
CreateEmbeddings mocks the batch embedding creation.
func (*MockLLM) Generate ¶
func (m *MockLLM) Generate(ctx context.Context, prompt string, opts ...core.GenerateOption) (*core.LLMResponse, error)
func (*MockLLM) GenerateWithContent ¶
func (m *MockLLM) GenerateWithContent(ctx context.Context, content []core.ContentBlock, options ...core.GenerateOption) (*core.LLMResponse, error)
func (*MockLLM) GenerateWithFunctions ¶
func (*MockLLM) GenerateWithJSON ¶
func (*MockLLM) ProviderName ¶
GetProviderName mocks the GetProviderName method from the LLM interface.
func (*MockLLM) StreamGenerate ¶
func (m *MockLLM) StreamGenerate(ctx context.Context, prompt string, opts ...core.GenerateOption) (*core.StreamResponse, error)
func (*MockLLM) StreamGenerateWithContent ¶
func (m *MockLLM) StreamGenerateWithContent(ctx context.Context, content []core.ContentBlock, options ...core.GenerateOption) (*core.StreamResponse, error)
type MockMCPClient ¶
type MockMCPClient struct {
ListToolsFunc func(ctx context.Context, cursor *models.Cursor) (*models.ListToolsResult, error)
// Corrected CallToolFunc signature again to match MCPClientInterface
CallToolFunc func(ctx context.Context, toolName string, arguments map[string]interface{}) (*models.CallToolResult, error)
}
MockMCPClient provides a mock implementation of the MCPClient interface (or relevant parts).
func NewMockMCPClientWithTools ¶
func NewMockMCPClientWithTools() *MockMCPClient
NewMockMCPClientWithTools creates a MockMCPClient pre-configured with standard mock tools.
func (*MockMCPClient) CallTool ¶
func (m *MockMCPClient) CallTool(ctx context.Context, toolName string, arguments map[string]interface{}) (*models.CallToolResult, error)
Corrected CallTool signature again to match MCPClientInterface.
func (*MockMCPClient) ListTools ¶
func (m *MockMCPClient) ListTools(ctx context.Context, cursor *models.Cursor) (*models.ListToolsResult, error)
ListTools calls the underlying ListToolsFunc.
type MockModule ¶
MockModule is a mock implementation of core.Module.
func NewMockModule ¶
func NewMockModule(instruction string) *MockModule
NewMockModule creates a new MockModule with the given instruction.
func (*MockModule) Clone ¶
func (m *MockModule) Clone() core.Module
func (*MockModule) GetDisplayName ¶
func (m *MockModule) GetDisplayName() string
func (*MockModule) GetModuleType ¶
func (m *MockModule) GetModuleType() string
func (*MockModule) GetSignature ¶
func (m *MockModule) GetSignature() core.Signature
func (*MockModule) SetLLM ¶
func (m *MockModule) SetLLM(llm core.LLM)
func (*MockModule) SetSignature ¶
func (m *MockModule) SetSignature(signature core.Signature)
func (*MockModule) UpdateInstruction ¶
func (m *MockModule) UpdateInstruction(instruction string)
type MockStreamConfig ¶
type MockStreamConfig struct {
Content string
ChunkSize int
ChunkDelay time.Duration
Error error
ErrorAfter int
TokenCounts *core.TokenInfo
ShouldCancel bool
mock.Mock
}
MockStreamConfig configures how the mock LLM will stream responses during tests.
type MockTool ¶
func NewMockTool ¶
NewMockTool creates a new mock tool with default metadata.
func (*MockTool) Description ¶
func (*MockTool) Execute ¶
func (m *MockTool) Execute(ctx context.Context, params map[string]interface{}) (core.ToolResult, error)
Execute implements the Tool interface.
func (*MockTool) InputSchema ¶
func (m *MockTool) InputSchema() models.InputSchema
func (*MockTool) Metadata ¶
func (m *MockTool) Metadata() *core.ToolMetadata
Metadata implements the Tool interface.