
    ei+                     @    d dl Z d dlmZ ddZddZddZddZddZy)	    N)OllamaEmbeddingFunctionc                      t        j                  dd       t               }  | ddg      }|J t        |      dk(  sJ t	        d |D              sJ y )Nollamaollama not installedreason"Here is an article about llamas...this is another article   c              3   8   K   | ]  }t        |      d k(    yw)i  N)len).0es     i/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/chromadb/test/ef/test_ollama_ef.py	<genexpr>z,test_ollama_default_model.<locals>.<genexpr>   s     1s1v}1s   )pytestimportorskipr   r   allef
embeddingss     r   test_ollama_default_modelr      s^    
)?@	 	"B9;TUVJ!!!z?a1j1111    c                      t        j                  dd       d} t        |       }t        j                  t              5 } |ddg       d d d        d|  d	t        j                        v sJ y # 1 sw Y   'xY w)
Nr   r   r   zunknown-model)
model_namer	   r
   zmodel "z" not foundr   r   r   raises	Exceptionstrvalue)r   r   r   s      r   test_ollama_unknown_modelr!      sw    
)?@ J	 J	7B	y	! NQ
02KLMNZL,AGG<<<N Ns   A00A9c                  f    t        j                  dd       t        d      }  | ddg      }|J y )Nr   r   r   z%http://localhost:11434/api/embeddingsurlr	   r
   )r   r   r   r   s     r   test_ollama_backward_compatr%      s;    
)?@	 %L	MB9;TUVJ!!!r   c                      t        j                  dd       t        d      } t        j                  t              5 } | ddg       d d d        dt        j                        v sJ y # 1 sw Y   #xY w)	Nr   r   r   z$http://localhost:11434/this_is_wrongr#   r	   r
   404r   )r   r   s     r   test_wrong_urlr(   !   sj    
)?@	 %K	LB	y	! NQ
02KLMNCL   N Ns   A**A3c                      	 ddl m}  t        j                  d       t        j
                  t              5 }t                d d d        dt        j                        v sJ y # t        $ r Y Qw xY w# 1 sw Y   2xY w)Nr   )Clientz"ollama python package is installedz*The ollama python package is not installed)
r   r*   r   skipImportErrorr   
ValueErrorr   r   r    )r*   r   s     r   test_ollama_ask_user_to_installr.   )   sl    :! 	89	z	" "a!"73qww<GGG  " "s   A# A2#	A/.A/2A;)returnN)r   <chromadb.utils.embedding_functions.ollama_embedding_functionr   r   r!   r%   r(   r.    r   r   <module>r2      s'    
2="!	Hr   