Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockLLMServer ¶
type MockLLMServer struct {
Server *httptest.Server
Responses []MockResponse
Requests []MockRequest
// contains filtered or unexported fields
}
MockLLMServer provides a configurable mock LLM API server for testing.
func NewMockLLMServer ¶
func NewMockLLMServer(t *testing.T, responses ...MockResponse) *MockLLMServer
NewMockLLMServer creates a mock server that returns canned responses in order.
func (*MockLLMServer) ContainsString ¶
func (m *MockLLMServer) ContainsString(s string) bool
ContainsString checks if any request body contains the given string.
func (*MockLLMServer) LastRequest ¶
func (m *MockLLMServer) LastRequest() MockRequest
LastRequest returns the most recent request body.
func (*MockLLMServer) RequestCount ¶
func (m *MockLLMServer) RequestCount() int
RequestCount returns how many requests were made.
func (*MockLLMServer) URL ¶
func (m *MockLLMServer) URL() string
URL returns the base URL of the mock server.
type MockRequest ¶
MockRequest records a request made to the mock server.
type MockResponse ¶
type MockResponse struct {
Content string
ToolUse []ToolUseBlock
StopReason string
StatusCode int
}
MockResponse defines a canned response from the mock LLM.
func ErrorResponse ¶
func ErrorResponse(statusCode int) MockResponse
ErrorResponse creates a mock error response.
func SimpleTextResponse ¶
func SimpleTextResponse(text string) MockResponse
SimpleTextResponse creates a mock response with just text content.
func ToolUseResponse ¶
func ToolUseResponse(toolName string, input map[string]interface{}) MockResponse
ToolUseResponse creates a mock response that calls a tool.
type ToolUseBlock ¶
ToolUseBlock represents a tool call in the response.