3.3 KiB
3.3 KiB
Test Master Checkpoint: Issue #41 - DeepSeek API Support
Agent: test-master Date: 2025-12-26 Status: RED phase complete - 43 tests created
Summary
Created comprehensive test suite for Issue #41 - DeepSeek API Support and Alternative Embedding Models.
Test Coverage
Total: 43 tests across 8 test classes
-
TestDeepSeekInitialization (4 tests)
- DeepSeek provider uses ChatOpenAI
- Correct base_url configuration
- Custom headers for attribution
- Both LLM models initialized
-
TestAPIKeyHandling (4 tests)
- Missing API key error handling
- Valid API key acceptance
- Empty API key rejection
- OpenAI key not used for DeepSeek
-
TestModelFormatValidation (3 tests)
- deepseek-chat format
- deepseek-reasoner format
- Alternative model names
-
TestEmbeddingFallback (6 tests)
- OpenAI embeddings when key available
- HuggingFace fallback without OpenAI
- Memory disabled when no backend
- HuggingFace embedding dimensions (384)
- Graceful degradation messages
- OpenAI priority over HuggingFace
-
TestConfiguration (6 tests)
- Case-insensitive provider names
- Default DeepSeek models
- Custom backend URL
- Empty backend URL handling
- None backend URL handling
-
TestErrorHandling (5 tests)
- Network error handling
- Rate limit error handling
- Invalid model error
- Invalid provider error
- HuggingFace import error
-
TestHuggingFaceIntegration (5 tests)
- SentenceTransformer initialization
- Encode method usage
- Batch embedding
- Model caching
- Embedding normalization
-
TestEdgeCases (7 tests)
- Empty model names
- Special characters in models
- URL trailing slashes
- Empty collection queries
- Zero matches requested
- Very long text embedding
- Unicode text embedding
- Embedding fallback with partial failure
-
TestChromaDBCollectionHandling (3 tests)
- get_or_create_collection usage
- Idempotent collection creation
- Multiple collections coexist
Test Results (RED Phase)
- Failed: 23 tests (expected - no implementation yet)
- Errors: 9 tests (expected - SentenceTransformer not imported yet)
- Passed: 11 tests (edge cases that don't depend on DeepSeek implementation)
Key Failures (Expected):
- "Unsupported LLM provider: deepseek" - Main implementation needed
- "AttributeError: 'SentenceTransformer'" - HuggingFace fallback not implemented
Implementation Requirements
Based on test expectations:
-
trading_graph.py: Add DeepSeek provider case
- Use ChatOpenAI with base_url
- Require DEEPSEEK_API_KEY
- Set custom headers (optional)
- Models: deepseek-chat, deepseek-reasoner
-
memory.py: Add embedding fallback chain
- Try OpenAI embeddings first
- Fall back to HuggingFace SentenceTransformer
- Use all-MiniLM-L6-v2 model (384 dims)
- Disable memory gracefully if both fail
Next Steps
- Implement DeepSeek provider in trading_graph.py
- Implement HuggingFace embedding fallback in memory.py
- Run tests to verify GREEN phase
- Refactor if needed
Files
- Test File:
/Users/andrewkaszubski/Dev/Spektiv/tests/test_deepseek.py - Lines: 865 lines of comprehensive tests
- Pattern: Follows test_openrouter.py structure