-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
Create comprehensive tests to ensure all API endpoints (chat, images, video, audio) consistently use the model mapping service for routing requests to providers.
Background
Recent refactoring work unified the approach to model mappings across all services. Previously, some services (video, audio) were bypassing the model mapping system and directly using the client factory. This has been fixed, but we need tests to ensure consistency is maintained.
Acceptance Criteria
- Test that chat completions endpoint uses model mappings
- Test that image generation endpoint uses model mappings
- Test that video generation endpoint uses model mappings
- Test that audio transcription endpoint uses model mappings
- Test that audio translation endpoint uses model mappings
- Test that realtime audio endpoint uses model mappings
- Verify error handling when model mapping is not found
- Test that the correct provider is selected based on mapping
- Test that provider model name is used (not the alias)
Technical Details
-
Services refactored:
AudioRouter.cs- Now usesIModelProviderMappingServiceVideoGenerationService.cs- Now usesIModelProviderMappingServiceVideoGenerationOrchestrator.cs- Properly tracks original model alias
-
Key pattern to test:
var modelMapping = await _modelMappingService.GetMappingByModelAliasAsync(request.Model);
if (modelMapping == null)
{
throw new NotSupportedException($"Model {request.Model} is not configured");
}
var client = _clientFactory.CreateClient(modelMapping.ProviderId);
// Use modelMapping.ProviderModelName for the actual API callPriority
Medium - Critical for maintaining architectural consistency and preventing regression
Related Issues
- Part of the usage tracking and cost calculation improvements
- Follows DRY principle requested by user