Merge pull request #571 from geekan/v0.5.0-release

V0.5.0 release bugfix
This commit is contained in:
geekan 2023-12-17 00:31:44 +08:00 committed by GitHub
commit 4db99b825a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 4 deletions

View file

@ -33,7 +33,8 @@ # MetaGPT: The Multi-Agent Framework
<p align="center">Software Company Multi-Role Schematic (Gradually Implementing)</p>
## News
- Dec 15: v0.5.0 is released! We introduce **incremental development**, facilitating agents to build up larger projects on top of their previous efforts or exisiting human codebase. We also launch a whole collection of important features, including multilingual support (experimental), multiple programming languages support (experimental), incremental development (experimental), CLI support, pip support, enhanced code review, documentation mechanism, and optimized messaging mechanism!
## Install

View file

@ -1,6 +1,9 @@
# DO NOT MODIFY THIS FILE, create a new key.yaml, define OPENAI_API_KEY.
# The configuration of key.yaml has a higher priority and will not enter git
#### Project Path Setting
# WORKSPACE_PATH: "Path for placing output files"
#### if OpenAI
## The official OPENAI_API_BASE is https://api.openai.com/v1
## If the official OPENAI_API_BASE is not available, we recommend using the [openai-forward](https://github.com/beidongjiedeguang/openai-forward).

View file

@ -45,9 +45,11 @@ class Config(metaclass=Singleton):
default_yaml_file = METAGPT_ROOT / "config/config.yaml"
def __init__(self, yaml_file=default_yaml_file):
golbal_options = OPTIONS.get()
self._init_with_config_files_and_env(yaml_file)
logger.debug("Config loading done.")
self._update()
golbal_options.update(OPTIONS.get())
def _update(self):
# logger.info("Config loading done.")

View file

@ -17,12 +17,18 @@ from loguru import logger
import metagpt
OPTIONS = contextvars.ContextVar("OPTIONS")
OPTIONS = contextvars.ContextVar("OPTIONS", default={})
def get_metagpt_package_root():
"""Get the root directory of the installed package."""
package_root = Path(metagpt.__file__).parent.parent
for i in (".git", ".project_root", ".gitignore"):
if (package_root / i).exists():
break
else:
package_root = Path.cwd()
logger.info(f"Package root set to {str(package_root)}")
return package_root

View file

@ -27,6 +27,7 @@ from pydantic import BaseModel, Field
from metagpt.actions import Action, ActionOutput
from metagpt.actions.action_node import ActionNode
from metagpt.actions.add_requirement import UserRequirement
from metagpt.llm import LLM, HumanProvider
from metagpt.logs import logger
from metagpt.memory import Memory
@ -126,7 +127,17 @@ class RoleContext(BaseModel):
return self.memory.get()
class Role:
class _RoleInjector(type):
def __call__(cls, *args, **kwargs):
instance = super().__call__(*args, **kwargs)
if not instance._rc.watch:
instance._watch([UserRequirement])
return instance
class Role(metaclass=_RoleInjector):
"""Role/Agent"""
def __init__(self, name="", profile="", goal="", constraints="", desc="", is_human=False):
@ -141,6 +152,7 @@ class Role:
self._rc = RoleContext()
self._subscription = {any_to_str(self), name} if name else {any_to_str(self)}
def _reset(self):
self._states = []
self._actions = []

View file

@ -121,6 +121,10 @@ class Message(BaseModel):
:param send_to: Specifies the target recipient or consumer for message delivery in the environment.
:param role: Message meta info tells who sent this message.
"""
if not cause_by:
from metagpt.actions import UserRequirement
cause_by = UserRequirement
super().__init__(
id=uuid.uuid4().hex,
content=content,

View file

@ -30,7 +30,7 @@ with open(path.join(here, "requirements.txt"), encoding="utf-8") as f:
setup(
name="metagpt",
version="0.4.0",
version="0.5.0",
description="The Multi-Role Meta Programming Framework",
long_description=long_description,
long_description_content_type="text/markdown",