mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
fixbug: llm client error
This commit is contained in:
parent
bc63e0aa89
commit
9a96d443b6
2 changed files with 6 additions and 3 deletions
|
|
@ -15,6 +15,7 @@ from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|||
from metagpt.actions.action_node import ActionNode
|
||||
from metagpt.configs.models_config import ModelsConfig
|
||||
from metagpt.context_mixin import ContextMixin
|
||||
from metagpt.provider.llm_provider_registry import create_llm_instance
|
||||
from metagpt.schema import (
|
||||
CodePlanAndChangeContext,
|
||||
CodeSummarizeContext,
|
||||
|
|
@ -45,7 +46,9 @@ class Action(SerializationMixin, ContextMixin, BaseModel):
|
|||
def _update_private_llm(cls, data: Any) -> Any:
|
||||
config = ModelsConfig.default().get(data.llm_name_or_type)
|
||||
if config:
|
||||
data.llm.config = config
|
||||
llm = create_llm_instance(config)
|
||||
llm.cost_manager = data.llm.cost_manager
|
||||
data.llm = llm
|
||||
return data
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ llm:
|
|||
base_url: "YOUR_gpt-3.5-turbo_BASE_URL"
|
||||
api_key: "YOUR_gpt-3.5-turbo_API_KEY"
|
||||
model: "gpt-3.5-turbo" # or gpt-3.5-turbo
|
||||
proxy: "YOUR_gpt-3.5-turbo_PROXY" # for LLM API requests
|
||||
# proxy: "YOUR_gpt-3.5-turbo_PROXY" # for LLM API requests
|
||||
# timeout: 600 # Optional. If set to 0, default value is 300.
|
||||
# Details: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/
|
||||
pricing_plan: "" # Optional. Use for Azure LLM when its model name is not the same as OpenAI's
|
||||
|
|
@ -13,7 +13,7 @@ models:
|
|||
api_type: "openai" # or azure / ollama / groq etc.
|
||||
base_url: "YOUR_MODEL_1_BASE_URL"
|
||||
api_key: "YOUR_MODEL_1_API_KEY"
|
||||
proxy: "YOUR_MODEL_1_PROXY" # for LLM API requests
|
||||
# proxy: "YOUR_MODEL_1_PROXY" # for LLM API requests
|
||||
# timeout: 600 # Optional. If set to 0, default value is 300.
|
||||
# Details: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/
|
||||
pricing_plan: "" # Optional. Use for Azure LLM when its model name is not the same as OpenAI's
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue