mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
fix bug
This commit is contained in:
parent
b56f1bfedd
commit
4370060802
3 changed files with 6 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
llm:
|
||||
api_type: "openai"
|
||||
api_type: "openai" # or azure / ollama etc.
|
||||
base_url: "YOUR_BASE_URL"
|
||||
api_key: "YOUR_API_KEY"
|
||||
model: "gpt-4-turbo-preview" # or gpt-3.5-turbo-1106 / gpt-4-1106-preview
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class CollectLinks(Action):
|
|||
if len(remove) == 0:
|
||||
break
|
||||
|
||||
model_name = config.get_openai_llm().model
|
||||
model_name = config.model
|
||||
prompt = reduce_message_length(gen_msg(), model_name, system_text, 4096)
|
||||
logger.debug(prompt)
|
||||
queries = await self._aask(prompt, [system_text])
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ class CostManager(BaseModel):
|
|||
"""
|
||||
self.total_prompt_tokens += prompt_tokens
|
||||
self.total_completion_tokens += completion_tokens
|
||||
if model not in TOKEN_COSTS:
|
||||
logger.warning(f"Model {model} not found in TOKEN_COSTS.")
|
||||
return
|
||||
|
||||
cost = (
|
||||
prompt_tokens * TOKEN_COSTS[model]["prompt"] + completion_tokens * TOKEN_COSTS[model]["completion"]
|
||||
) / 1000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue