mock

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockOpenAIClient

type MockOpenAIClient struct {
	AskResponses                  []Fragment
	AskResponseIndex              int
	CreateChatCompletionResponses []openai.ChatCompletionResponse
	CreateChatCompletionIndex     int
	AskError                      error
	CreateChatCompletionError     error
	FragmentHistory               []Fragment
}

MockOpenAIClient implements the OpenAIClient for testing

func NewMockOpenAIClient

func NewMockOpenAIClient() *MockOpenAIClient

func (*MockOpenAIClient) AddCreateChatCompletionFunction

func (m *MockOpenAIClient) AddCreateChatCompletionFunction(name, args string)

func (*MockOpenAIClient) Ask

func (m *MockOpenAIClient) Ask(ctx context.Context, f Fragment) (Fragment, error)

func (*MockOpenAIClient) CreateChatCompletion

func (*MockOpenAIClient) SetAskError

func (m *MockOpenAIClient) SetAskError(err error)

func (*MockOpenAIClient) SetAskResponse

func (m *MockOpenAIClient) SetAskResponse(content string)

Helper methods for setting up mock responses

func (*MockOpenAIClient) SetCreateChatCompletionError

func (m *MockOpenAIClient) SetCreateChatCompletionError(err error)

func (*MockOpenAIClient) SetCreateChatCompletionResponse

func (m *MockOpenAIClient) SetCreateChatCompletionResponse(response openai.ChatCompletionResponse)

type MockTool

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

MockTool implements the Tool interface for testing

func NewMockTool

func NewMockTool(name, description string) *MockTool

func (*MockTool) Run

func (m *MockTool) Run(args map[string]any) (string, error)

func (*MockTool) SetRunError

func (m *MockTool) SetRunError(err error)

func (*MockTool) SetRunResult

func (m *MockTool) SetRunResult(result string)

func (*MockTool) Status

func (m *MockTool) Status() *ToolStatus

func (*MockTool) Tool

func (m *MockTool) Tool() openai.Tool

Jump to

Keyboard shortcuts

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