Commit e6690e6c authored by John Wang's avatar John Wang

feat: remove agent mode llm params

parent 9c5cdd7d
......@@ -39,11 +39,12 @@ class OrchestratorRuleParser:
return None
agent_mode_config = self.app_model_config.agent_mode_dict
model_dict = self.app_model_config.model_dict
chain = None
if agent_mode_config and agent_mode_config.get('enabled'):
tool_configs = agent_mode_config.get('tools', [])
agent_model_name = agent_mode_config.get('model_name', 'gpt-4')
agent_model_name = model_dict.get('name', 'gpt-4')
# add agent callback to record agent thoughts
agent_callback = AgentLoopGatherCallbackHandler(
......
......@@ -128,7 +128,7 @@ class AppModelConfig(db.Model):
@property
def agent_mode_dict(self) -> dict:
return json.loads(self.agent_mode) if self.agent_mode else {"enabled": False, "tools": []}
return json.loads(self.agent_mode) if self.agent_mode else {"enabled": False, "strategy": None, "tools": []}
class RecommendedApp(db.Model):
......
import re
import uuid
from core.agent.agent_executor import PlanningStrategy
from core.constant import llm_constant
from models.account import Account
from services.dataset_service import DatasetService
......@@ -288,16 +289,11 @@ class AppModelConfigService:
if not isinstance(config["agent_mode"]["enabled"], bool):
raise ValueError("enabled in agent_mode must be of boolean type")
# provider
if 'model_provider' not in config["agent_mode"] or config["agent_mode"]["model_provider"] != "openai":
raise ValueError("agent_mode.model_provider must be 'openai'")
if "strategy" not in config["agent_mode"] or not config["agent_mode"]["strategy"]:
config["agent_mode"]["strategy"] = PlanningStrategy.ROUTER.value
# model.name
if 'model_name' not in config["agent_mode"]:
raise ValueError("agent_mode.model_name is required")
if config["agent_mode"]["model_name"] not in SUPPORT_AGENT_MODELS:
raise ValueError("agent_mode.model_name must be in the specified model list")
if config["agent_mode"]["strategy"] not in PlanningStrategy.__members__:
raise ValueError("strategy in agent_mode must be in the specified strategy list")
if "tools" not in config["agent_mode"] or not config["agent_mode"]["tools"]:
config["agent_mode"]["tools"] = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment