package sidekick import ( "context" ) // LLMClient represents an abstraction over the LLM provider type LLMClient interface { Call(ctx context.Context, model ModelConfig, messages []Message, tools map[string]ToolDefinition) (Message, error) } var defaultLLMClient LLMClient = &mockLLMClient{} // SetLLMClient allows overriding the LLM client (e.g. for testing) func SetLLMClient(client LLMClient) { defaultLLMClient = client } // CallLLM invokes the configured LLM client func CallLLM(ctx context.Context, model ModelConfig, msgs []Message, tools map[string]ToolDefinition) (Message, error) { return defaultLLMClient.Call(ctx, model, msgs, tools) } // mockLLMClient is used as a fallback if no actual HTTP client is injected. type mockLLMClient struct { responses []Message calls int } func (m *mockLLMClient) Call(ctx context.Context, model ModelConfig, msgs []Message, ts map[string]ToolDefinition) (Message, error) { if m.calls < len(m.responses) { resp := m.responses[m.calls] m.calls++ return resp, nil } return Message{ Role: MessageRoleAssistant, Content: `{"action": "RESPOND", "params": {"response": "Mock LLM Response"}}`, }, nil }