mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-05 05:42:37 +02:00
make context length configurable
This commit is contained in:
parent
8b209d4e17
commit
7b81c8a690
2 changed files with 4 additions and 1 deletions
|
|
@ -83,6 +83,7 @@ class LLMConfig(YamlModel):
|
|||
logprobs: Optional[bool] = None
|
||||
top_logprobs: Optional[int] = None
|
||||
timeout: int = 600
|
||||
context_length: Optional[int] = None # Max input tokens
|
||||
|
||||
# For Amazon Bedrock
|
||||
region_name: str = None
|
||||
|
|
|
|||
|
|
@ -23,10 +23,12 @@ class RAGLLM(CustomLLM):
|
|||
"""LlamaIndex's LLM is different from MetaGPT's LLM.
|
||||
|
||||
Inherit CustomLLM from llamaindex, making MetaGPT's LLM can be used by LlamaIndex.
|
||||
|
||||
Set context_length or max_token of LLM in config.yaml if you encounter "Calculated available context size -xxx was not non-negative" error.
|
||||
"""
|
||||
|
||||
model_infer: BaseLLM = Field(..., description="The MetaGPT's LLM.")
|
||||
context_window: int = TOKEN_MAX.get(config.llm.model, DEFAULT_CONTEXT_WINDOW)
|
||||
context_window: int = config.llm.context_length or TOKEN_MAX.get(config.llm.model, DEFAULT_CONTEXT_WINDOW)
|
||||
num_output: int = config.llm.max_token
|
||||
model_name: str = config.llm.model
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue