Team Ai
Apppublic

HouryK/CodingFirstChatBot

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
app.cpython-312.pyc19 linesDownload Raw Back to __pycache__
1�

2s�Uf(�� �ddlmZddlmZddlmZddlmZddlm	Z	ddl3mZed�Zejdd�	�dd4lZdZej ed��dd5lZej&d
��Zej(dej*fd��Zy6)�)�7ChatOpenAI)�ChatPromptTemplate)�StrOutputParser)�Runnable)�RunnableConfig)�Pathz./.filesT)�parents�exist_okN�.)r8c��K�td��}tjddg�}||zt�z}tj9j
d|�y�w)NT)�	streaming)�systemarYou are a coding and robotics teacher who provides only technical answers based on the website https://www.codingfirst.org do not answer any questions that is unrelated to coding and robotics. Greet respectfully and apologise when you are asked any question other than coding or robotics. You are an expert on the Coding First platform and you know its curriculum fully.)�humanz10{question}�runnable)rr�
from_messagesr�cl�user_session�set)�model�promptrs   �1/Users/hourykeoshkerian/CodingFirstChatBot/app.py�
on_chat_startrsV������&�E�
�
-�
-�
�
$�	11��F���~�� 1�1�H��O�O���12�H�-�s�AA�messagec��pK�tjjd�}tjd��}|j	d|j13it
tj�g����23d{���}|j|��d{����#7�7�6|j��d{���7y�w)Nr�)�content�question)�	callbacks)�config)14rr�get�Message�astreamrr�LangchainCallbackHandler�stream_token�send)rr�msg�chunks    r�15on_messager('s��������"�"�:�.�H�16�*�*�R�17 �C��'�'�	�W�_�_�%���)D�)D�)F�(G�H�(��&�&�e����u�%�%�%�	&��	&��	��(�(�*���sH�A2B6�4B�8B�9B�<B6�B�B6�B�B6�B6�/B2�0B6)�langchain_openair�langchain.promptsr�langchain.schemar�langchain.schema.runnabler� langchain.schema.runnable.configr�pathlibr�FILES_DIRECTORY�mkdir�os�18config_dir�makedirs�chainlitrrr(r!��r�<module>r7s���'�0�,�.�;���z�"�����d�T��2�	��19�����J��&�����.��.�����b�j�j���r6