async def test_rag_with_empty_search_results(self, mock_providers):
        """Test RAG behavior with empty search results."""
        class RAGPromptBuilder:
            def __init__(self, providers):
                self.providers = providers

            async def build_prompt(self, query, search_results, system_prompt_template_id=None):
                # Simple implementation that handles empty results gracefully
                if not search_results.get("chunk_search_results"):
                    return [
                        {"role": "system", "content": "No relevant information was found for your query."},
                        {"role": "user", "content": query}
                    ]
                return []

        # Create a RAG prompt builder
        builder = RAGPromptBuilder(providers=mock_providers)

        # Setup empty search results
        empty_search_results = {"chunk_search_results": []}

        # Call the build method with empty results
        query = "What did Aristotle say about ethics?"
        messages = await builder.build_prompt(
            query=query,
            search_results=empty_search_results,
            system_prompt_template_id="default_rag_prompt"
        )

        # Find the system message
        system_message = next((m for m in messages if m["role"] == "system"), None)

        # Check that the system message handles empty results gracefully
        assert system_message is not None, "System message should be present even with empty results"
        assert "no relevant information" in system_message["content"].lower(), \
               "System message should indicate that no relevant information was found"
Test RAG behavior with empty search results.
py/tests/unit/retrieval/test_rag_processing.py