
    ߈i                        S r SSKrSSKr\R                  R	                  S\R                  R                  \R                  R                  \5      5      5        SSKJ	r	  S r
\S:X  a#  \
" 5       r\R                  " \(       a  SOS5        gg)z 
Test the complete RAG pipeline
    N)	RAGSystemc                  B   [        S5        [        5       n [        S5        U R                  5       n[        SU S35        US:X  a  [        S5        g/ SQn[        S	5        U H  n[        S
U 35         U R                  U5      n[	        U[
        5      (       a  [        SU 35        MH  [        SUS    35        SU;   a)  US   (       a  [        S[        US   5       S35        M  M  M     [        S5        g! [         a  n[        SU 35         SnAM  SnAff = f)zTest the complete RAG pipelinez%=== Testing Complete RAG Pipeline ===z-Setting up system and processing documents...zSystem ready with z
 documentsr   z:No documents found. Please add files to the pdf_directory.F)z What is artificial intelligence?zWhat are the types of AI?z/What are some applications of AI in healthcare?z&What are the ethical challenges of AI?z
=== Testing Q&A ===z
Question: zAnswer: answersourcesz	Sources: z relevant chunks foundzError: Nz#
=== RAG Pipeline Test Complete ===T)printr   setup_systemsearch_and_answer
isinstancestrlen	Exception)
rag_system	doc_counttest_questionsquestionresultes         test_rag.pytest_rag_pipeliner      s(   	
12 J 

9:'')I	yk
45A~JKN 

!""XJ'(		!11(;F&#&&)*!1 234&6)+<Ic&*;&<%==STU ,=& # 

01	  	!GA3-  	!s   54C;+<C;;
DDD__main__   )__doc__sysospathinsertdirnameabspath__file__mainr   r   __name__successexit     r   <module>r&      sp     	 277??277??8#<= > (T z!GHH'Qq! r%   