
    3i+                     J    S SK r S SKJr  SS jrSS jrSS jrSS jrSS jrg)	    N)OllamaEmbeddingFunctionc                      [         R                  " SSS9  [        5       n U " SS/5      nUc   e[        U5      S:X  d   e[	        S U 5       5      (       d   eg )Nollamaollama not installedreason"Here is an article about llamas...this is another article   c              3   >   #    U  H  n[        U5      S :H  v   M     g7f)i  N)len).0es     Y/home/james-whalen/.local/lib/python3.13/site-packages/chromadb/test/ef/test_ollama_ef.py	<genexpr>,test_ollama_default_model.<locals>.<genexpr>   s     1js1v}js   )pytestimportorskipr   r   allef
embeddingss     r   test_ollama_default_modelr      sa    
)?@	 	"B9;TUVJ!!!z?a1j11111    c                      [         R                  " SSS9  Sn [        U S9n[         R                  " [        5       nU" SS/5        S S S 5        SU  S	3[        WR                  5      ;   d   eg ! , (       d  f       N.= f)
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"      sl    
)?@ J	 J	7B	y	!Q
02KLM 
"ZL,AGG<<< 
"	!s   A..
A<c                  ^    [         R                  " SSS9  [        SS9n U " SS/5      nUc   eg )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                      [         R                  " SSS9  [        SS9n [         R                  " [        5       nU " SS/5        S S S 5        S[        WR                  5      ;   d   eg ! , (       d  f       N*= f)	Nr   r   r   z$http://localhost:11434/this_is_wrongr$   r	   r
   404r   )r   r   s     r   test_wrong_urlr)   !   s_    
)?@	 %K	LB	y	!Q
02KLM 
"CL    
"	!s   A((
A6c                      SSK Jn   [        R                  " S5        [        R
                  " [        5       n[        5         S S S 5        S[        WR                  5      ;   d   eg ! [         a     NUf = f! , (       d  f       N:= f)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/   )   se    :! 	89	z	"a! 
#73qww<GGG   
#	"s   A' A7'
A43A47
B)returnN)r   <chromadb.utils.embedding_functions.ollama_embedding_functionr   r   r"   r&   r)   r/    r   r   <module>r3      s'    
2="!	Hr   