Soulter / hugging-chat-api

HuggingChat Python APIšŸ¤—
GNU Affero General Public License v3.0
859 stars 123 forks source link

Hugchat through python is not working #265

Open Aravind4525 opened 2 weeks ago

Aravind4525 commented 2 weeks ago

def code_compile_analysis(code, language, test_call):

Ask a question to the current conversation with custom parameters

query_result = chatbot.chat(f"Compile and run the provided candidate's code \n {code} \n and language {language}. Compute the function with the given test_inputs {test_call}. If the code has any execution error, do not correct the error. Compute and Provide only if code has any error or not. Provide the Error Name in the key name as error if error is not there make as empty. Provide only in dictionary format not in the JSON Format.")

return query_result

Traceback (most recent call last): File "C:\Users\ARAVIND\PycharmProjects\Code Evaluate\code_compile.py", line 162, in result = pi_code_compile(code_submitted="https://chatlms.s3.ap-south-1.amazonaws.com/sum.py", language="python", ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ARAVIND\PycharmProjects\Code Evaluate\code_compile.py", line 152, in pi_code_compile code_compile = code_compile_analysis(code=code, language=language, test_call=test_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\ARAVIND\PycharmProjects\Code Evaluate\code_compile.py", line 99, in code_compile_analysis query_result = chatbot.chat(f"Compile and run the provided candidate's code \n {code} \n and language {language}. Compute the function with the given test_inputs {test_call}. If the code has any execution error, do not correct the error. Compute and Provide only if code has any error or not. Provide the Error Name in the key name as error if error is not there make as empty. Provide only in dictionary format not in the JSON Format.") ^^^^^^^ NameError: name 'chatbot' is not defined

saleweaver commented 2 weeks ago

From how the error looks, you simply forgot to initialize chatbot