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> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| conftest.py | ||
| test_api.py | ||
| test_config.py | ||
| test_database.py | ||
| test_models.py | ||
| test_openai_service.py | ||