This commit is contained in:
liubiren 2026-05-10 21:49:19 +08:00
parent 8168059655
commit 3a8b7d7948
1 changed files with 7 additions and 10 deletions

View File

@ -16,14 +16,6 @@ class BaseAgent:
通用智能体基类
"""
model = OpenAIChatModel(
model_name="deepseek-v4-flash",
provider=OpenAIProvider(
base_url="https://tokenhub.tencentmaas.com/v1",
api_key="sk-D9Y1mCe8VlvNqLuSC4mAjqEwxJ2nW4C0h8a7EPn8kg9RLsHq",
),
)
def __init__(self, system_prompt: str, output_type: Any, tools: List = []):
"""
初始化智能体
@ -43,7 +35,13 @@ class BaseAgent:
实例化智能体
"""
agent = Agent(
model=self.model,
model=OpenAIChatModel(
model_name="deepseek-v4-flash",
provider=OpenAIProvider(
base_url="https://tokenhub.tencentmaas.com/v1",
api_key="sk-D9Y1mCe8VlvNqLuSC4mAjqEwxJ2nW4C0h8a7EPn8kg9RLsHq",
),
),
system_prompt=system_prompt,
output_type=output_type,
)
@ -59,4 +57,3 @@ class BaseAgent:
:return: 智能体回复
"""
return await self.agent.run(user_prompt=user_prompt, **kwargs)