Unverified Commit eff11526 authored by John Wang's avatar John Wang Committed by GitHub

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

parent 07cde4f8
...@@ -69,8 +69,7 @@ class LLMCallbackHandler(BaseCallbackHandler): ...@@ -69,8 +69,7 @@ class LLMCallbackHandler(BaseCallbackHandler):
if not self.conversation_message_task.streaming: if not self.conversation_message_task.streaming:
self.conversation_message_task.append_message_text(response.generations[0][0].text) 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 = 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.llm_message.completion_tokens = self.llm.get_num_tokens(self.llm_message.completion)
self.conversation_message_task.save_message(self.llm_message) self.conversation_message_task.save_message(self.llm_message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment