apac-ops-bot/backend/tests
SamoilenkoVadym 86da0b2330 Implement OpenAI Responses API service with RAG enforcement
Features:
- OpenAIService class for Responses API integration
- file_search tool integration with Vector Store
- Strict RAG-only enforcement via system instructions
- Citation validation to prevent hallucinations
- Warning logs for responses without proper citations
- Support for multi-turn conversations via previous_response_id
- Async streaming support for real-time responses
- Comprehensive error handling and logging

Test Coverage:
- Service initialization and configuration
- System instructions validation
- Citation detection (valid, missing, no-info responses)
- Search results formatting
- RAG usage validation with hallucination detection
- Response generation with mocked API calls
- Multi-turn conversation support
- Error handling
- Integration test stubs (skipped, require API key)

Key RAG Safety Features:
- Low temperature (0.3) for factual responses
- Citation keyword detection
- Automatic disclaimer for uncited responses
- Separate handling of valid "no info" responses
- Warning logs for potential hallucinations

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-27 14:26:43 +00:00
..
__init__.py Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
conftest.py Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
test_api.py Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
test_config.py Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
test_database.py Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
test_models.py Add comprehensive backend test suite and Phase 1 foundation 2026-01-27 14:24:59 +00:00
test_openai_service.py Implement OpenAI Responses API service with RAG enforcement 2026-01-27 14:26:43 +00:00