feat: Add Ollama integration for AI-based speaker detection
- Added Requirement 14 for intelligent speaker detection using Ollama/llama3:8B - Updated design document with OllamaService component and integration details - Added 4 new correctness properties for Ollama functionality - Added tasks 15-17 for implementing Ollama integration - Updated technology stack to include httpx and Ollama - Added error handling guidelines for Ollama integration - Configured fallback to pattern-based detection when Ollama unavailable This enhancement allows users to paste raw dialogue text without manual role markers. The system will use AI to intelligently detect speakers, making the tool more user-friendly.
This commit is contained in:
@@ -289,13 +289,75 @@
|
||||
- Include troubleshooting section
|
||||
- _Requirements: 13.1, 13.2, 13.3, 13.4, 13.5_
|
||||
|
||||
- [ ] 15. Final integration testing and polish
|
||||
- [ ] 15. Implement Ollama integration service
|
||||
- Create OllamaService class in services/ollama_service.py
|
||||
- Implement connection to Ollama API using httpx
|
||||
- Configure OLLAMA_BASE_URL environment variable (default: http://localhost:11434)
|
||||
- Implement detect_speakers() method with structured prompt
|
||||
- Implement prompt builder for speaker detection
|
||||
- Implement JSON response parser
|
||||
- Implement is_available() health check method
|
||||
- Add timeout handling (30 seconds)
|
||||
- _Requirements: 14.1, 14.2, 14.3, 14.6_
|
||||
|
||||
- [ ]* 15.1 Write property test for Ollama speaker detection
|
||||
- **Property 28: Ollama speaker detection**
|
||||
- **Validates: Requirements 14.1**
|
||||
|
||||
- [ ]* 15.2 Write property test for JSON response parsing
|
||||
- **Property 29: Ollama JSON response parsing**
|
||||
- **Validates: Requirements 14.3**
|
||||
|
||||
- [ ]* 15.3 Write unit tests for Ollama service
|
||||
- Test connection to Ollama
|
||||
- Test prompt construction
|
||||
- Test JSON parsing with various formats
|
||||
- Test timeout handling
|
||||
- Test error handling for unavailable service
|
||||
- _Requirements: 14.1, 14.2, 14.3_
|
||||
|
||||
- [ ] 16. Integrate Ollama into role detection
|
||||
- Update RoleDetector to use OllamaService
|
||||
- Implement _detect_with_ollama() method
|
||||
- Add fallback logic: try Ollama first, then pattern matching
|
||||
- Implement role merging and deduplication across both methods
|
||||
- Handle Ollama unavailable gracefully
|
||||
- Log detection method used (AI vs pattern)
|
||||
- _Requirements: 14.1, 14.4, 14.5_
|
||||
|
||||
- [ ]* 16.1 Write property test for Ollama fallback
|
||||
- **Property 30: Ollama fallback behavior**
|
||||
- **Validates: Requirements 14.4**
|
||||
|
||||
- [ ]* 16.2 Write property test for role deduplication
|
||||
- **Property 31: Role deduplication across detection methods**
|
||||
- **Validates: Requirements 14.5**
|
||||
|
||||
- [ ]* 16.3 Write unit tests for integrated role detection
|
||||
- Test with Ollama available
|
||||
- Test with Ollama unavailable
|
||||
- Test role merging from both sources
|
||||
- Test deduplication logic
|
||||
- _Requirements: 14.4, 14.5_
|
||||
|
||||
- [ ] 17. Update documentation for Ollama integration
|
||||
- Document Ollama setup in README
|
||||
- Add instructions for installing and running Ollama
|
||||
- Document llama3:8B model requirement
|
||||
- Add OLLAMA_BASE_URL environment variable to .env.example
|
||||
- Update backend README with Ollama configuration
|
||||
- Add troubleshooting section for Ollama issues
|
||||
- _Requirements: 14.6_
|
||||
|
||||
- [ ] 18. Final integration testing and polish
|
||||
- Test complete end-to-end workflow
|
||||
- Test with various text samples (short, long, multiple roles, no roles)
|
||||
- Test with unmarked dialogue text (relying on AI detection)
|
||||
- Test with marked text (pattern detection)
|
||||
- Test with Ollama available and unavailable
|
||||
- Test all language options (a, b, f, j)
|
||||
- Test error scenarios (network failures, invalid inputs)
|
||||
- Verify audio quality and playback
|
||||
- Test Docker deployment
|
||||
- Fix any bugs discovered during testing
|
||||
- _Requirements: All_
|
||||
,.
|
||||
- _Requirements: All_
|
||||
Reference in New Issue
Block a user