mock

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package mock provides mock implementations of the llm package's interfaces. Both the hand-written testify-based Provider and the moq-generated ProviderMock live here during the testify → moq migration. New test code should prefer ProviderMock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderMock

type ProviderMock struct {
	// CompletionFunc mocks the Completion method.
	CompletionFunc func(ctx context.Context, params llm.CompletionParams) (*llm.CompletionResult, error)
	// contains filtered or unexported fields
}

ProviderMock is a mock implementation of llm.Provider.

func TestSomethingThatUsesProvider(t *testing.T) {

	// make and configure a mocked llm.Provider
	mockedProvider := &ProviderMock{
		CompletionFunc: func(ctx context.Context, params llm.CompletionParams) (*llm.CompletionResult, error) {
			panic("mock out the Completion method")
		},
	}

	// use mockedProvider in code that requires llm.Provider
	// and then make assertions.

}

func (*ProviderMock) Completion

func (mock *ProviderMock) Completion(ctx context.Context, params llm.CompletionParams) (*llm.CompletionResult, error)

Completion calls CompletionFunc.

func (*ProviderMock) CompletionCalls

func (mock *ProviderMock) CompletionCalls() []struct {
	Ctx    context.Context
	Params llm.CompletionParams
}

CompletionCalls gets all the calls that were made to Completion. Check the length with:

len(mockedProvider.CompletionCalls())

Jump to

Keyboard shortcuts

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