No response and not precise error description
Closed this issue · 3 comments
Describe the bug
In hugchat there is creating new chat, but it is not responding and saying "Message to write do not find" when I click retry.
To Reproduce
EMAIL = ""
PASSWD = ""
sign = Login(EMAIL, PASSWD)
cookies = sign.login(save_cookies=False)
chatbot = hugchat.ChatBot(cookies=cookies.get_dict())
async def generate_message(
message_from_user: str, model_display_name, conversation_context, user_first_name
):
prompt_document = await TelegramSystemPrompt.find_one()
system_prompt = prompt_document.prompt.format(
model_display_name=model_display_name,
user_first_name=user_first_name,
conversation_context=conversation_context,
)
max_retries = 5
retry_delay = 1
ASSISTANT_ID: str = "666fe314d188f9e3586d5809"
chatbot.new_conversation(assistant=ASSISTANT_ID) #or can use this code: chatbot.new_conversation(modelIndex=1, switch_to=True, system_prompt=system_prompt) instead of using assistant
for attempt in range(max_retries):
try:
response = (chatbot.query(message_from_user))
if response:
print(f"Generated response: {response}")
return response.text
except ModelOverloadedError as e:
print(
f"Model overloaded (modelIndex 0), attempt {attempt + 1} of {max_retries}. Error: {e}"
)
if attempt < max_retries - 1:
await asyncio.sleep(retry_delay)
retry_delay *= 3
else:
print(f"All retry attempts exhausted for both models. Error: {e}")
return "I'm sorry, but I can't keep this conversation for now. I'll have to leave and won't be available"
except Exception as e:
print(f"Unhandled error during chatbot interaction: {e}")
return "Sorry, I couldn't understand that."
return "Sorry, I couldn't understand that."
Expected behavior
It should create new conversation and generate answer using user message.
Additional context
What Operating System are you using? MacOs M3
What Python version are you using? (Found using python3 --version
or python --version
) 3.10.0
What version of hugchat are you using? (Found using pip3 show hugchat
or pip show hugchat
) 0.4.5
Hi! Thanks for your issue, we will deal with your issue as soon as possible.
Also, when I use wait_until_done() it still doesn't work
Issue is resolved by installing latest version of hug chat: pip install hugchat==0.4.8