
    Mi2                        S r SSKrSSKr\R                  R	                  S\R                  R                  \R                  R                  \5      5      5        S rS r	S r
S rS r\S:X  a  \R                  " \" 5       5        gg)	z 
Test script for the RAG system
    Nc                       SSK Jn Jn  SSKJn  SSKJn  SSKJn  [        S5        g! [         a  n[        SU 35         S	nAg
S	nAff = f)zTest that all imports workr   )BASE_DIRLANGUAGE_MODELPDFProcessorVectorStore
MistralRAGu   ✓ All imports successfulTu   ✗ Import error: NF)configr   r   pdf_processorr   vector_storer	   mistral_integrationr   printImportError)r   r   r   r	   r   es         test_system.pytest_importsr      sB    	3.,2*+ "1#&'s   %( 
A
AA
c                       SSK Jn   [        S5        U " 5       n[        S5        g! [         a  n[        SU 35         SnAgSnAff = f)	zTest model loadingr   r
   zTesting model loading...u   ✓ Model loaded successfullyTu   ✗ Model loading failed: NF)r   r   r   	Exception)r   ragr   s      r   test_model_loadingr      sI    2()l-. *1#./s   #& 
AAAc                  .    SSK Jn   [        S5        U " 5       nSSSS.S.SSS	S.S./nUR                  U5        UR	                  S
SS9n[        U5      S:  a  [        S5        g[        S5        g! [         a  n[        SU 35         SnAgSnAff = f)zTest vector store functionalityr   r   zTesting vector store...z6This is a test document about artificial intelligence.ztest.pdf)sourcechunk_id)contentmetadataz#Machine learning is a subset of AI.   zartificial intelligence   )ku   ✓ Vector store workingTu&   ✗ Vector store not returning resultsFu   ✗ Vector store error: N)r   r	   r   add_documentssearchlenr   )r	   vsdummy_chunksresultsr   s        r   test_vector_storer'   %   s    ,'(] Qis  BC  _D  E=V`noKpq

 	&))5);w<!,-:; (,-s   A#A2 &A2 2
B<BBc                       SSK Jn   [        S5        U " 5       nUR                  5       n[        S[	        U5       S35        g! [
         a  n[        SU 35         SnAg	SnAff = f)
zTest PDF processorr   r   zTesting PDF processor...u!   ✓ PDF processor working (found z
 new PDFs)Tu   ✗ PDF processor error: NF)r   r   r   get_new_pdfsr#   r   )r   	processor	new_filesr   s       r   test_pdf_processorr,   ?   sg    .() N	 **,	1#i.1ALM )!-.s   A A 
A%A  A%c                  B   [        S5        S[        4S[        4S[        4S[        4/n Sn[        U 5      nU  H5  u  p4[        SU S35        U" 5       (       a  US	-  nM'  [        U S
35        M7     [        SU SU S35        X:X  a  [        S5        g[        S5        g	)Nz=== RAG System Test ===ImportszPDF ProcessorzVector StorezModel Loadingr   z	
Running z test...r   z test failedz
=== Test Results: /z tests passed ===u'   🎉 All tests passed! System is ready.u.   ❌ Some tests failed. Check the errors above.)r   r   r,   r'   r   r#   )testspassedtotal	test_name	test_funcs        r   mainr5   N   s    	
#$ 
L!	,-	*+	,-	E FJE %	
9+X./;;aKFYK|,- !& 
 %0A
BC78>?    __main__)__doc__sysospathinsertdirnameabspath__file__r   r   r'   r,   r5   __name__exit r6   r   <module>rC      sv     	 277??277??8#<= >
4: zHHTV r6   