🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
feat: merge v0.6.9
莘权 马19126e46ac2e
diff --cc metagpt/provider/metagpt_api.pyindex 4956746dc,f3dd14bbc..7495079da--- a/metagpt/provider/metagpt_api.py+++ b/metagpt/provider/metagpt_api.py@@@ -5,11 -5,30 +5,24 @@@@File : metagpt_api.py@Desc : MetaGPT LLM provider."""+ from openai.types import CompletionUsage+-from metagpt.config import CONFIG, LLMProviderEnum+from metagpt.configs.llm_config import LLMTypefrom metagpt.provider import OpenAILLMfrom metagpt.provider.llm_provider_registry import register_provider+ from metagpt.utils.exceptions import handle_exception-@register_provider(LLMProviderEnum.METAGPT)+@register_provider(LLMType.METAGPT)class MetaGPTLLM(OpenAILLM):- pass- def __init__(self):- super().__init__()- self.model = CONFIG.DEPLOYMENT_NAME-+ def _calc_usage(self, messages: list[dict], rsp: str) -> CompletionUsage:+ usage = CompletionUsage(prompt_tokens=0, completion_tokens=0, total_tokens=0)- if not CONFIG.calc_usage:- return usage++ # The current billing is based on usage frequency. If there is a future billing logic based on the+ # number of tokens, please refine the logic here accordingly.++ return usage++ @handle_exception+ def _update_costs(self, usage: CompletionUsage):+ pass