� ���gJD����UddlZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z m Z mZmZmZddl mZmZmZddlmZddlmZdd lmZddlZd Z dd lmZn#e$rd Zdd lmZdd lmZYnwxYwesdd lmZd Z ddl!m Z n #e$rd Z YnwxYwej"e#��Z$dZ%dhZ&hd�Z'idd�dd�dd�dd�dd�dd�dd�dd�d d!�d"d#�d$d%�d&d'�d(d)�d*d+�d,d-�d.d/�d0d1�Z(e e)e)fe*d2<d3Z+d4Z,Gd5�d6e)e��Z-Gd7�d8e��Z.ed9d:�;��Z/Gd<�d:ee��Z0Gd=�d>e0��Z1ed?��Z2d@e)dAee2dBee2fdC�Z3dDee4dBe)fdE�Z5dS)F�N)�ABC)�Enum)�TopologicalSorter)�Optional�List�Any�Dict�Set�Iterable�Union)�Type�TypeVar�cast)�EnforceOverrides)�override)�LiteralF)� BaseSettingsT)� validator)�is_thin_clientaYou are using a deprecated configuration of Chroma. If you do not have data you wish to migrate, you only need to change how you construct your Chroma client. Please see the "New Clients" section of https://docs.trychroma.com/deployment/migration. ________________________________________________________________________________________________ If you do have data you wish to migrate, we have a migration tool you can use in order to migrate your data to the new Chroma architecture. Please `pip install chroma-migrate` and run `chroma-migrate` to migrate your data and then change how you construct your Chroma client. See https://docs.trychroma.com/deployment/migration for more information or join our discord at https://discord.gg/MMeYNTmh3x for help!�chroma_db_impl> �duckdb+parquet�chromadb.db.duckdb.DuckDB�chromadb.api.local.LocalAPI�!chromadb.db.clickhouse.Clickhouse�#chromadb.db.duckdb.PersistentDuckDB�rest�local�duckdb� clickhousezchromadb.api.API�chroma_api_implzchromadb.api.ServerAPIz%chromadb.api.async_api.AsyncServerAPIz chromadb.auth.ClientAuthProvider�chroma_client_auth_providerz*chromadb.auth.ServerAuthenticationProvider�chroma_server_authn_providerz)chromadb.auth.ServerAuthorizationProvider�chroma_server_authz_providerzchromadb.db.system.SysDB�chroma_sysdb_implz-chromadb.execution.executor.abstract.Executor�chroma_executor_implzchromadb.ingest.Consumer�chroma_consumer_implzchromadb.ingest.Producer�chroma_producer_implzchromadb.quota.QuotaEnforcer�chroma_quota_enforcer_implz%chromadb.rate_limit.RateLimitEnforcer�chroma_rate_limit_enforcer_implz*chromadb.rate_limit.AsyncRateLimitEnforcer�%chroma_async_rate_limit_enforcer_implzchromadb.segment.SegmentManager�chroma_segment_manager_implz-chromadb.segment.distributed.SegmentDirectory�chroma_segment_directory_implz/chromadb.segment.distributed.MemberlistProvider�chroma_memberlist_provider_implz1chromadb.telemetry.product.ProductTelemetryClient�chroma_product_telemetry_impl�_abstract_type_keys�default_tenant�default_databasec��eZdZdZdZdS)� APIVersionz/api/v1z/api/v2N)�__name__� __module__� __qualname__�V1�V2���_/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/chromadb/config.pyr3r3`s������ �B� �B�B�Br:r3c ���eZdZUdZeed<dZeed<edddd���ded eefd ���Z d Z ee ed<d Z e ed <dZ eed<dZeed<d Zeeed<d Zeeeefed<d Zee ed<dZeeed<d Zeeeefed<ejZeeed<gZeeed<dZeed<dZeed<dZe ed<d Zeeed<dZ eed<d Z!eeed <d Z"eeed!<d Z#eeed"<ej�d#gej�d$�d#gej�d%�d#gej$�d#gej$�d$�d#gej$�d%�d#giZ%eeeefed&<dZ&eed'<d Z'eeed(<d Z(eeed)<d Z)eeed*<d Z*eeed+<d Z+eeed,<d Z,eeed-<d.Z-eed/<e-Z.eed0<dZ/eed1<dZ0eeed2<d3Z1eeed4<iZ2eeefed5<d Z3eeed6<d7Z4e5d8ed9<d:Z6e5d;ed<<d=Z7eed><d?Z8eed@<dAZ9eedB<dCZ:d Z;ee edD<dEZ<eedF<dEZ=eedG<dEZ>eedH<dIZ?eedJ<dKZ@eedL<dCZAdMZBd ZCeeedN<d ZDeeedO<dPZEeedQ<dRZFeedS<dTZGeedU<dVZHe edW<dVZIe edX<dYZJe edZ<d ZKeeed[<d\ZLeed]<d^ed eMfd_�ZNd^ed eMfd`�ZOGda�db��ZPd S)c�Settings�� environmentzchromadb.api.segment.SegmentAPIr �chroma_server_nofileT)�pre�always� allow_reuse�v�returnc�f�t|��tur|���dkrdS|S)Nr>)�type�str�strip)�clsrDs r;�empty_str_to_nonezSettings.empty_str_to_noneos+�� ��7�7�c�>�>�a�g�g�i�i�2�o�o��4��r:N�(�chroma_server_thread_pool_size�default� tenant_id�topic_namespace�chroma_server_host�chroma_server_headers�chroma_server_http_portF�chroma_server_ssl_enabled�chroma_server_ssl_verify�chroma_server_api_default_path� chroma_server_cors_allow_origins� is_persistentz./chroma�persist_directoryr�chroma_memory_limit_bytes�chroma_segment_cache_policy� allow_reset�"chroma_auth_token_transport_headerr!�chroma_client_auth_credentials�GETz /heartbeatz/version�chroma_server_auth_ignore_paths�;chroma_overwrite_singleton_tenant_database_access_from_authr"�chroma_server_authn_credentials�$chroma_server_authn_credentials_filer#�chroma_server_authz_config�chroma_server_authz_config_filez*chromadb.telemetry.product.posthog.Posthogr.�chroma_telemetry_impl�anonymized_telemetry�chroma_otel_collection_endpoint�chromadb�chroma_otel_service_name�chroma_otel_collection_headers�chroma_otel_granularity�apply)�none�validaterm� migrations�md5)rq�sha256�migrations_hash_algorithmzRchromadb.segment.impl.distributed.segment_directory.RendezvousHashSegmentDirectoryr,zTchromadb.segment.impl.distributed.segment_directory.CustomResourceMemberlistProviderr-zquery-service-memberlist�worker_memberlist_name� localhost�chroma_server_grpc_portz chromadb.db.impl.sqlite.SqliteDBr$r'r&z7chromadb.segment.impl.manager.local.LocalSegmentManagerr+z/chromadb.execution.executor.local.LocalExecutorr%i���chroma_quota_provider_impl�"chroma_rate_limiting_provider_implz8chromadb.quota.simple_quota_enforcer.SimpleQuotaEnforcerr(z=chromadb.rate_limit.simple_rate_limit.SimpleRateLimitEnforcerr)zBchromadb.rate_limit.simple_rate_limit.SimpleAsyncRateLimitEnforcerr*��)chroma_logservice_request_timeout_seconds�$chroma_sysdb_request_timeout_seconds�<�$chroma_query_request_timeout_secondsrz9chromadb.ingest.impl.simple_policy.SimpleAssignmentPolicy�(chroma_collection_assignment_policy_impl�keyc�@�||}|�td|�d����|S)zYReturn the value of a required config key, or raise an exception if it is not setNzMissing required config value '�')� ValueError��selfr�vals r;�requirezSettings.requires1���3�i�� �;��E�s�E�E�E�F�F� F�� r:c��t||��}t|t��r|tvrt t ���|S�N)�getattr� isinstancerH�_legacy_config_valuesr�� LEGACY_ERRORr�s r;� __getitem__zSettings.__getitem__%sA���d�C� � �� �c�3� � � +�C�+@�$@�$@��\�*�*� *�� r:c��eZdZdZdZdS)�Settings.Configz.envzutf-8N)r4r5r6�env_file�env_file_encodingr9r:r;�Configr�,s��������#���r:r�)Qr4r5r6r?rH�__annotations__r rrrKr@�intrMrOrPrQrRr rSrT�boolrUr r3r8rVrWrrXrYrZr[r\r]r!r^r7r`rar"rbrcr#rdrer.rfrgrhrjrkrlrprrsr,r-rt�chroma_coordinator_hostrvr$r'r&r+r%�chroma_logservice_host�chroma_logservice_portrwrxr(r)r*rzr{r}rr~rr�r�r�r9r:r;r=r=es ������� �K�����=�O�S�<�<�<��Y�%�4��$�O�O�O��#��(�3�-����P�O�� +/��(�3�-�.�.�.�*,�"�C�,�,�,� �I�s����$�O�S�$�$�$�(,���� �,�,�,�6:��8�D��c��N�3�:�:�:�-1��X�c�]�1�1�1�05��x��~�5�5�5�;?��h�u�T�3�Y�'7�8�?�?�?�;E�=�"�H�Z�$8�H�H�H�24�$�d�3�i�4�4�4�  �M�4����'��s�'�'�'�%&��s�&�&�&�15���#��5�5�5��K�����9=�&��� �<�<�<�26���#��5�5�5�59�"�H�S�M�8�8�8� �=��U�G� �=�$�$�$�u�g� �=�"�"�"�U�G� �=��U�G� �=�$�$�$�u�g� �=�"�"�"�U�G� =�#�T�#�t�C�y�.�%9����IN�?��M�M�M� 37� �(�3�-�6�6�6�59�#�X�c�]�9�9�9�:>�(�(�3�-�>�>�>� 37� �(�3�-�6�6�6�04���� �4�4�4�59�#�X�c�]�9�9�9� *V�!�3�U�U�U�!>��3�>�>�>�!%��$�%�%�%�57�#�X�c�]�7�7�7�.8��h�s�m�8�8�8�57�"�D��c��N�7�7�7�-1��X�c�]�1�1�1� 8?�J��3�4�>�>�>�;@��w��7�?�?�?� *~�!�3�}�}�}�,B�#�S�B�B�B�"<��C�<�<�<�)��-1��X�c�]�1�1�1�?��s�?�?�?� B��#�B�B�B� B��#�B�B�B� B� �����!R��#�Q�Q�Q�(��"��04���� �4�4�4�8<�&��� �<�<�<� C������ H�$�S���� M�*�3����67�-�s�6�6�6�01�(�#�1�1�1�02�(�#�2�2�2� %)�N�H�S�M�(�(�(�C�-�c�����3��3������s��s�����$�$�$�$�$�$�$�$�$�$r:r=�T� Component)�boundc��eZdZUeded<ded<eed<dd�Zdeedefd �Z dedfd �Z dd �Z dd �Z dd�Z d S)r�� _dependencies�System�_system�_running�systemc�H�t��|_||_d|_dS)NF)�setr�r�r�)r�r�s r;�__init__zComponent.__init__9s �� �U�U����� ��� � � r:rGrEc�n�|j�|��}|j�|��|S)zbGet a Component instance of the given type, and register as a dependency of that instance.)r��instancer��add)r�rG�insts r;r�zComponent.require>s5���|�$�$�T�*�*�� ����t�$�$�$�� r:c��|jS)z<Return the full set of components this component depends on.)r��r�s r;� dependencieszComponent.dependenciesEs ���!�!r:Nc�b�t�d|jj����d|_dS)zWIdempotently stop this component's execution and free all associated resources.zStopping component FN��logger�debug� __class__r4r�r�s r;�stopzComponent.stopIs/�� � � �D�4�>�+B�D�D�E�E�E��� � � r:c�b�t�d|jj����d|_dS)z-Idempotently start this component's executionzStarting component TNr�r�s r;�startzComponent.startOs-��� � �D�4�>�+B�D�D�E�E�E��� � � r:c�T�t�d|jj����dS)zgReset this component's state to its initial blank state. Only intended to be called from tests.zResetting component N)r�r�r�r4r�s r;� reset_statezComponent.reset_stateTs*�� � � �E�D�N�,C�E�E�F�F�F�F�Fr:)r�r��rEN)r4r5r6r r�r�r�r r�r�r�r�r�r�r9r:r;r�r�4s���������{�#�#�#�#� �����N�N�N����� �D��G�������"�c�+�.�"�"�"�"����� ���� G�G�G�G�G�Gr:c����eZdZUeed<eeeefed<def�fd� Zdee de fd�Z de efd�Z e d �fd � ��Ze d �fd � ��Ze d d ���Z�xZS) r��settings� _instancesc ����tr|ddvrtd���tD]}||�tt����|d�L|ddkr@t �d��|ddkrt �d ��|d ��tj��d kr�ddl }|� |j ��\}}|d }||krtj d |�d |����n�||krv |�|j ||f��t �d|����n|#t $r-}t �d|�d|�d|����Yd}~nJd}~wwxYw||kr!t � d|�d|�d���nt � d��||_i|_t'���|��dS)Nr )zchromadb.api.fastapi.FastAPIz'chromadb.api.async_fastapi.AsyncFastAPIaChroma is running in http-only client mode, and can only be run with 'chromadb.api.fastapi.FastAPI' or 'chromadb.api.async_fastapi.AsyncFastAPI' as the chroma_api_impl. see https://docs.trychroma.com/guides#using-the-python-http-only-client for more information.r[�LRUzAFailed to set chroma_segment_cache_policy: Only LRU is available.rZrzPFailed to set chroma_segment_cache_policy: chroma_memory_limit_bytes is require.r@�WindowszUchroma_server_nofile cannot be set to a value greater than the current hard limit of z. Keeping soft limit at zSet chroma_server_nofile to z&Failed to set chroma_server_nofile to z: z" nofile soft limit will remain at zchroma_server_nofile is set to z., but this is less than current soft limit of z'. chroma_server_nofile will not be set.zWchroma_server_nofile is not supported on Windows. chroma_server_nofile will not be set.)r� RuntimeError�_legacy_config_keysr�r�r��error�platformr��resource� getrlimit� RLIMIT_NOFILE�logging�warning� setrlimit�info� Exceptionr�r��superr�) r�r�rr�� curr_soft� curr_hard� desired_soft�er�s �r;r�zSystem.__init__^s���� � ��)�*�3���#�k���� '� /� /�C���}�(� ��.�.�.�)� �2� 3� ?��6�7�5�@�@� �L�L�S� � � ��3�4��9�9�� � �f���� �*� +� 7��� � �I�-�-�����'/�'9�'9�(�:P�'Q�'Q�$� �9�'�(>�?� ��)�+�+��O�_�py�_�_�T]�_�_�����"�I�-�-�� �*�*�$�2�\�9�4M����� � �$Q�<�$Q�$Q�R�R�R�R��$����� � �F�\�F�F�UV�F�F�{D�F�F����������������� "�I�-�-��N�N�i�,�i�i�v�i�i�i��������m����!�� ���� ����������s� :E� E?�#E:�:E?rGrEc��tj|��rat|��}|tvrt d|�����t|}|j�|��}t||��}||jvr0||��}||j|<|j r|� ��|j|}tt|��S)z|Return an instance of the component type specified. If the system is running, the component will be started as well.z"Cannot instantiate abstract type: ) �inspect� isabstract�get_fqnr/r�r�r�� get_classr�r�r�rr�)r�rG�type_fqnr�fqn�implr�s r;r�zSystem.instance�s��� � �d� #� #� (��t�}�}�H��2�2�2� �!L�d�!L�!L�M�M�M�%�h�/�C��-�'�'��,�,�C��S�$�'�'�D� �t�� &� &��4��:�:�D�$(�D�O�D� !��}� �� � � � � ���t�$���A�t�}�}�r:c��t��}|j���D]"}|j|g|����R��#|���S)zYReturn the full set of all components and their dependencies in dependency order.)rr��valuesr�r�� static_order)r��sorter� components r;� componentszSystem.components�sh��0A�/B�/B����/�/�1�1� =� =�I� �F�J�y� <�9�#9�#9�#;�#;� <� <� <� <� <��"�"�$�$�$r:Nc���t�����|���D]}|����dSr�)r�r�r��r�r�r�s �r;r�z System.start�sJ��� ��� � �������*�*� � �I� �O�O� � � � � � r:c����t�����tt|�������D]}|����dSr�)r�r��reversed�listr�r�s �r;r�z System.stop�sZ��� ��� � ����!�$�t���'8�'8�"9�"9�:�:� � �I� �N�N� � � � � � r:c���|jjstd���tt |�������D]}|����dS)zOReset the state of this system and all constituents in reverse dependency orderz�Resetting is not allowed by this configuration (to enable it, set `allow_reset` to `True` in your Settings() or include `ALLOW_RESET=TRUE` in your environment variables)N)r�r\r�r�r�r�r�)r�r�s r;r�zSystem.reset_state�ss���}�(� ��|��� �"�$�t���'8�'8�"9�"9�:�:� $� $�I� � !� !� #� #� #� #� $� $r:r�)r4r5r6r=r�r r r�r�r�r�r r�rr�r�r�� __classcell__)r�s@r;r�r�Zs'�������������T�)�_�i�/�0�0�0�0�?��?�?�?�?�?�?�B�T�!�W�������*%�H�Y�/�%�%�%�%��������X�� �������X�� �$�$�$��X�$�$�$�$�$r:r��Cr�rGrEc��|�dd��\}}tj|��}t||��}t t t |��S)zIGiven a fully qualifed class name, import the module and return the class�.�)�rsplit� importlib� import_moduler�rr r�)r�rG� module_name� class_name�modulerJs r;r�r��sM��!�j�j��a�0�0��K�� � $�[� 1� 1�F� �&�*� %� %�C� ��Q��� � �r:rJc�$�|j�d|j��S)z.Given a class, return its fully qualified namer�)r5r4)rJs r;r�r��s���n� -� -�s�|� -� -�-r:)6r�r�r��abcr�enumr�graphlibr�typingrrrr r r r r rr� overridesrr�typing_extensionsrr��in_pydantic_v2�pydanticr� ImportError� pydantic.v1rr�chromadb.is_thin_client� getLoggerr4r�r�r�r�r/rHr��DEFAULT_TENANT�DEFAULT_DATABASEr3r=r�r�r�r�r��objectr�r9r:r;�<module>r�sO���������������������������&�&�&�&�&�&�B�B�B�B�B�B�B�B�B�B�B�B�B�B�B�B�B�B�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�&�������%�%�%�%�%�%�������&�%�%�%�%�%�%�%���&�&�&��N�(�(�(�(�(�(�%�%�%�%�%�%�%�%�&���� �#�"�"�"�"�"�"����6�6�6�6�6�6�6�������N�N�N����� �� �8� $� $�� R� ���� � � �� '��)� '� �/� '� ,�->� '�'�(E�'�1�2P�'�0�1O�'�� 3�'�4�5K�'�� 6�'�� 6�'�#�$@�'�,�-N�'� 1�2Y�!'�"&�'D�#'�$4�5T�%'�&6�7X�''�(8�9X�)'��T�#�s�(�^����."��%��������d���� I$�I$�I$�I$�I$�|�I$�I$�I$�X �G�C�{�#�#�#��#G�#G�#G�#G�#G��%�#G�#G�#G�Lw$�w$�w$�w$�w$�Y�w$�w$�w$�t �G�C�L�L���3��d�1�g��$�q�'�����.��f��.�#�.�.�.�.�.�.s$�A�A2�1A2�B�B�B
Memory