fix: anthropic completion error in blocking mode (#591)

This commit is contained in:
John Wang 2023-07-18 15:12:52 +08:00 committed by GitHub
parent 07cde4f8fe
commit eff115267f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,8 +69,7 @@ class LLMCallbackHandler(BaseCallbackHandler):
if not self.conversation_message_task.streaming:
self.conversation_message_task.append_message_text(response.generations[0][0].text)
self.llm_message.completion = response.generations[0][0].text
self.llm_message.completion_tokens = response.llm_output['token_usage']['completion_tokens']
else:
self.llm_message.completion_tokens = self.llm.get_num_tokens(self.llm_message.completion)
self.conversation_message_task.save_message(self.llm_message)