
    3i                         S SK JrJrJr  S SKrS SKJrJr  S SK	J
r
Jr   " S S\\   5      r " S S\\   5      r\
 " S	 S
\\   5      5       rSS jrSS jrSS jrg)    )EmbeddingFunction
Embeddable
EmbeddingsN)castAny)register_embedding_functionknown_embedding_functionsc                   &    \ rS rSrS\S\4S jrSrg)LegacyCustomEmbeddingFunction
   inputreturnc                 j    [        [        [        R                  " / SQ5      R	                  5       5      $ N         r   r   nparraytolistselfr   s     Y/home/james-whalen/.local/lib/python3.13/site-packages/chromadb/test/ef/test_custom_ef.py__call__&LegacyCustomEmbeddingFunction.__call__   !    J 3 : : <==     N)__name__
__module____qualname____firstlineno__r   r   r   __static_attributes__r    r   r   r   r   
   s    >j >Z >r   r   c                       \ rS rSrS\S\4S jrS\S\SS4S jr\	S\
4S	 j5       r\	S
\\
\4   SS 4S j5       rS\\
\4   4S jrSrg)CustomEmbeddingFunction   r   r   c                 j    [        [        [        R                  " / SQ5      R	                  5       5      $ r   r   r   s     r   r    CustomEmbeddingFunction.__call__   r   r   argskwargsNc                     g Nr    r   r+   r,   s      r   __init__ CustomEmbeddingFunction.__init__       r   c                      g)Ncustom_embedding_functionr    r    r   r   nameCustomEmbeddingFunction.name   s    *r   configc                     [        5       $ r.   )r'   r7   s    r   build_from_config)CustomEmbeddingFunction.build_from_config   s    &((r   c                     0 $ r.   r    r   s    r   
get_config"CustomEmbeddingFunction.get_config       	r   r    r!   r"   r#   r$   r   r   r   r   r0   staticmethodstrr5   dictr:   r>   r%   r    r   r   r'   r'      s    >j >Z >c S T  +# + + )$sCx. )5N ) )DcN r   r'   c                       \ rS rSrS\S\4S jrS\S\SS4S jr\	S\
4S	 j5       r\	S
\\
\4   SS 4S j5       rS\\
\4   4S jrSrg)'CustomEmbeddingFunctionWithRegistration"   r   r   c                 j    [        [        [        R                  " / SQ5      R	                  5       5      $ r   r   r   s     r   r   0CustomEmbeddingFunctionWithRegistration.__call__$   r   r   r+   r,   Nc                     g r.   r    r/   s      r   r0   0CustomEmbeddingFunctionWithRegistration.__init__'   r2   r   c                      g)N+custom_embedding_function_with_registrationr    r    r   r   r5   ,CustomEmbeddingFunctionWithRegistration.name*   s    <r   r7   c                     [        5       $ r.   )rF   r9   s    r   r:   9CustomEmbeddingFunctionWithRegistration.build_from_config.   s     788r   c                     0 $ r.   r    r=   s    r   r>   2CustomEmbeddingFunctionWithRegistration.get_config4   r@   r   r    rA   r    r   r   rF   rF   "   s    >j >Z >c S T  =# = = 9S#X9	29 9
DcN r   rF   c                     [        5       n U " S/5      n[        U[        5      (       d   S5       e[        U5      S:X  d   S5       e[        US   [        R
                  5      (       d   S5       e[        R                  " / SQ[        R                  S9n[        R                  " US   U5      (       d   S	US    S
U 35       eg NtestzResult should be a listr   z)Result should contain exactly one elementr   z&Result element should be a NumPy arrayr   )dtypezArrays not equal: z vs )	r   
isinstancelistlenr   ndarrayr   float32array_equalefresultexpecteds      r   test_legacy_custom_efra   8   s    	&	(B\F fd##>%>>#v;!HHHfQi,,V.VV, xx	4H>>q	8  6	F1I;d8*56 r   c                     [        5       n U " S/5      n[        U[        5      (       d   S5       e[        U5      S:X  d   S5       e[        US   [        R
                  5      (       d   S5       e[        R                  " / SQ[        R                  S9n[        R                  " US   U5      (       d   S	US    S
U 35       eg rT   )	r'   rW   rX   rY   r   rZ   r   r[   r\   r]   s      r   test_custom_efrc   H   s    	 	"B\F fd##>%>>#v;!HHHfQi,,V.VV,xx	4H>>q	8  6	F1I;d8*56 r   c                  L    S[         ;  d   eS[         ;  d   eS[         ;   d   eg )N legacy_custom_embedding_functionr4   rM   )r	   r    r   r   test_custom_ef_registrationrf   W   s1     .5NNNN&.GGGG8<UUUUr   )r   N)chromadb.api.typesr   r   r   numpyr   typingr   r   "chromadb.utils.embedding_functionsr   r	   r   r'   rF   ra   rc   rf   r    r   r   <module>rk      sk    H H  >$5j$A >
/
; & .?
.K  *6 6Vr   