mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-07-05 16:02:14 +02:00
add compress_type to config
This commit is contained in:
parent
1f73051571
commit
987d90f6ff
4 changed files with 30 additions and 4 deletions
|
|
@ -86,6 +86,9 @@ class LLMConfig(YamlModel):
|
|||
# Cost Control
|
||||
calc_usage: bool = True
|
||||
|
||||
# Compress request messages under token limit
|
||||
compress_type: str = ""
|
||||
|
||||
@field_validator("api_key")
|
||||
@classmethod
|
||||
def check_llm_key(cls, v):
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class BaseLLM(ABC):
|
|||
else:
|
||||
message.extend(msg)
|
||||
logger.debug(message)
|
||||
compressed_message = self.compress_messages(message, compress_type="post_cut_by_token")
|
||||
compressed_message = self.compress_messages(message, compress_type=self.config.compress_type)
|
||||
rsp = await self.acompletion_text(compressed_message, stream=stream, timeout=self.get_timeout(timeout))
|
||||
# rsp = await self.acompletion_text(message, stream=stream, timeout=self.get_timeout(timeout))
|
||||
return rsp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue