-
Notifications
You must be signed in to change notification settings - Fork 160
Description
🔍 Issue Description
mofa-testing exports reusable mocks for ModelOrchestrator, Tool, Clock, and AgentBus but has no mock for the kernel-level LLMProvider trait defined in mofa-kernel/src/llm/provider.rs.
📌 Issue Type
- Bug
- Feature Request
- Enhancement
- Documentation
- Refactor
- Other (please specify)
📝 Description
-
What is happening?
mofa-testing(tests/src/lib.rs) provides 4 mock types:
MockLLMBackend: mocks ModelOrchestrator
MockTool mocks: Tool
MockClock: mocks Clock
MockAgentBus: mocks AgentBusBut there is no mock for the kernel-level LLMProvider trait (
chat(),chat_stream(),embedding()). Anyone
writing agent tests at the kernel level has to create their own mock from scratch. -
What should happen instead?
mofa-testing should export a MockLLMProvider implementing the LLMProvider trait, completing the mock
coverage alongside the existing 4 mock types. -
Why is this needed?
The LLMProvider trait is the primary interface agents use for LLM interaction. Without a reusable mock in the
testing crate, test authors must write ad-hoc implementations each time. This is the only core kernel trait
missing a mock in mofa-testing.
🎯 Proposed Solution (Optional but Encouraged)
Add MockLLMProvider to tests/src/llm_provider.rs with:
- Prompt-based response matching: map prompt substrings to preset responses (first match wins)
- Tool call simulation: return preset
ToolCallresponses - Response sequences: return different responses on repeated calls (for multi-turn testing)
- Failure injection: queue errors to test error handling paths
- Request histor: record all
ChatCompletionRequestsfor assertion - Streaming support:
chat_stream()returns deterministic chunks
Files to change:
tests/src/llm_provider.rs (new)
tests/tests/llm_provider_tests.rs (new — ~15 tests)
tests/src/lib.rs (add module + export)
📎 Additional Context
Existing MockLLMBackend has similar features (prompt matching, failure injection) but implements ModelOrchestrator, not LLMProvider
The LLMProvider trait is in crates/mofa-kernel/src/llm/provider.rs
🙋 Claiming This Issue
To avoid duplicated work:
- I'm willing to solve this issue by myself