🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fixbug: num_tokens_from_messages() is not implemented
莘权 马cbdfac309f1c
diff --git a/metagpt/provider/azure_openai_api.py b/metagpt/provider/azure_openai_api.pyindex 6dc32d380..99063f7cf 100644--- a/metagpt/provider/azure_openai_api.py+++ b/metagpt/provider/azure_openai_api.py@@ -6,14 +6,14 @@@Modified By: mashenquan, 2023/11/21. Fix bug: ReadTimeout.@Modified By: mashenquan, 2023/12/1. Fix bug: Unclosed connection caused by openai 0.x."""--from openai import AsyncAzureOpenAIfrom openai._base_client import AsyncHttpxClientWrapper+from openai.types import CompletionUsagefrom metagpt.configs.llm_config import LLMTypefrom metagpt.provider.llm_provider_registry import register_providerfrom metagpt.provider.openai_api import OpenAILLM+from metagpt.utils.exceptions import handle_exception@register_provider(LLMType.AZURE)@@ -41,3 +41,10 @@ class AzureOpenAILLM(OpenAILLM):kwargs["http_client"] = AsyncHttpxClientWrapper(**proxy_params)return kwargs++ def _calc_usage(self, messages: list[dict], rsp: str) -> CompletionUsage:+ return CompletionUsage(prompt_tokens=0, completion_tokens=0, total_tokens=0)++ @handle_exception+ def _update_costs(self, usage: CompletionUsage):+ pass