CoolFace
Apppublic

Shrook21/Code-Assistant

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
nodes.cpython-311.pyc32 linesDownload Raw Back to __pycache__
12�k�h�����ddlmZmZddlmZddlmZmZmZm	Z	ddl3mZddlm
Z
ddlmZddlZe
ed�	��Zd4edefd�Zd5edefd
�Zd6edefd�Zd7edefd�Zd8edefd�ZdS)�)�HumanMessage�
SystemMessage)�9StateAgent)�classify_prompt�generate_prompt�explain_prompt�fallback_prompt)�	retriever)�Ollama)�OLLAMA_MODEL_NAMENg�������?)�model�temperature�state�returnc�4�|ddj}t|��}t�|��}|������}t
jd|��}|r|�d��nd}i|�||d��S)N�message�����z(generate|explain)��fallback)�task�classification)	�contentr�llm�invoke�strip�lower�re�search�group)r�10user_input�prompt�result�raw�matchrs       �@D:\Cellula NLP\Smart Code Assitant\Code-Assitant\agents\nodes.py�chatr&s����y�!�"�%�-�J�
�Z�
(�
(�F�
�Z�Z��
�
�F�11�,�,�.�.�12�13�1415 �C��I�+�S�1�1�E�"�2�5�;�;�q�>�>�>�16�D�9�e�9�T�S�9�9�9�9�c��|dS)Nr�)rs r%�routerr*s����=�r'c���|ddj}t|��}t||��}t�|��}i|�d|dt|���t
|���gzi�S�Nrr�r)rr17rrrrr)rr �contextr!�outputs     r%�
generate_coder0s����y�!�"�%�-�J��18�#�#�G�
�Z��
1�
1�F�
�Z�Z��
�
�F��19���5��#�|�F�'C�'C�'C�]�[a�Eb�Eb�Eb�&c�c���r'c�\��|ddj�t�fd�dD����s&d��d�}i|�d|dt|���gzi�St���}t�|��}i|�d|dt
|���t|���gzi�S)Nrrc3�D�K�|]}|����vV��dS)N)r)�.0�kr s  �r%�	<genexpr>zexplain_code.<locals>.<genexpr>*s4�������1�q�J�$�$�&�&�&������r')	zdef zclass zimport zfor zif zwhile �=�printrz%I don't see any code in your input: 'z;'. Please provide the Python code you'd like me to explain.r-)r�anyrrrrr)rr/r!r s   @r%�explain_coder9(s�����y�!�"�%�-�J������0~������X�A��A�A�A��W�%�W��E�)�$4�
�f�8U�8U�8U�7V�$V�W�W�W�
�J�
'�
'�F�
�Z�Z��
�
�F��20���5��#�|�F�'C�'C�'C�]�[a�Eb�Eb�Eb�&c�c���r'c��|ddj}t|��}t�|��}i|�d|dt	|���gzi�Sr,)rr	rrr)rr r!r/s    r%rr4sk���y�!�"�%�-�J�
�Z�
(�
(�F�
�Z�Z��
�
�F��21���5��#�}�V�'D�'D�'D�&E�E���r')�langchain_core.messagesrr�agents.stater�prompts.promptsrrrr	�tools.toolsr22�langchain_community.llmsr�config.settingsrrrr&�strr*r0r9rr)r'r%�<module>rBs|��?�?�?�?�?�?�?�?�#�#�#�#�#�#�������������"�!�!�!�!�!�+�+�+�+�+�+�-�-�-�-�-�-�	�	�	�	��f�23������:�24�:�z�:�:�:�:��*����������25�����26�2728�z�29�30�31�32��J��:������r'