🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
improve init and type hint (#480)
Junrong Lin33a634aa03e4
diff --git a/camel/__init__.py b/camel/__init__.pyindex 2c0c5c4ee..8ff878866 100644--- a/camel/__init__.py+++ b/camel/__init__.py@@ -11,16 +11,6 @@# See the License for the specific language governing permissions and# limitations under the License.# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========-import camel.agents-import camel.configs-import camel.generators-import camel.messages-import camel.prompts-import camel.types-import camel.utils-import camel.functions-import camel.memories-import camel.storages__version__ = '0.1.1'diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.pyindex 304db8737..3b7d876ed 100644--- a/camel/agents/chat_agent.py+++ b/camel/agents/chat_agent.py@@ -11,16 +11,15 @@# See the License for the specific language governing permissions and# limitations under the License.# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========+from __future__ import annotations+import jsonfrom collections import defaultdictfrom dataclasses import dataclass-from typing import Any, Callable, Dict, List, Optional, Tuple--from openai import Stream+from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuplefrom camel.agents import BaseAgent-from camel.configs import BaseConfig, ChatGPTConfig-from camel.functions import OpenAIFunction+from camel.configs import ChatGPTConfigfrom camel.memories import (BaseMemory,ChatHistoryMemory,@@ -30,7 +29,6 @@ from camel.memories import (from camel.messages import BaseMessage, FunctionCallingMessage, OpenAIMessagefrom camel.models import BaseModelBackend, ModelFactoryfrom camel.responses import ChatAgentResponse-from camel.terminators import ResponseTerminatorfrom camel.types import (ChatCompletion,ChatCompletionChunk,@@ -40,6 +38,13 @@ from camel.types import ()from camel.utils import get_model_encoding+if TYPE_CHECKING:+ from openai import Stream++ from camel.configs import BaseConfig+ from camel.functions import OpenAIFunction+ from camel.terminators import ResponseTerminator+@dataclass(frozen=True)class FunctionCallingRecord:diff --git a/camel/configs.py b/camel/configs.pyindex 21bbad7dd..b40ebb20c 100644--- a/camel/configs.py+++ b/camel/configs.py@@ -11,11 +11,14 @@# See the License for the specific language governing permissions and# limitations under the License.# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========+from __future__ import annotations+from abc import ABCfrom dataclasses import asdict, dataclass, field-from typing import Any, Dict, List, Optional, Sequence, Union+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union-from camel.functions import OpenAIFunction+if TYPE_CHECKING:+ from camel.functions import OpenAIFunction@dataclass(frozen=True)diff --git a/camel/functions/search_functions.py b/camel/functions/search_functions.pyindex f0147d73f..0c8255dbd 100644--- a/camel/functions/search_functions.py+++ b/camel/functions/search_functions.py@@ -14,7 +14,7 @@import osfrom typing import Any, Dict, List-import camel.agents+from camel.agents import ChatAgentfrom camel.functions import OpenAIFunctionfrom camel.messages import BaseMessagefrom camel.prompts import TextPrompt@@ -220,7 +220,7 @@ def prompt_single_step_agent(prompt: str) -> str:role_name="Assistant",content="You are a helpful assistant.",)- agent = camel.agents.ChatAgent(assistant_sys_msg)+ agent = ChatAgent(assistant_sys_msg)agent.reset()user_msg = BaseMessage.make_user_message(