Team Ai
Apppublic

Yash030/claude-code-proxy

sourceHugging Faceupdated 5mo agoView on Hugging Face
2likes
task_detector.cpython-314.pyc64 linesDownload Raw Back to __pycache__
1+
2cj����Rt^RIHt^RIt^RIHt^RIHt^RIH	t	^RI3Ht0RkRkR	kR4kRkRkR
kRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkRkR kR!kR"kR#kR$kR%kR&kR'kR(kR)kR*kR+kR,kR-kR.kR/kR0kR1kR2kR3kR4kR5kR6kR7kR8kt0R9kR:kR;kR<kR=kR>kR?kR@kRAkRBkRCkRDkREkRFkRGkRHkRIkRJkRKkRLkRMkRNkROkRPkRQkRRkRSkRTkRUkRVkRWkRXkRYkRZkR[kR\kR]kR^kt
0Remt]!R_R_R`7!RaRb44t!RcRd4tR#)fzETask detection - analyze requests to determine required capabilities.)�annotationsN)�	dataclass)�Any)�logger)�get_block_attr�python�5javascript�6typescript�javazc++�cpp�golang�rust�ruby�php�swift�kotlin�sql�html�css�react�vue�angular�node�django�flask�fastapi�spring�function�class�method�api�endpoint�database�query�	algorithm�debug�error�fix�	implement�create�write�code�programming�script�module�import�export�def �const �let �var �	function zasync zawait �analyze�analysis�reason�why�how�explain�compare�contrast�evaluate�assess�conclude�deduce�infer�logic�proof�theorem�7hypothesis�8synthesize�strategy�think�solve�derive�	calculate�compute�math�equation�formula�solution�optimal�best�improve�optimize�design�architecture�system�plan�decision�	recommendT)�frozen�slotsc�x�]tRt^)t$RtRtR]R&RtR]R&RtR]R&Rt	R]R&R	t9R10]R&]RR
l4tRt
R#)�TaskRequirementsz$Detected requirements for a request.F�bool�requires_vision�requires_coding�requires_reasoningT�requires_general_textg�float�11confidencec��V^8�dQhRR/#)��returnzset[str]�)�formats"�:C:\Users\yashw\.claude\temp-hf-clone\core\task_detector.py�__annotate__�TaskRequirements.__annotate__4s��12�13�x�14�c	�2�\4pVP'dVPR4VP'dVPR4VP'dVPR4VP15'dVPR4V#)�vision�coding�	reasoning�general_text)�setra�addrbrcrd)�self�capss& rl�required_capabilities�&TaskRequirements.required_capabilities3sn���u�������H�H�X�������H�H�X���"�"�"��H�H�[�!��%�%�%��H�H�^�$��rorjN)�__name__�16__module__�__qualname__�__firstlineno__�__doc__ra�__annotations__rbrcrdrf�propertyry�__static_attributes__rjrorlr_r_)sK��.�!�O�T�!�!�O�T�!�$���$�"&��4�&��J���
�17��18ror_c�V�]tRt^AtRtRRltRRltRRltRR	ltR19Rlt	Rt20R
#)�TaskDetectorz9Analyze request messages to detect required capabilities.c� �V^8�dQhRRRR/#)rh�messagesz	list[Any]rir_rj)rks"rlrm�TaskDetector.__annotate__Ds��<�<�I�<�:J�<roc
�^�RpRpRpRpVEFp\V\4'dVPR4pM!\VR4'dVPpMKM\V\214'd WWP
4R,,
pK�\V\4'gK�VFup\VR4;'gRp	V	R8XdRp\P!R4V	R	8XgKA\VR	R4;'gRp22WZP
4R,,
pKw	EK	V'd#VPV4pVPV4pVPW#WE4pV'gV'gV'gRp\VVVRVR237p
\P!RV
P V4V
#)z2Analyze messages and return required capabilities.F��content� �type�imageTz$TaskDetector: Found image in message�text)rarbrcrdrfz0TaskDetector: detected caps={} confidence={:.2f})�24isinstance�dict�get�hasattrr��str�lower�listrrr%�_detect_coding�_detect_reasoning�_calculate_confidencer_�infory)rwr��25has_vision�26has_coding�
has_reasoning�27total_text�msgr��block�b_typer�rf�has_general�results&&            rl�detect_requirements� TaskDetector.detect_requirementsDsu���28��29��
��30��C��#�t�$�$��'�'�)�,����i�(�(��+�+����'�3�'�'��m�m�o��3�3�31��G�T�*�*�$�E�+�E�6�:�@�@�b�F���(�%)�32����%K�L���'�-�e�V�R�@�F�F�B��"�j�j�l�S�&8�8�33�%��4��,�,�Z�8�J� �2�2�:�>�M��/�/��M�34�35�36�*�]��K�!�&�&�,�"&�!�37��	���>��(�(��	38��
roc� �V^8�dQhRRRR/#�rhr�r�rir`rj)rks"rlrmr��s����3��4�roc
�a�\\P!RS44pV\,p\	V4^8�dR#\F�pVS9gKSPVR4p\FpWe9gKWd8wgKR#	\;QJdV3RlR4F'gKRM	RM!V3RlR44'gKR#	R#)z/Detect if request requires coding capabilities.�\b\w+\bTr�c3�,<"�TF	qS9x�K	R#5i)Nrj)�.0�patr�s& �rl�	<genexpr>�.TaskDetector._detect_coding.<locals>.<genexpr>�s�����.~�s�d�{�.~�s�F)	r1r5zclass zimport r2r3r4z()z=>)ru�re�findall�CODING_KEYWORDS�len�replace�any)rwr��words�coding_matches�keyword�	remaining�kw2s&f     rlr��TaskDetector._detect_coding�s�����B�J�J�z�4�0�1����0���~��!�#��'�G��$�� �L�L��"�5�	�*�C��'�C�N�#�+��3��.~��3�3�3��.~�����'�roc� �V^8�dQhRRRR/#r�rj)rks"rlrmr��s��39�40�c�41�d�42roc
��\\P!RV44pV\,p\	V4^8�dR#\FpWA9gKR#	R#)z2Detect if request requires reasoning capabilities.r�TF)rur�r��REASONING_KEYWORDSr�)rwr�r��reasoning_matchesr�s&&   rlr��TaskDetector._detect_reasoning�sK���B�J�J�z�4�0�1��!�$6�6��� �!�Q�&��)�G����*�roc43�,�V^8�dQhRRRRRRRRRR/#)	rhr�r`r�r�r�r�rirerj)rks"rlrmr��s<���������	�44��45�
roc
��V'dR#V'g	V'd0\VP44pRpV^28�dRpV^d8�dRpV#R#)z&Calculate confidence in the detection.gffffff�?gffffff�?g�������?g333333�?g�?)r��split)rwr�r�r�r��46word_count�bases&&&&&  rlr��"TaskDetector._calculate_confidence�sE�������T�Z�Z�\�*�J��D��B�����C�����K�roc� �V^8�dQhRRRR/#)rh�requirementsr_rir�rj)rks"rlrmr��s����.>��3�roc
�~�VP'dR#VP'dR#VP'dR#R#)z4Get a hint for model priority based on requirements.rqrrrs�balanced)rarbrc)rwr�s&&rl�get_priority_hint�TaskDetector.get_priority_hint�s2���'�'�'���'�'�'���*�*�*��rorjN)r{r|r}r~rr�r�r�r�r�r�rjrorlr�r�As$��C�<�|�,47��*�ror�>�see�face�chart�graphr��photo�scene�detect�object�visual�diagram�picture�identify�	recognize�48screenshot�look at�	what's in�
describe what�
text in image)r�49__future__rr��dataclassesr�typingr�logurur�core.anthropic.contentrr�r��VISION_KEYWORDSr_r�rjrorl�<module>r�s���K�"�	�!���1������(��*0��27��9>��@H��50������"��$,��.3��5;��=B��DK��51������'��)0��2;��=E���	��	�"�	�$)�	�+5�	�7A�	�CJ�	�52��53��54"��55$)��56+6��578@��58BI���
�
�
�$�
�&.�
�08�
�:B�
���
����%��'2��4<��>F����
����#��%*��,1��3<��>G������$��&0��2:��<C������ ��".��0<��>H���	��	��	�!,�	�.7�	�9?�	�AK�	�59��60��61%��62'-��63/8��64:D��
�
��
�'�
�)/�
�1;�
�=H�
�����$�d�#���$��.@�@ro