Merge pull request #1558 from zhaoweiguo/patch-1

Update openai_api.py
This commit is contained in:
Alexander Wu 2024-10-31 19:49:10 +08:00 committed by GitHub
commit b5bb4d7e63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,9 +114,6 @@ class OpenAILLM(BaseLLM):
elif hasattr(chunk.choices[0], "usage"):
# The usage of some services is an attribute of chunk.choices[0], such as Moonshot
usage = CompletionUsage(**chunk.choices[0].usage)
elif "openrouter.ai" in self.config.base_url and chunk_has_usage:
# due to it get token cost from api
usage = chunk.usage
has_finished = True
log_llm_stream("\n")