mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-05 14:55:18 +02:00
update examples
This commit is contained in:
parent
19c16bf9f1
commit
7816488445
7 changed files with 54 additions and 69 deletions
|
|
@ -55,7 +55,7 @@ class WriteContent(Action):
|
|||
|
||||
name: str = "WriteContent"
|
||||
llm: BaseGPTAPI = Field(default_factory=LLM)
|
||||
directory: str = ""
|
||||
directory: dict = dict()
|
||||
language: str = "Chinese"
|
||||
|
||||
async def run(self, topic: str, *args, **kwargs) -> str:
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ class Role(BaseModel):
|
|||
observed_pure = [msg.dict(exclude={"id": True}) for msg in observed]
|
||||
existed_pure = [msg.dict(exclude={"id": True}) for msg in existed]
|
||||
for idx, new in enumerate(observed_pure):
|
||||
if new["cause_by"] in self._rc.watch and new not in existed_pure:
|
||||
if (new["cause_by"] in self._rc.watch and new not in existed_pure) or (not self._rc.watch):
|
||||
news.append(observed[idx])
|
||||
return news
|
||||
|
||||
|
|
|
|||
|
|
@ -9,13 +9,16 @@
|
|||
"""
|
||||
|
||||
from pydantic import Field
|
||||
from semantic_kernel import Kernel
|
||||
from semantic_kernel.orchestration.sk_function_base import SKFunctionBase
|
||||
from semantic_kernel.planning import SequentialPlanner
|
||||
from semantic_kernel.planning.action_planner.action_planner import ActionPlanner
|
||||
from semantic_kernel.planning.basic_planner import BasicPlanner
|
||||
from semantic_kernel.planning.basic_planner import BasicPlanner, Plan
|
||||
|
||||
from metagpt.actions import UserRequirement
|
||||
from metagpt.actions.execute_task import ExecuteTask
|
||||
from metagpt.llm import LLM
|
||||
from metagpt.logs import logger
|
||||
from metagpt.provider.base_gpt_api import BaseGPTAPI
|
||||
from metagpt.roles import Role
|
||||
from metagpt.schema import Message
|
||||
|
|
@ -37,9 +40,14 @@ class SkAgent(Role):
|
|||
profile: str = "sk_agent"
|
||||
goal: str = "Execute task based on passed in task description"
|
||||
constraints: str = ""
|
||||
|
||||
plan: Plan = None
|
||||
planner_cls: BasicPlanner = BasicPlanner
|
||||
planner: BasicPlanner = Field(default_factory=BasicPlanner)
|
||||
llm: BaseGPTAPI = Field(default_factory=LLM)
|
||||
kernel: Kernel = Field(default_factory=Kernel)
|
||||
import_semantic_skill_from_directory: str = ""
|
||||
import_skill: dict[str, SKFunctionBase] = dict()
|
||||
|
||||
def __init__(self, **kwargs) -> None:
|
||||
"""Initializes the Engineer role with given attributes."""
|
||||
|
|
|
|||
|
|
@ -21,12 +21,14 @@ def make_sk_kernel():
|
|||
if CONFIG.openai_api_type == "azure":
|
||||
kernel.add_chat_service(
|
||||
"chat_completion",
|
||||
AzureChatCompletion(CONFIG.deployment_name, CONFIG.openai_base_url, CONFIG.openai_api_key),
|
||||
AzureChatCompletion(
|
||||
deployment_name=CONFIG.deployment_name, base_url=CONFIG.openai_base_url, api_key=CONFIG.openai_api_key
|
||||
),
|
||||
)
|
||||
else:
|
||||
kernel.add_chat_service(
|
||||
"chat_completion",
|
||||
OpenAIChatCompletion(CONFIG.openai_api_model, CONFIG.openai_api_key),
|
||||
OpenAIChatCompletion(model_id=CONFIG.openai_api_model, api_key=CONFIG.openai_api_key),
|
||||
)
|
||||
|
||||
return kernel
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue