async def test_rag_prompt_construction_without_metadata(self, mock_providers, mock_search_results):
        """Test RAG prompt construction without metadata."""
        class RAGPromptBuilder:
            def __init__(self, providers):
                self.providers = providers

            async def build_prompt(self, query, search_results, system_prompt_template_id=None, include_metadata=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 metadata if requested
                    if include_metadata:
                        metadata_items = []
                        for key, value in chunk.get("metadata", {}).items():
                            if key not in ["embedding"]:  # Skip non-user-friendly fields
                                metadata_items.append(f"{key}: {value}")

                        if metadata_items:
                            metadata_str = ", ".join(metadata_items)
                            chunk_text += f" ({metadata_str})"

                    context += chunk_text + "\n\n"

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

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

        # Call the build method without metadata
        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_metadata=False
        )

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

        # Ensure metadata is not included
        for term in ["source", "title", "page"]:
            assert term not in system_message["content"].lower(), \
                f"System message should not contain metadata term '{term}' when include_metadata=False"
Test RAG prompt construction without metadata.
py/tests/unit/retrieval/test_rag_processing.py