async def test_rag_prompt_with_citations(self, mock_providers, mock_search_results):
        """Test RAG prompt construction with citation information."""
        class RAGPromptBuilder:
            def __init__(self, providers):
                self.providers = providers

            async def build_prompt(self, query, search_results, system_prompt_template_id=None, include_citations=True):
                # Simple implementation that handles search results
                chunks = search_results.get("chunk_search_results", [])

                context = ""
                for i, chunk in enumerate(chunks):
                    # Format the chunk text
                    chunk_text = f"[{i+1}] {chunk.get('text', '')}"

                    # Add citation marker if requested
                    citation_id = chunk.get("metadata", {}).get("citation_id")
                    if include_citations and citation_id:
                        chunk_text += f" [{citation_id}]"

                    context += chunk_text + "\n\n"

                # Include instructions about citations
                citation_instructions = ""
                if include_citations:
                    citation_instructions = "\n\nWhen referring to the context, include citation markers like [cit0] to attribute information to its source."

                return [
                    {"role": "system", "content": f"System prompt with context:\n\n{context}{citation_instructions}"},
                    {"role": "user", "content": query}
                ]

        # Add citation metadata to search results
        for i, result in enumerate(mock_search_results["chunk_search_results"]):
            result["metadata"]["citation_id"] = f"cit-{i}"

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

        # Call the build method with citations enabled
        query = "What did Aristotle say about ethics?"
        messages = await builder.build_prompt(
            query=query,
            search_results=mock_search_results,
            system_prompt_template_id="default_rag_prompt",
            include_citations=True
        )

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

        # Check that citation markers are included in the context
        assert any(f"[cit-{i}]" in system_message["content"] for i in range(5)), \
            "Citation markers should be included in the context"

        # Check for citation instruction in the prompt
        assert "citation" in system_message["content"].lower(), \
            "System message should include instructions about using citations"
Test RAG prompt construction with citation information.
py/tests/unit/retrieval/test_rag_processing.py