Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
configuration.cpython-313.pyc110 linesDownload Raw Back to __pycache__
1�

2��j�<���SSKJr SSKrSSKJr SSKJrJrJrJ	r	J3r4JrJrJ
r
Jr SSKJr SSKJr SSKJr "SS	\5r"S5S\5r\\\\\S4r"S
S\5r"SS5r"SS5r \
"SSS9r!"SS\S5r""SS\"5r#"SS\#5r$\$r%"SS\"5r&"SS\&5r'\'r("SS\"5r)g) �)�abstractmethodN)�override)	�Any�ClassVar�Dict�List�Optional�Protocol�Union�TypeVar�cast)�Self)�	cpu_count)�JSONSerializablec��\rSrSrSrSrg)�StaticParameterError�z?Represents an error that occurs when a static parameter is set.�N��__name__�6__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r��`D:\code\apps\devtools\python\user_packages\Python313\site-packages\chromadb/api/configuration.pyrrs��I�rrc��\rSrSrSrSrg)�InvalidConfigurationError�z@Represents an error that occurs when a configuration is invalid.rNrrrrrrs��J�rr�ConfigurationInternalc�4�\rSrSrSr\S\S\4Sj5rSr	g)�ParameterValidator�&z+Represents an abstract parameter validator.�value�returnc��[5e)z)Returns whether the given value is valid.)�NotImplementedError)�selfr%s  r�__call__�ParameterValidator.__call__)s
��"�#�#rrN)7rrrrrr�ParameterValue�boolr*rrrrr#r#&s%��5��$�n�$��$��$rr#c�\�\rSrSr%Sr\\S'\\S'\\S'\	\S'S\S\S\S\	4Sjr8Srg	)9�ConfigurationDefinition�/z-Represents the definition of a configuration.�name�	validator�	is_static�
default_valuec�4�XlX lX0lX@lg�N�r1r2r3r4)r)r1r2r3r4s     r�__init__� ConfigurationDefinition.__init__7s���	�"��"��*�r)r4r3r1r2N)rrrrr�str�__annotations__r#r-r,r8rrrrr/r//sF��7�10
�I�!�!��O�!�!�11+��12+�&�13+��	14+�15&�16+rr/c�`�\rSrSr%Sr\\S'\\S'S\S\4SjrS\4Sjr	S\17S\4S	jrS18r
g)�ConfigurationParameter�Dz*Represents a parameter of a configuration.r1r%c��XlX lgr6�r1r%)r)r1r%s   rr8�ConfigurationParameter.__init__Js���	��19rr&c�<�SURSURS3$)NzConfigurationParameter(z, �)r@�r)s r�__repr__�ConfigurationParameter.__repr__Ns��(�����2�d�j�j�\��C�Cr�_ConfigurationParameter__valuec��[U[5(d[$URUR:H=(a URUR:H$r6)�20isinstancer=�NotImplementedr1r%)r)rGs  r�__eq__�ConfigurationParameter.__eq__Qs;���'�#9�:�:�!�!��y�y�G�L�L�(�H�T�Z�Z�7�=�=�-H�Hrr@N)rrrrrr:r;r,r8rE�objectr-rKrrrrr=r=DsG��4�21
�I����S����D�#�D�I�f�I��Irr=�T)�boundc�t�\rSrSr%Sr\\\4\S'\	\\\224\S'SS\\\4Sjjr
S\4S	jrS23\S\4Sjr\SSj5rS\\4S
jrS\S\4SjrS\S\\\\\4SS4Sjr\S\4Sj5r\\S\S\4Sj55r\S\\\44Sj5r \\S\\\4S\4Sj55r!Sr"g)r!�Zz@Represents an abstract configuration, used internally by Chroma.�
parameter_map�definitionsN�24parametersc���0UlUGb|UGHunURUR;a[SUR35eURURn[	UR25[5(an[5RUR26RSS55nUc[SUR2735eURUR285Ul[	UR29[UR55(d[SUR3035eURnU"UR315(d[SUR3235eX RUR'GMx URR5H6upcX`R;dM[XcRS9URU'M8 UR5 g)zZInitializes a new instance of the Configuration class. Respecting defaults and33validators.N�Invalid parameter name: �_typezInvalid configuration type: zInvalid parameter value: r@)rRr1rS�34ValueErrorrIr%�dict�globals�get�	from_json�typer4r2�itemsr=�configuration_validator)r)rT�	parameter�35definition�36child_type�parameter_validatorr1s       rr8�ConfigurationInternal.__init__bs��� ����!�'�	��>�>��)9�)9�9�$�'?�	���?O�%P�Q�Q�!�-�-�i�n�n�=�37��i�o�o�t�4�4�!(����y���/B�/B�7�D�/Q�!R�J�!�)�(�:�9�?�?�:K�L���'1�&:�&:�9�?�?�&K�I�O�!�)�/�/�4�38�8P�8P�3Q�R�R�$�'@����@Q�%R�S�S�&0�&:�&:�#�*�9�?�?�;�;�$�'@����@Q�%R�S�S�5>�"�"�9�>�>�2�'(�*!%� 0� 0� 6� 6� 8��D��-�-�-�+A��%=�%=�,��"�"�4�(�!9�	
�$�$�&rr&c�>�SURR5S3$)NzConfiguration(rC)rR�valuesrDs rrE�ConfigurationInternal.__repr__�s!���� 2� 2� 9� 9� ;�<�A�>�>r�_ConfigurationInternal__valuec�j�[U[5(d[$URUR:H$r6)rIr!rJrR)r)rhs  rrK�ConfigurationInternal.__eq__�s-���'�#8�9�9�!�!��!�!�W�%:�%:�:�:rc��g)z�Perform custom validation when parameters are dependent on each other.39 40Raises an InvalidConfigurationError if the configuration is invalid.41NrrDs rr_�-ConfigurationInternal.configuration_validator�s��	
rc�H�[URR55$)z,Returns the parameters of the configuration.)�listrRrfrDs r�get_parameters�$ConfigurationInternal.get_parameters�s���D�&�&�-�-�/�0�0rr1c���XR;a%[SUSURR35e[	[42URR
U55nU$)zIReturns the parameter with the given name, or except if it doesn't exist.rVz for configuration )rRrX�	__class__rr
r=r[)r)r1�param_values   r�
get_parameter�#ConfigurationInternal.get_parameter�s]���)�)�)��*�4�&�0C�D�N�N�D[�D[�C\�]��
��1�4�3E�3E�3I�3I�$�3O�P���rr%c��XR;a[SU35eURUnURUnUR(a[	SU35eURU5(d[SUSU35eX$lg)z:Sets the parameter with the given name to the given value.rVzCannot set static parameter: zInvalid value for parameter z: N)rSrXrRr3rr2r%)r)r1r%rar`s     r�
set_parameter�#ConfigurationInternal.set_parameter�s����'�'�'��7��v�>�?�?��%�%�d�+�43��&�&�t�,�	����&�)F�t�f�'M�N�N��#�#�E�*�*��;�D�6��E�7�K�L�L��rc�J�[R"UR55$)z5Returns the JSON representation of the configuration.)�json�dumps�to_jsonrDs r�to_json_str�!ConfigurationInternal.to_json_str�s���z�z�$�,�,�.�)�)r�json_strc��[R"U5nU(aUR	U5$U"5$![Ra [SU35ef=f)�3Returns a configuration from the given JSON string.z1Unable to decode configuration from JSON string: )rz�loads�JSONDecodeErrorrXr\)�clsr�config_jsons   r�
from_json_str�#ConfigurationInternal.from_json_str�s]��	��*�*�X�.�K�44.9�s�}�}�[�)�C�c�e�C��	�#�#�	��C�H�:�N��
�	�s	�7�#Ac	�(�URR5VVs0sHKupU[UR[5(aURR5OUR_MM nnnURRUS'U$s snnf)zKReturns the JSON compatible dictionary representation of the configuration.rW)rRr^rIr%r!r|rrr)r)r1r`�	json_dicts    rr|�ConfigurationInternal.to_json�s���$(�#5�#5�#;�#;�#=�	45�$>���
��)�/�/�+@�A�A��/�/�)�)�+����
!�$>�		�46�"�^�^�4�4�	�'�����47s�AB�json_mapc��URURSS5:wa[SURSUS35e/nUR5H%up4US:XaM
UR	[X4S95 M' U"US9$)r�rWNz,Trying to instantiate configuration of type z from JSON with type r@�rT)rr[rXr^�appendr=)r�r�rTr1r%s     rr\�ConfigurationInternal.from_json�s����<�<�8�<�<���6�6��>�s�|�|�n�La�bj�kr�bs�at�u��
��48�#�>�>�+�K�D��w������4�$�L�M�	,�49�j�)�)r)rRr6�r&N)#rrrrrrr:r=r;rr/r	rr8rErMr-rKrr_rortr�int�floatrwrr}�classmethodrr�rr|r\rrrrr!r!Zse��J���3�3�4�4��$�s�$;�;�<�=�=� '�8�D�1G�,H�#I� '�D?�#�?�;�f�;��;�50�
��
�1��%;� <�1��#��*@��51 �#�52 �e�C��e�T�4I�.J�53 �t�54 ��*�S�*��*��
�D�S�D�T�D���D��55��c�3�h��56��57��
�*��c�3�h��*�D�*���*rc���\rSrSrSr\"SSSSS9\"SS	SS58S9\"SSS
S59S9\"SSS
\"5S9\"SSSSS9\"SSSSS9\"SSSS60S9\"SSSSS9S.r\S"Sj5r	\61S\\\
4S\4S j5rS!rg)#�HNSWConfigurationInternal��ztInternal representation of the HNSW configuration.62Used for validation, defaults, serialization and deserialization.�spacec�:�[U[5=(a US;$)N)�l2�ip�cosine)rIr:�r%s r�<lambda>�"HNSWConfigurationInternal.<lambda>�s��J�u�c�$:�%0��/�/�%0rTr�r7�ef_constructionc�:�[U[5=(a US:�$�N��rIr�r�s rr�r�����J�u�c�$:�$I�u��z�$Ir�d�	ef_searchc�:�[U[5=(a US:�$r�r�r�s rr�r��r�rF�num_threadsc�:�[U[5=(a US:�$r�r�r�s rr�r��r�r�Mc�:�[U[5=(a US:�$r�r�r�s rr�r��r�r��
resize_factorc�:�[U[5=(a US:�$r�)rIr�r�s rr�r�s��J�u�e�$<�$K��!��$Kr�333333�?�63batch_sizec�:�[U[5=(a US:�$r�r�r�s rr�r�r�r�sync_thresholdc�:�[U[5=(a US:�$r�r�r�s rr�r�r�r��)r�r�r�r�r�r�r�r�r&Nc��URRS5nURRS5nU(aJU(aB[[UR5[[UR5:�a[S5eggg)Nr�r�z7batch_size must be less than or equal to sync_threshold)rRr[r
r�r%r)r)r�r�s   rr_�1HNSWConfigurationInternal.configuration_validatorsy���'�'�+�+�L�9�64��+�+�/�/�0@�A��
���S�*�*�*�+�d�3��8L�8L�.M�M�+�I��
�N��
r�paramsc	��SSSSSSSSS	.n/nUR5H3upEXB;a[S65U35eUR[X$US95 M5 U"U5$)zhReturns an HNSWConfiguration from a metadata dict containing legacy HNSW parameters. Used for migration.r�r�r�r�r�r�r�r�)z66hnsw:spacezhnsw:construction_efzhnsw:search_efzhnsw:Mzhnsw:num_threadszhnsw:resize_factorzhnsw:batch_sizezhnsw:sync_thresholdz$Invalid legacy HNSW parameter name: r@)r^rXr�r=)r�r��67old_to_newrTr1r%s      r�from_legacy_params�,HNSWConfigurationInternal.from_legacy_params"s|��"�$5�)�� -�"1�+�#3�	68�69��70�!�<�<�>�K�D��%� �#G��v�!N�O�O����&�J�,<�E�J�
�*��:��rrr�)rrrrrr/rrSrr_r�rr:rrr�rrrrr�r��s��I�)��0���71�3�"�I���	72�-��I���	73�/��I��#�+�	74�%��I���	75�1� �K���	76�.��I���	77�2�!�I���	78�Y2�K�h�������S�#�X���4���rr�c�n^�\rSrSrSrSSS\"5SSSS4S\S	\S79\S\S\S
\S\S\4U4Sjjjr	Sr80U=r$)�HNSWConfigurationInterfaceiBz�HNSW index configuration parameters.81See https://docs.trychroma.com/guides#changing-the-distance-function for more information.82r�r�r�r�r�r�r�r�r�r�r�r�r�c	�>�[SUS9[SUS9[SUS9[SUS9[SUS9[SUS9[SUS9[S	US9/n	[T83U]	U	S849 g)Nr�r@r�r�r�r�r�r�r�r�)r=�superr8)r)r�r�r�r�r�r�r�r�rTrrs          �rr8�#HNSWConfigurationInterface.__init__Gsp���
#��u�=�"�(9��Q�"��9�E�"�
�[�I�"��1�5�"��}�M�"��J�G�"�(8��O�	85�86�	���J��/rr)rrrrrrr:r�r�r8r�
__classcell__�rrs@rr�r�Bs|�����"��$�;��"��"�0��0��0��	0�87�0��
0��0��0��0�0rr�c�N�\rSrSrSrS\"SSS\"5S90r\S88Sj5r	S	r89g)�CollectionConfigurationInternalidz|Internal representation of the collection configuration.90Used for validation, defaults, and serialization / deserialization.�hnsw_configurationc�"�[U[5$r6)rIr�r�s rr��(CollectionConfigurationInternal.<lambda>ks��J�u�6O�$PrTr7Nc��gr6rrDs rr_�7CollectionConfigurationInternal.configuration_validatorq���rrr�)rrrrrr/r�rSrr_rrrrr�r�ds?��K�	�5�%�P��3�5�	91��K��
��
rr�c�:^�\rSrSrSrS\\4U4SjjrSrU=r	$)� CollectionConfigurationInterfaceizz3Configuration parameters for creating a collection.r�c�P>�Uc92[5n[SUS9/n[TU]
US9 g)z�Initializes a new instance of the CollectionConfiguration class.93Args:94    hnsw_configuration: The HNSW configuration to use for the collection.95Nr�r@r�)r�r=r�r8)r)r�rTrrs   �rr8�)CollectionConfigurationInterface.__init__}s9���96�%�!:�!<��"�(<�DV�W�97�98�	���J��/rr)99rrrrrr	r�r8rr�r�s@rr�r�zs���=�1000�8�4M�+N�1010�1020rr�c�@�\rSrSrS\"SSSSS90r\S103Sj5rS	rg)�$EmbeddingsQueueConfigurationInternali��automatically_purgec�"�[U[5$r6)rIr-r�s rr��-EmbeddingsQueueConfigurationInternal.<lambda>�s��J�u�d�$;rFTr7Nc��gr6rrDs rr_�<EmbeddingsQueueConfigurationInternal.configuration_validator�r�rrr�)	rrrrr/rSrr_rrrrr�r��s4���6�&�;���	 104��K��
��
rr�)*�abcrrz�	overridesr�typingrrrrr	r105rrr
�typing_extensionsr�multiprocessingr�chromadb.serder�	ExceptionrrXrr:r�r�r-r,r#r/r=rNr!r�r��HNSWConfigurationr�r��CollectionConfigurationr�rrr�<module>r�s������106�107�108�#�%�+�109	�9�	�	�110�	��s�C���.E�E�F��$��$�+�+�*I�I�&�C�.�/��*�,�-D�E�*�D_� 5�_�L0�!:�0�>/��
�&;�
�,
0�'F�
0�";��
�+@�
r
codekingpro/portable-devtools · Team Ai