Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

Feat: Add external tool support to `ChatAgent` & Refactor (#830)

Isaac Jin55c6fad57418
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index 306400a18..58bf6f2bf 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -27,7 +27,7 @@ body:
attributes:
label: What version of camel are you using?
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
- placeholder: E.g., 0.1.7.2
+ placeholder: E.g., 0.1.8
validations:
required: true
diff --git a/README.md b/README.md
index c67fae7a6..39e1c817f 100644
--- a/README.md
+++ b/README.md
@@ -119,7 +119,7 @@ conda create --name camel python=3.10
conda activate camel
# Clone github repo
-git clone -b v0.1.7.2 https://github.com/camel-ai/camel.git
+git clone -b v0.1.8 https://github.com/camel-ai/camel.git
# Change directory into project directory
cd camel
diff --git a/camel/__init__.py b/camel/__init__.py
index 97c45b409..fb7280dec 100644
--- a/camel/__init__.py
+++ b/camel/__init__.py
@@ -12,7 +12,7 @@
# limitations under the License.
# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
-__version__ = '0.1.7.2'
+__version__ = '0.1.8'
__all__ = [
'__version__',
diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.py
index 0ada3a958..ca8fd7b68 100644
--- a/camel/agents/chat_agent.py
+++ b/camel/agents/chat_agent.py
@@ -19,14 +19,15 @@ from collections import defaultdict
from typing import (
TYPE_CHECKING,
Any,
- Callable,
Dict,
List,
Optional,
Tuple,
+ Type,
Union,
)
+from openai.types.chat import ChatCompletionMessageToolCall
from pydantic import BaseModel
from camel.agents.base import BaseAgent
@@ -49,7 +50,6 @@ from camel.types import (
RoleType,
)
from camel.utils import (
- Constants,
func_string_to_callable,
get_model_encoding,
get_pydantic_object_schema,
@@ -130,6 +130,10 @@ class ChatAgent(BaseAgent):
agent. (default: :obj:`None`)
tools (List[OpenAIFunction], optional): List of available
:obj:`OpenAIFunction`. (default: :obj:`None`)
+ external_tools (List[OpenAIFunction], optional): List of external tools
+ (:obj:`OpenAIFunction`) bind to one chat agent. When these tools
+ are called, the agent will directly return the request instead of
+ processing it. (default: :obj:`None`)
response_terminators (List[ResponseTerminator], optional): List of
:obj:`ResponseTerminator` bind to one chat agent.
(default: :obj:`None`)
@@ -144,6 +148,7 @@ class ChatAgent(BaseAgent):
token_limit: Optional[int] = None,
output_language: Optional[str] = None,
tools: Optional[List[OpenAIFunction]] = None,
+ external_tools: Optional[List[OpenAIFunction]] = None,
response_terminators: Optional[List[ResponseTerminator]] = None,
) -> None:
self.orig_sys_message: BaseMessage = system_message
@@ -165,10 +170,16 @@ class ChatAgent(BaseAgent):
self.model_type: ModelType = self.model_backend.model_type
- self.func_dict: Dict[str, Callable] = {}
- if tools is not None:
- for func in tools:
- self.func_dict[func.get_function_name()] = func.func
+ # tool registration
+ external_tools = external_tools or []
+ tools = tools or []
+ all_tools = tools + external_tools
+ self.external_tool_names = [
+ tool.get_function_name() for tool in external_tools
+ ]
+ self.func_dict = {
+ tool.get_function_name(): tool.func for tool in all_tools
+ }
self.model_config_dict = self.model_backend.model_config_dict
@@ -262,34 +273,41 @@ class ChatAgent(BaseAgent):
def get_info(
self,
- id: Optional[str],
+ session_id: Optional[str],
usage: Optional[Dict[str, int]],
termination_reasons: List[str],
num_tokens: int,
tool_calls: List[FunctionCallingRecord],
+ external_tool_request: Optional[ChatCompletionMessageToolCall] = None,
) -> Dict[str, Any]:
r"""Returns a dictionary containing information about the chat session.
Args:
- id (str, optional): The ID of the chat session.
+ session_id (str, optional): The ID of the chat session.
usage (Dict[str, int], optional): Information about the usage of
the LLM model.
termination_reasons (List[str]): The reasons for the termination
of the chat session.
num_tokens (int): The number of tokens used in the chat session.
tool_calls (List[FunctionCallingRecord]): The list of function
- calling records, containing the information of called
- tools.
+ calling records, containing the information of called tools.
+ external_tool_request
+ (Optional[ChatCompletionMessageToolCall], optional):
+ The tool calling request of external tools from the model.
+ These requests are directly returned to the user instead of
+ being processed by the agent automatically.
+ (default: :obj:`None`)
Returns:
Dict[str, Any]: The chat session information.
"""
return {
- "id": id,
+ "id": session_id,
"usage": usage,
"termination_reasons": termination_reasons,
"num_tokens": num_tokens,
"tool_calls": tool_calls,
+ "external_tool_request": external_tool_request,
}
def init_messages(self) -> None:
@@ -317,7 +335,7 @@ class ChatAgent(BaseAgent):
def step(
self,
input_message: BaseMessage,
- output_schema: Optional[BaseModel] = None,
+ output_schema: Optional[Type[BaseModel]] = None,
) -> ChatAgentResponse:
r"""Performs a single step in the chat session by generating a response
to the input message.
@@ -328,10 +346,11 @@ class ChatAgent(BaseAgent):
either `user` or `assistant` but it will be set to `user`
anyway since for the self agent any incoming message is
external.
- output_schema (Optional[BaseModel]): An optional pydantic model
- that includes value types and field descriptions used to
- generate a structured response by LLM. This schema helps
- in defining the expected output format.
+ output_schema (Optional[Type[BaseModel]], optional): A pydantic
+ model class that includes value types and field descriptions
+ used to generate a structured response by LLM. This schema
+ helps in defining the expected output format. (default:
+ :obj:`None`)
Returns:
ChatAgentResponse: A struct containing the output messages,
@@ -340,27 +359,15 @@ class ChatAgent(BaseAgent):
"""
self.update_memory(input_message, OpenAIBackendRole.USER)
- output_messages: List[BaseMessage]
- info: Dict[str, Any]
- tool_calls: List[FunctionCallingRecord] = []
+ tool_call_records: List[FunctionCallingRecord] = []
while True:
- # Format messages and get the token number
- openai_messages: Optional[List[OpenAIMessage]]
-
+ # Check if token has exceeded
try:
openai_messages, num_tokens = self.memory.get_context()
except RuntimeError as e:
- return self.step_token_exceed(
- e.args[1], tool_calls, "max_tokens_exceeded"
+ return self._step_token_exceed(
+ e.args[1], tool_call_records, "max_tokens_exceeded"
)
- # use structed output response without tools
- # If the user provides the output_schema parameter and does not
- # specify the use of tools, then in the model config of the
- # chatgent, call the model specified by tools with
- # return_json_response of OpenAIFunction format, and return a
- # structured response with the user-specified output schema.
- if output_schema is not None and len(self.func_dict) == 0:
- self._add_output_schema_to_tool_list(output_schema)
(
response,
@@ -370,97 +377,73 @@ class ChatAgent(BaseAgent):
response_id,
) = self._step_model_response(openai_messages, num_tokens)
+ # If the model response is not a function call, meaning the model
+ # has generated a message response, break the loop
if (
- self.is_tools_added()
- and isinstance(response, ChatCompletion)
- and response.choices[0].message.tool_calls is not None
+ not self.is_tools_added()
+ or not isinstance(response, ChatCompletion)
+ or response.choices[0].message.tool_calls is None
):
- # Tools added for function calling and not in stream mode
-
- tool_calls, func_assistant_msg, func_result_msg = (
- self._add_tools_for_func_call(response, tool_calls)
- )
-
- # Update the messages
- self.update_memory(
- func_assistant_msg, OpenAIBackendRole.ASSISTANT
- )
- self.update_memory(func_result_msg, OpenAIBackendRole.FUNCTION)
-
- else:
- # If the user specifies tools, it is necessary to wait for the
- # model to complete all tools' calls. Finally, use the
- # generated response as the input for the structure,
- # simultaneously calling the return_json_response function.
- # Call the model again with return_json_response in the format
- # of OpenAIFunction as the last tool, returning a structured
- # response with the user-specified output schema.
- if output_schema is not None and all(
- record.func_name
- != Constants.FUNC_NAME_FOR_STRUCTURE_OUTPUT
- for record in tool_calls
- ):
- self._add_output_schema_to_tool_list(output_schema)
-
- (
- response,
- output_messages,
- finish_reasons,
- usage_dict,
- response_id,
- ) = self._step_model_response(openai_messages, num_tokens)
-
- if isinstance(response, ChatCompletion):
- # Tools added for function calling and not in stream
- # mode
- tool_calls, func_assistant_msg, func_result_msg = (
- self._add_tools_for_func_call(response, tool_calls)
- )
-
- # Update the messages
- self.update_memory(
- func_assistant_msg, OpenAIBackendRole.ASSISTANT
- )
- self.update_memory(
- func_result_msg, OpenAIBackendRole.FUNCTION
- )
+ break
+ # Check for external tool call
+ tool_call_request = response.choices[0].message.tool_calls[0]
+ if tool_call_request.function.name in self.external_tool_names:
+ # if model calls an external tool, directly return the request
info = self._step_get_info(
output_messages,
finish_reasons,
usage_dict,
response_id,
- tool_calls,
+ tool_call_records,
num_tokens,
+ tool_call_request,
+ )
+ return ChatAgentResponse(
+ msgs=output_messages, terminated=self.terminated, info=info
)
- break
- # if use structure response, set structure result as content of
- # BaseMessage
- if output_schema and self.model_type.is_openai:
- for base_message_item in output_messages:
- base_message_item.content = str(info['tool_calls'][-1].result)
+ # Normal function calling
+ tool_call_records.append(self._step_tool_call_and_update(response))
- chat_agent_response = ChatAgentResponse(
- msgs=output_messages, terminated=self.terminated, info=info
+ if output_schema is not None and self.model_type.supports_tool_calling:
+ (
+ output_messages,
+ finish_reasons,
+ usage_dict,
+ response_id,
+ tool_call,
+ num_tokens,
+ ) = self._structure_output_with_function(output_schema)
+ tool_call_records.append(tool_call)
+
+ info = self._step_get_info(
+ output_messages,
+ finish_reasons,
+ usage_dict,
+ response_id,
+ tool_call_records,
+ num_tokens,
)
- # If the output result is single message, it will be
- # automatically added to the memory.
- if len(chat_agent_response.msgs) == 1:
- self.record_message(chat_agent_response.msg)
+ if len(output_messages) == 1:
+ # Auto record if the output result is a single message
+ self.record_message(output_messages[0])
else:
logger.warning(
- "Multiple messages are available in `ChatAgentResponse`. "
- "Please manually run the `record_message` function to "
- "record the selected message."
+ "Multiple messages returned in `step()`, message won't be "
+ "recorded automatically. Please call `record_message()` to "
+ "record the selected message manually."
)
- return chat_agent_response
+
+ return ChatAgentResponse(
+ msgs=output_messages, terminated=self.terminated, info=info
+ )
async def step_async(
self,
input_message: BaseMessage,
- output_schema: Optional[BaseModel] = None,
+ output_schema: Optional[Type[BaseModel]] = None,
) -> ChatAgentResponse:
r"""Performs a single step in the chat session by generating a response
to the input message. This agent step can call async function calls.
@@ -471,10 +454,11 @@ class ChatAgent(BaseAgent):
either `user` or `assistant` but it will be set to `user`
anyway since for the self agent any incoming message is
external.
- output_schema (Optional[BaseModel]): An optional pydantic model
- that includes value types and field descriptions used to
- generate a structured response by LLM. This schema helps
- in defining the expected output format.
+ output_schema (Optional[Type[BaseModel]], optional): A pydantic
+ model class that includes value types and field descriptions
+ used to generate a structured response by LLM. This schema
+ helps in defining the expected output format. (default:
+ :obj:`None`)
Returns:
ChatAgentResponse: A struct containing the output messages,
@@ -483,21 +467,14 @@ class ChatAgent(BaseAgent):
"""
self.update_memory(input_message, OpenAIBackendRole.USER)
- output_messages: List[BaseMessage]
- info: Dict[str, Any]
- tool_calls: List[FunctionCallingRecord] = []
+ tool_call_records: List[FunctionCallingRecord] = []
while True:
- # Format messages and get the token number
- openai_messages: Optional[List[OpenAIMessage]]
-
try:
openai_messages, num_tokens = self.memory.get_context()
except RuntimeError as e:
- return self.step_token_exceed(
- e.args[1], tool_calls, "max_tokens_exceeded"
+ return self._step_token_exceed(
+ e.args[1], tool_call_records, "max_tokens_exceeded"
)
- if output_schema is not None:
- self._add_output_schema_to_tool_list(output_schema)
(
response,
@@ -508,168 +485,168 @@ class ChatAgent(BaseAgent):
) = self._step_model_response(openai_messages, num_tokens)
if (
- self.is_tools_added()
- and isinstance(response, ChatCompletion)
- and response.choices[0].message.tool_calls is not None
+ not self.is_tools_added()
+ or not isinstance(response, ChatCompletion)
+ or response.choices[0].message.tool_calls is None
):
- # Tools added for function calling and not in stream mode
-
- # Do function calling
- (
- func_assistant_msg,
- func_result_msg,
- func_record,
- ) = await self.step_tool_call_async(response)
-
- # Update the messages
- self.update_memory(
- func_assistant_msg, OpenAIBackendRole.ASSISTANT
- )
- self.update_memory(func_result_msg, OpenAIBackendRole.FUNCTION)
-
- # Record the function calling
- tool_calls.append(func_record)
-
- else:
- # use structed output response without tools
- if output_schema is not None and all(
- record.func_name
- != Constants.FUNC_NAME_FOR_STRUCTURE_OUTPUT
- for record in tool_calls
- ):
- self._add_output_schema_to_tool_list(output_schema)
-
- (
- response,
- output_messages,
- finish_reasons,
- usage_dict,
- response_id,
- ) = self._step_model_response(openai_messages, num_tokens)
-
- if isinstance(response, ChatCompletion):
- # Tools added for function calling and not in stream
- # mode
- tool_calls, func_assistant_msg, func_result_msg = (
- self._add_tools_for_func_call(response, tool_calls)
- )
-
- # Update the messages
- self.update_memory(
- func_assistant_msg, OpenAIBackendRole.ASSISTANT
- )
- self.update_memory(
- func_result_msg, OpenAIBackendRole.FUNCTION
- )
-
- # Function calling disabled or not a function calling
+ break
+
+ # Check for external tool call
+ tool_call_request = response.choices[0].message.tool_calls[0]
+ if tool_call_request.function.name in self.external_tool_names:
+ # if model calls an external tool, directly return the request
info = self._step_get_info(
output_messages,
finish_reasons,
usage_dict,
response_id,
- tool_calls,
+ tool_call_records,
num_tokens,
+ tool_call_request,
+ )
+ return ChatAgentResponse(
+ msgs=output_messages, terminated=self.terminated, info=info
)
- break
- # if use structure response, set structure result as content of
- # BaseMessage
- if output_schema and self.model_type.is_openai:
- for base_message_item in output_messages:
- base_message_item.content = str(info['tool_calls'][0].result)
+ # Normal function calling
+ tool_call_records.append(
+ await self._step_tool_call_and_update_async(response)
+ )
- chat_agent_response = ChatAgentResponse(
- msgs=output_messages, terminated=self.terminated, info=info
+ if output_schema is not None and self.model_type.supports_tool_calling:
+ (
+ output_messages,
+ finish_reasons,
+ usage_dict,
+ response_id,
+ tool_call_record,
+ num_tokens,
+ ) = self._structure_output_with_function(output_schema)
+ tool_call_records.append(tool_call_record)
+
+ info = self._step_get_info(
+ output_messages,
+ finish_reasons,
+ usage_dict,
+ response_id,
+ tool_call_records,
+ num_tokens,
)
- # If the output result is single message, it will be
- # automatically added to the memory.
- if len(chat_agent_response.msgs) == 1:
- self.record_message(chat_agent_response.msg)
+ if len(output_messages) == 1:
+ # Auto record if the output result is a single message
+ self.record_message(output_messages[0])
else:
logger.warning(
- "Multiple messages are presented in `chat_agent_response`. "
- "Please manually call the `record_message` function to "
- "record the chosen message."
+ "Multiple messages returned in `step()`, message won't be "
+ "recorded automatically. Please call `record_message()` to "
+ "record the selected message manually."
)
- return chat_agent_response
+ return ChatAgentResponse(
+ msgs=output_messages, terminated=self.terminated, info=info
+ )
+
+ def _step_tool_call_and_update(
+ self, response: ChatCompletion
+ ) -> FunctionCallingRecord:
+ r"""Processes a function call within the chat completion response,
+ records the function call in the provided list of tool calls and
+ updates the memory of the current agent.
- def _add_tools_for_func_call(
- self,
- response: ChatCompletion,
- tool_calls: List[FunctionCallingRecord],
- ) -> tuple[
- List[FunctionCallingRecord],
- FunctionCallingMessage,
- FunctionCallingMessage,
- ]:
- r"""
- Handles adding tools for function calls based on the response.
- This method processes a function call within the chat completion
- response, and records the function call in the provided
- list of tool calls.
Args:
response (ChatCompletion): The response object from the chat
completion.
- tool_calls (List[FunctionCallingRecord]): The list to record
- function calls.
+
Returns:
- tuple: A tuple containing:
- - List[FunctionCallingRecord]: The updated list of function
- call records.
- - FunctionCallingMessage: The assistant's message regarding the
- function call.
- - FunctionCallingMessage: The result message of the function
- call.
+ FunctionCallingRecord: The record of calling the function.
"""
# Perform function calling
- func_assistant_msg, func_result_msg, func_record = self.step_tool_call(
- response
+ func_assistant_msg, func_result_msg, tool_call_record = (
+ self.step_tool_call(response)
)
- # Record the function call in the list of tool calls
- tool_calls.append(func_record)
+ # Update the messages
+ self.update_memory(func_assistant_msg, OpenAIBackendRole.ASSISTANT)
+ self.update_memory(func_result_msg, OpenAIBackendRole.FUNCTION)
- # Return updated tool calls list, assistant's message, and function
- # result message
- return tool_calls, func_assistant_msg, func_result_msg
+ return tool_call_record
- def _add_output_schema_to_tool_list(self, output_schema: BaseModel):
- r"""Handles the structured output response for OpenAI.
- This method processes the given output schema and integrates the
- resulting function into the tools for the OpenAI model configuration.
- Args:
- output_schema (BaseModel): The schema representing the expected
- output structure.
+ async def _step_tool_call_and_update_async(
+ self, response: ChatCompletion
+ ) -> FunctionCallingRecord:
+ (
+ func_assistant_msg,
+ func_result_msg,
+ func_record,
+ ) = await self.step_tool_call_async(response)
+
+ self.update_memory(func_assistant_msg, OpenAIBackendRole.ASSISTANT)
+ self.update_memory(func_result_msg, OpenAIBackendRole.FUNCTION)
+
+ return func_record
+
+ def _structure_output_with_function(
+ self, output_schema: Type[BaseModel]
+ ) -> Tuple[
+ List[BaseMessage],
+ List[str],
+ Dict[str, int],
+ str,
+ FunctionCallingRecord,
+ int,
+ ]:
+ r"""Internal function of structuring the output of the agent based on
+ the given output schema.
"""
from camel.toolkits import OpenAIFunction
- # step 1 extract the output_schema info as json.
schema_json = get_pydantic_object_schema(output_schema)
-
- # step 2 convert output schema json as callable string
func_str = json_to_function_code(schema_json)
-
- # step 3 get callable function from string
func_callable = func_string_to_callable(func_str)
-
- # step 4 add return_json_func into tools
func = OpenAIFunction(func_callable)
- tools = [func]
- self.func_dict[func.get_function_name()] = func.func
- if self.model_type.is_openai:
- self.model_backend.model_config_dict = ChatGPTConfig(
- tools=tools
- ).as_dict()
- elif self.model_type.is_gemini:
- from camel.configs.gemini_config import GeminiConfig
-
- self.model_backend.model_config_dict = GeminiConfig(
- tools=tools
- ).as_dict()
+
+ original_func_dict = self.func_dict
+ original_model_dict = self.model_backend.model_config_dict
+
+ # Replace the original tools with the structuring function
+ self.func_dict = {func.get_function_name(): func.func}
+ self.model_backend.model_config_dict["tools"] = [
+ func.get_openai_tool_schema()
+ ]
+
+ openai_messages, num_tokens = self.memory.get_context()
+ (
+ response,
+ output_messages,
+ finish_reasons,
+ usage_dict,
+ response_id,
+ ) = self._step_model_response(openai_messages, num_tokens)
+
+ if isinstance(response, ChatCompletion):
+ tool_call_record = self._step_tool_call_and_update(response)
+ else:
+ raise ValueError(
+ "Structured output is not supported for stream responses."
+ )
+
+ for base_message_item in output_messages:
+ base_message_item.content = str(tool_call_record.result)
+
+ # Recover the original tools
+ self.func_dict = original_func_dict
+ self.model_backend.model_config_dict = original_model_dict
+
+ return (
+ output_messages,
+ finish_reasons,
+ usage_dict,
+ response_id,
+ tool_call_record,
+ num_tokens,
+ )
def _step_model_response(
self,
@@ -710,6 +687,7 @@ class ChatAgent(BaseAgent):
response_id: str,
tool_calls: List[FunctionCallingRecord],
num_tokens: int,
+ external_tool_request: Optional[ChatCompletionMessageToolCall] = None,
) -> Dict[str, Any]:
# Loop over responses terminators, get list of termination
# tuples with whether the terminator terminates the agent
@@ -737,6 +715,7 @@ class ChatAgent(BaseAgent):
finish_reasons,
num_tokens,
tool_calls,
+ external_tool_request,
)
return info
@@ -830,7 +809,7 @@ class ChatAgent(BaseAgent):
usage_dict = self.get_usage_dict(output_messages, prompt_tokens)
return output_messages, finish_reasons, usage_dict, response_id
- def step_token_exceed(
+ def _step_token_exceed(
self,
num_tokens: int,
tool_calls: List[FunctionCallingRecord],
diff --git a/camel/types/enums.py b/camel/types/enums.py
index 4f7d6384d..ec0805c01 100644
--- a/camel/types/enums.py
+++ b/camel/types/enums.py
@@ -92,6 +92,10 @@ class ModelType(Enum):
return self.value
return "gpt-4o-mini"
+ @property
+ def supports_tool_calling(self) -> bool:
+ return any([self.is_openai, self.is_gemini, self.is_mistral])
+
@property
def is_openai(self) -> bool:
r"""Returns whether this type of models is an OpenAI-released model."""
diff --git a/camel/utils/commons.py b/camel/utils/commons.py
index 727e0d77e..62935d609 100644
--- a/camel/utils/commons.py
+++ b/camel/utils/commons.py
@@ -29,6 +29,7 @@ from typing import (
Mapping,
Optional,
Set,
+ Type,
TypeVar,
cast,
)
@@ -329,12 +330,12 @@ def get_pydantic_major_version() -> int:
return 0
-def get_pydantic_object_schema(pydantic_params: BaseModel) -> Dict:
+def get_pydantic_object_schema(pydantic_params: Type[BaseModel]) -> Dict:
r"""Get the JSON schema of a Pydantic model.
Args:
- pydantic_params (BaseModel): The Pydantic model to retrieve the schema
- for.
+ pydantic_params (Type[BaseModel]): The Pydantic model class to retrieve
+ the schema for.
Returns:
dict: The JSON schema of the Pydantic model.
@@ -354,7 +355,7 @@ def func_string_to_callable(code: str):
"""
local_vars: Mapping[str, object] = {}
exec(code, globals(), local_vars)
- func = local_vars.get(Constants.FUNC_NAME_FOR_STRUCTURE_OUTPUT)
+ func = local_vars.get(Constants.FUNC_NAME_FOR_STRUCTURED_OUTPUT)
return func
@@ -397,7 +398,7 @@ def json_to_function_code(json_obj: Dict) -> str:
# function template
function_code = f'''
-def {Constants.FUNC_NAME_FOR_STRUCTURE_OUTPUT}({args_str}):
+def {Constants.FUNC_NAME_FOR_STRUCTURED_OUTPUT}({args_str}):
r"""Return response with a specified json format.
Args:
{docstring_args_str}
diff --git a/camel/utils/constants.py b/camel/utils/constants.py
index 5531e977f..659dd9968 100644
--- a/camel/utils/constants.py
+++ b/camel/utils/constants.py
@@ -26,7 +26,7 @@ class Constants:
VIDEO_DEFAULT_PLUG_PYAV = "pyav"
# Return response with json format
- FUNC_NAME_FOR_STRUCTURE_OUTPUT = "return_json_response"
+ FUNC_NAME_FOR_STRUCTURED_OUTPUT = "return_json_response"
# Default top k vaule for RAG
DEFAULT_TOP_K_RESULTS = 1
diff --git a/docs/conf.py b/docs/conf.py
index 41122c26c..affdd6baa 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('..'))
project = 'CAMEL'
copyright = '2023, CAMEL-AI.org'
author = 'CAMEL-AI.org'
-release = '0.1.7.2'
+release = '0.1.8'
html_favicon = (
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'
diff --git a/docs/get_started/setup.md b/docs/get_started/setup.md
index 079d0f828..d6a69d876 100644
--- a/docs/get_started/setup.md
+++ b/docs/get_started/setup.md
@@ -61,7 +61,7 @@ conda create --name camel python=3.10
conda activate camel
# Clone github repo
-git clone -b v0.1.7.2 https://github.com/camel-ai/camel.git
+git clone -b v0.1.8 https://github.com/camel-ai/camel.git
# Change directory into project directory
cd camel
diff --git a/examples/external_tools/use_external_tools.py b/examples/external_tools/use_external_tools.py
new file mode 100644
index 000000000..86c6830ac
--- /dev/null
+++ b/examples/external_tools/use_external_tools.py
@@ -0,0 +1,85 @@
+# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
+# Licensed under the Apache License, Version 2.0 (the “License”);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an “AS IS” BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========
+
+from camel.agents import ChatAgent
+from camel.configs import ChatGPTConfig
+from camel.messages import BaseMessage
+from camel.models import ModelFactory
+from camel.toolkits import MATH_FUNCS, SEARCH_FUNCS
+from camel.types import ModelPlatformType, ModelType
+
+
+def main():
+ # Set the tools for the external_tools
+ internal_tools = SEARCH_FUNCS
+ external_tools = MATH_FUNCS
+ tool_list = internal_tools + external_tools
+
+ model_config_dict = ChatGPTConfig(
+ tools=tool_list,
+ temperature=0.0,
+ ).as_dict()
+
+ model = ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_3_5_TURBO,
+ model_config_dict=model_config_dict,
+ )
+
+ # Set external_tools
+ external_tool_agent = ChatAgent(
+ system_message=BaseMessage.make_assistant_message(
+ role_name="Tools calling operator",
+ content="You are a helpful assistant",
+ ),
+ model=model,
+ tools=internal_tools,
+ external_tools=external_tools,
+ )
+
+ usr_msg = BaseMessage.make_user_message(
+ role_name="User",
+ content="When is the release date of the video game Portal?",
+ )
+
+ # This will directly run the internal tool
+ response = external_tool_agent.step(usr_msg)
+ print(response.msg.content)
+
+ usr_msg = BaseMessage.make_user_message(
+ role_name="User",
+ content="What's the result of the release year of Portal subtracted by"
+ "the year that United States was founded?",
+ )
+ # This will first automatically run the internal tool to check the years
+ # Then it will request the external tool to calculate the sum
+ response = external_tool_agent.step(usr_msg)
+ # This should be empty
+ print(response.msg.content)
+ external_tool_request = response.info["external_tool_request"]
+ # This will print the info of the external tool request
+ print(external_tool_request)
+
+
+if __name__ == "__main__":
+ main()
+
+
+# flake8: noqa :E501
+"""
+Output:
+The video game "Portal" was released in 2007 as part of a bundle called The Orange Box for Windows, Xbox 360, and PlayStation 3.
+
+ChatCompletionMessageToolCall(id='call_U5Xju7vYtAQAEW4D1M8R1kgs', function=Function(arguments='{"a": 2007, "b": 1776}', name='sub'), type='function')
+"""
diff --git a/poetry.lock b/poetry.lock
index 94f23de06..21168b34b 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1640,19 +1640,19 @@ files = [
[[package]]
name = "filelock"
-version = "3.15.4"
+version = "3.16.0"
description = "A platform independent file lock."
optional = false
python-versions = ">=3.8"
files = [
- {file = "filelock-3.15.4-py3-none-any.whl", hash = "sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7"},
- {file = "filelock-3.15.4.tar.gz", hash = "sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb"},
+ {file = "filelock-3.16.0-py3-none-any.whl", hash = "sha256:f6ed4c963184f4c84dd5557ce8fece759a3724b37b80c6c4f20a2f63a4dc6609"},
+ {file = "filelock-3.16.0.tar.gz", hash = "sha256:81de9eb8453c769b63369f87f11131a7ab04e367f8d97ad39dc230daa07e3bec"},
]
[package.extras]
-docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
-testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8.0.1)", "pytest (>=7.4.3)", "pytest-asyncio (>=0.21)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)", "virtualenv (>=20.26.2)"]
-typing = ["typing-extensions (>=4.8)"]
+docs = ["furo (>=2024.8.6)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"]
+testing = ["covdefaults (>=2.3)", "coverage (>=7.6.1)", "diff-cover (>=9.1.1)", "pytest (>=8.3.2)", "pytest-asyncio (>=0.24)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.26.3)"]
+typing = ["typing-extensions (>=4.12.2)"]
[[package]]
name = "filetype"
@@ -3239,13 +3239,13 @@ files = [
[[package]]
name = "litellm"
-version = "1.44.21"
+version = "1.44.22"
description = "Library to easily interface with LLM API providers"
optional = true
python-versions = "!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*,>=3.8"
files = [
- {file = "litellm-1.44.21-py3-none-any.whl", hash = "sha256:d68dabddacd051a10737b0b3da897ace18503d165702276157f14245c70b5266"},
- {file = "litellm-1.44.21.tar.gz", hash = "sha256:847744e7b4addb061fda6a6a0c105420fa29d4c1949941c35d34d21680716e1c"},
+ {file = "litellm-1.44.22-py3-none-any.whl", hash = "sha256:54da392b4f1182a068d61350a7c69e065d7e10c911e2def567d3bca7101b5385"},
+ {file = "litellm-1.44.22.tar.gz", hash = "sha256:815424f9da26e57fdcf99855e5a8b048c37b9b8686d010181a5eef640e59ff33"},
]
[package.dependencies]
@@ -3883,13 +3883,13 @@ files = [
[[package]]
name = "narwhals"
-version = "1.6.2"
+version = "1.6.3"
description = "Extremely lightweight compatibility layer between dataframe libraries"
optional = false
python-versions = ">=3.8"
files = [
- {file = "narwhals-1.6.2-py3-none-any.whl", hash = "sha256:f236fe14300dd85d877a8c05eb861805e2e0076c14b1d24af66d02fa98c245b6"},
- {file = "narwhals-1.6.2.tar.gz", hash = "sha256:caee5b13a62740787fa69fc7f13fb119e0d36a7a1f8797a70c2ec19bcecc0b5a"},
+ {file = "narwhals-1.6.3-py3-none-any.whl", hash = "sha256:478b7bef635b9d9434bb2dbe6261380ed8558fad58b403e7f914745e60b5892c"},
+ {file = "narwhals-1.6.3.tar.gz", hash = "sha256:02b73fb37fce78d7df5c72ec559718448225d64ca2a0854dc6472e3d8ce0906f"},
]
[package.extras]
@@ -4770,19 +4770,19 @@ xmp = ["defusedxml"]
[[package]]
name = "platformdirs"
-version = "4.2.2"
+version = "4.3.2"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
optional = false
python-versions = ">=3.8"
files = [
- {file = "platformdirs-4.2.2-py3-none-any.whl", hash = "sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee"},
- {file = "platformdirs-4.2.2.tar.gz", hash = "sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3"},
+ {file = "platformdirs-4.3.2-py3-none-any.whl", hash = "sha256:eb1c8582560b34ed4ba105009a4badf7f6f85768b30126f351328507b2beb617"},
+ {file = "platformdirs-4.3.2.tar.gz", hash = "sha256:9e5e27a08aa095dd127b9f2e764d74254f482fef22b0970773bfba79d091ab8c"},
]
[package.extras]
-docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"]
-test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
-type = ["mypy (>=1.8)"]
+docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"]
+test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"]
+type = ["mypy (>=1.11.2)"]
[[package]]
name = "pluggy"
@@ -7211,13 +7211,13 @@ tests = ["cython", "littleutils", "pygments", "pytest", "typeguard"]
[[package]]
name = "starlette"
-version = "0.38.4"
+version = "0.38.5"
description = "The little ASGI library that shines."
optional = false
python-versions = ">=3.8"
files = [
- {file = "starlette-0.38.4-py3-none-any.whl", hash = "sha256:526f53a77f0e43b85f583438aee1a940fd84f8fd610353e8b0c1a77ad8a87e76"},
- {file = "starlette-0.38.4.tar.gz", hash = "sha256:53a7439060304a208fea17ed407e998f46da5e5d9b1addfea3040094512a6379"},
+ {file = "starlette-0.38.5-py3-none-any.whl", hash = "sha256:632f420a9d13e3ee2a6f18f437b0a9f1faecb0bc42e1942aa2ea0e379a4c4206"},
+ {file = "starlette-0.38.5.tar.gz", hash = "sha256:04a92830a9b6eb1442c766199d62260c3d4dc9c4f9188360626b1e0273cb7077"},
]
[package.dependencies]
@@ -8212,13 +8212,13 @@ standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)",
[[package]]
name = "virtualenv"
-version = "20.26.3"
+version = "20.26.4"
description = "Virtual Python Environment builder"
optional = false
python-versions = ">=3.7"
files = [
- {file = "virtualenv-20.26.3-py3-none-any.whl", hash = "sha256:8cc4a31139e796e9a7de2cd5cf2489de1217193116a8fd42328f1bd65f434589"},
- {file = "virtualenv-20.26.3.tar.gz", hash = "sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a"},
+ {file = "virtualenv-20.26.4-py3-none-any.whl", hash = "sha256:48f2695d9809277003f30776d155615ffc11328e6a0a8c1f0ec80188d7874a55"},
+ {file = "virtualenv-20.26.4.tar.gz", hash = "sha256:c17f4e0f3e6036e9f26700446f85c76ab11df65ff6d8a9cbfad9f71aabfcf23c"},
]
[package.dependencies]
@@ -8623,103 +8623,103 @@ files = [
[[package]]
name = "yarl"
-version = "1.10.0"
+version = "1.11.0"
description = "Yet another URL library"
optional = true
python-versions = ">=3.8"
files = [
- {file = "yarl-1.10.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:1718c0bca5a61edac7a57dcc11856cb01bde13a9360a3cb6baf384b89cfc0b40"},
- {file = "yarl-1.10.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e4657fd290d556a5f3018d07c7b7deadcb622760c0125277d10a11471c340054"},
- {file = "yarl-1.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:044b76d069e69c6b0246f071ebac0576f89c772f806d66ef51e662bd015d03c7"},
- {file = "yarl-1.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c5527d32506c11150ca87f33820057dc284e2a01a87f0238555cada247a8b278"},
- {file = "yarl-1.10.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:36d12d78b8b0d46099d413c8689b5510ad9ce5e443363d1c37b6ac5b3d7cbdfb"},
- {file = "yarl-1.10.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:11f7f8a72b3e26c533fa7ffa7a8068f4e3aad7b67c5cf7b17ea8c79fc81d9830"},
- {file = "yarl-1.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88173836a25b7e5dce989eeee3b92d8ef5cdf512830d4155c6212de98e616f70"},
- {file = "yarl-1.10.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c382e189af10070bcb39caa9406b9cc47b26c1d2257979f11fe03a38be09fea9"},
- {file = "yarl-1.10.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:534b8bc181dca1691cf491c263e084af678a8fb6b6181687c788027d8c317026"},
- {file = "yarl-1.10.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:5f3372f9ae1d1f001826b77d0b29d4220e84f6c5f53915e71a825cdd02600065"},
- {file = "yarl-1.10.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:4cca9ba00be4bb8a051c4007b60fc91d6c9728c8b70c86cee4c24be9d641002f"},
- {file = "yarl-1.10.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:a9d8c4be5658834dc688072239d220631ad4b71ff79a5f3d17fb653f16d10759"},
- {file = "yarl-1.10.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:ff45a655ca51e1cb778abbb586083fddb7d896332f47bb3b03bc75e30c25649f"},
- {file = "yarl-1.10.0-cp310-cp310-win32.whl", hash = "sha256:9ef7ce61958b3c7b2e2e0927c52d35cf367c5ee410e06e1337ecc83a90c23b95"},
- {file = "yarl-1.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:48a48261f8d610b0e15fed033e74798763bc2f8f2c0d769a2a0732511af71f1e"},
- {file = "yarl-1.10.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:308d1cce071b5b500e3d95636bbf15dfdb8e87ed081b893555658a7f9869a156"},
- {file = "yarl-1.10.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:bc66927f6362ed613a483c22618f88f014994ccbd0b7a25ec1ebc8c472d4b40a"},
- {file = "yarl-1.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c4d13071c5b99974cfe2f94c749ecc4baf882f7c4b6e4c40ca3d15d1b7e81f24"},
- {file = "yarl-1.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:348ad53acd41caa489df7db352d620c982ab069855d9635dda73d685bbbc3636"},
- {file = "yarl-1.10.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:293f7c2b30d015de3f1441c4ee764963b86636fde881b4d6093498d1e8711f69"},
- {file = "yarl-1.10.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:315e8853d0ea46aabdce01f1f248fff7b9743de89b555c5f0487f54ac84beae8"},
- {file = "yarl-1.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:012c506b2c23be4500fb97509aa7e6a575996fb317b80667fa26899d456e2aaf"},
- {file = "yarl-1.10.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5f769c2708c31227c5349c3e4c668c8b4b2e25af3e7263723f2ef33e8e3906a0"},
- {file = "yarl-1.10.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4f6ac063a4e9bbd4f6cc88cc621516a44d6aec66862ea8399ba063374e4b12c7"},
- {file = "yarl-1.10.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:18b7ce6d8c35da8e16dcc8de124a80e250fc8c73f8c02663acf2485c874f1972"},
- {file = "yarl-1.10.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:b80246bdee036381636e73ef0f19b032912064622b0e5ee44f6960fd11df12aa"},
- {file = "yarl-1.10.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:183dd37bb5471e8017ab8a998c1ea070b4a0b08a97a7c4e20e0c7ccbe8ebb999"},
- {file = "yarl-1.10.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9b6d0d7522b514f054b359409817af4c5ed76fa4fe42d8bd1ed12956804cf595"},
- {file = "yarl-1.10.0-cp311-cp311-win32.whl", hash = "sha256:6026a6ef14d038a38ca9d81422db4b6bb7d5da94f9d08f21e0ad9ebd9c4bc3bb"},
- {file = "yarl-1.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:190e70d2f9f16f1c9d666c103d635c9ed4bf8de7803e9fa0495eec405a3e96a8"},
- {file = "yarl-1.10.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:6bc602c7413e1b5223bc988947125998cb54d6184de45a871985daacc23e6c8c"},
- {file = "yarl-1.10.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:bf733c835ebbd52bd78a52b919205e0f06d8571f71976a0259e5bcc20d0a2f44"},
- {file = "yarl-1.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6e91ed5f6818e1e3806eaeb7b14d9e17b90340f23089451ea59a89a29499d760"},
- {file = "yarl-1.10.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:23057a004bc9735008eb2a04b6ce94c6c06219cdf2b193997fd3ae6039eb3196"},
- {file = "yarl-1.10.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2b922c32a1cff62bc43d408d1a8745abeed0a705793f2253c622bf3521922198"},
- {file = "yarl-1.10.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:be199fed28861d72df917e355287ad6835555d8210e7f8203060561f24d7d842"},
- {file = "yarl-1.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5cece693380c1c4a606cdcaa0c54eda8f72cfe1ba83f5149b9023bb955e8fa8e"},
- {file = "yarl-1.10.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ff8e803d8ca170e632fb3b4df1bfd29ba29be8edc3e9306c5ffa5fadea234a4f"},
- {file = "yarl-1.10.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:30dde3a8b88c80a4f049eb4dd240d2a02e89174da6be2525541f949bf9fa38ab"},
- {file = "yarl-1.10.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:dff84623e7098cf9bfbb5187f9883051af652b0ce08b9f7084cc8630b87b6457"},
- {file = "yarl-1.10.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:8e69b55965a47dd6c79e578abd7d85637b1bb4a7565436630826bdb28aa9b7ad"},
- {file = "yarl-1.10.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:5d0c9e1dcc92d46ca89608fe4763fc2362f1e81c19a922c67dbc0f20951466e4"},
- {file = "yarl-1.10.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:32e79d5ae975f7c2cc29f7104691fc9be5ee3724f24e1a7254d72f6219672108"},
- {file = "yarl-1.10.0-cp312-cp312-win32.whl", hash = "sha256:762a196612c2aba4197cd271da65fe08308f7ddf130dc63842c7a76d774b6a2c"},
- {file = "yarl-1.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:8c6214071f653d21bb7b43f7ee519afcbf7084263bb43408f4939d14558290db"},
- {file = "yarl-1.10.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:0e0aea8319fdc1ac340236e58b0b7dc763621bce6ce98124a9d58104cafd0aaa"},
- {file = "yarl-1.10.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0b3bf343b4ef9ec600d75363eb9b48ab3bd53b53d4e1c5a9fbf0cfe7ba73a47f"},
- {file = "yarl-1.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:05b07e6e0f715eaae9d927a302d9220724392f3c0b4e7f8dfa174bf2e1b8433e"},
- {file = "yarl-1.10.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8d7bd531d7eec4aa7ef8a99fef91962eeea5158a53af0ec507c476ddf8ebc29c"},
- {file = "yarl-1.10.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:183136dc5d5411872e7529c924189a2e26fac5a7f9769cf13ef854d1d653ad36"},
- {file = "yarl-1.10.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c77a3c10af4aaf8891578fe492ef0990c65cf7005dd371f5ea8007b420958bf6"},
- {file = "yarl-1.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:030d41d48217b180c5a176e59c49d212d54d89f6f53640fa4c1a1766492aec27"},
- {file = "yarl-1.10.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6f4f43ba30d604ba391bc7fe2dd104d6b87b62b0de4bbde79e362524b8a1eb75"},
- {file = "yarl-1.10.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:637dd0f55d1781d4634c23994101c509e455b5ab61af9086b5763b7eca9359aa"},
- {file = "yarl-1.10.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:99e7459ee86a3b81e57777afd3825b8b1acaac8a99f9c0bd02415d80eb3c371b"},
- {file = "yarl-1.10.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:a80cdb3c15c15b33ecdb080546dcb022789b0084ca66ad41ffa0fe09857fca11"},
- {file = "yarl-1.10.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:1824bfb932d8100e5c94f4f98c078f23ebc6f6fa93acc3d95408762089c54a06"},
- {file = "yarl-1.10.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:90fd64ce00f594db02f603efa502521c440fa1afcf6266be82eb31f19d2d9561"},
- {file = "yarl-1.10.0-cp313-cp313-win32.whl", hash = "sha256:687131ee4d045f3d58128ca28f5047ec902f7760545c39bbe003cc737c5a02b5"},
- {file = "yarl-1.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:493ad061ee025c5ed3a60893cd70204eead1b3f60ccc90682e752f95b845bd46"},
- {file = "yarl-1.10.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:cd65588273d19f8483bc8f32a6fcf602e94a9a7ba287a1725977bd9527cd6c0c"},
- {file = "yarl-1.10.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6f64f8681671624f539eea5564518bc924524c25eb90ab24a7eddc2d872e668e"},
- {file = "yarl-1.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3576ed2c51f8525d4ff5c3279247aacff9540bb43b292c4a37a8e6c6e1691adb"},
- {file = "yarl-1.10.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca42a9281807fdf8fba86e671d8fdd76f92e9302a6d332957f2bae51c774f8a7"},
- {file = "yarl-1.10.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:54a4b5e6a060d46cad6a3cf340f4cb268e6fbc89c589d82a2da58f7db47c47c8"},
- {file = "yarl-1.10.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6eec21d8c3aa932c5a89480b58fa877e9c48092ab838ccc76788cbc917ceec0d"},
- {file = "yarl-1.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:273baee8a8af5989d5aab51c740e65bc2b1fc6619b9dd192cd16a3fae51100be"},
- {file = "yarl-1.10.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c1bf63ba496cd4f12d30e916d9a52daa6c91433fedd9cd0d99fef3e13232836f"},
- {file = "yarl-1.10.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:f8e24b9a4afdffab399191a9f0b0e80eabc7b7fdb9f2dbccdeb8e4d28e5c57bb"},
- {file = "yarl-1.10.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:4c46454fafa31f7241083a0dd21814f63e0fcb4ae49662dc7e286fd6a5160ea1"},
- {file = "yarl-1.10.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:beda87b63c08fb4df8cc5353eeefe68efe12aa4f5284958bd1466b14c85e508e"},
- {file = "yarl-1.10.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:9a8d6a0e2b5617b5c15c59db25f20ba429f1fea810f2c09fbf93067cb21ab085"},
- {file = "yarl-1.10.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:b453b3dbc1ed4c2907632d05b378123f3fb411cad05d8d96de7d95104ef11c70"},
- {file = "yarl-1.10.0-cp38-cp38-win32.whl", hash = "sha256:1ea30675fbf0ad6795c100da677ef6a8960a7db05ac5293f02a23c2230203c89"},
- {file = "yarl-1.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:347011ad09a8f9be3d41fe2d7d611c3a4de4d49aa77bcb9a8c03c7a82fc45248"},
- {file = "yarl-1.10.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:18bc4600eed1907762c1816bb16ac63bc52912e53b5e9a353eb0935a78e95496"},
- {file = "yarl-1.10.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:eeb6a40c5ae2616fd38c1e039c6dd50031bbfbc2acacfd7b70a5d64fafc70901"},
- {file = "yarl-1.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:bc544248b5263e1c0f61332ccf35e37404b54213f77ed17457f857f40af51452"},
- {file = "yarl-1.10.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3352c69dc235850d6bf8ddad915931f00dcab208ac4248b9af46175204c2f5f9"},
- {file = "yarl-1.10.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:af5b52bfbbd5eb208cf1afe23c5ada443929e9b9d79e9fbc66cacc07e4e39748"},
- {file = "yarl-1.10.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1eafa7317063de4bc310716cdd9026c13f00b1629e649079a6908c3aafdf5046"},
- {file = "yarl-1.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a162cf04fd1e8d81025ec651d14cac4f6e0ca73a3c0a9482de8691b944e3098a"},
- {file = "yarl-1.10.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:179b1df5e9cd99234ea65e63d5bfc6dd524b2c3b6cf68a14b94ccbe01ab37ddd"},
- {file = "yarl-1.10.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:32d2e46848dea122484317485129f080220aa84aeb6a9572ad9015107cebeb07"},
- {file = "yarl-1.10.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:aa1aeb99408be0ca774c5126977eb085fedda6dd7d9198ce4ceb2d06a44325c7"},
- {file = "yarl-1.10.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:d2366e2f987f69752f0588d2035321aaf24272693d75f7f6bb7e8a0f48f7ccdd"},
- {file = "yarl-1.10.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:e8da33665ecc64cd3e593098adb449f9c65b4e3bc6338e75ad592da15453d898"},
- {file = "yarl-1.10.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:5b46c603bee1f2dd407b8358c2afc9b0472a22ccca528f114e1f4cd30dfecd22"},
- {file = "yarl-1.10.0-cp39-cp39-win32.whl", hash = "sha256:96422a3322b4d954f4c52403a2fc129ad118c151ee60a717847fb46a8480d1e1"},
- {file = "yarl-1.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:52d1ae09b0764017e330bb5bf9af760c0168c564225085bb806f687bccffda8a"},
- {file = "yarl-1.10.0-py3-none-any.whl", hash = "sha256:99eaa7d53f509ba1c2fea8fdfec15ba3cd36caca31d57ec6665073b148b5f260"},
- {file = "yarl-1.10.0.tar.gz", hash = "sha256:3bf10a395adac62177ba8ea738617e8de6cbb1cea6aa5d5dd2accde704fc8195"},
+ {file = "yarl-1.11.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:0a657db1b9982f3dac0e360614d0e8945d2873da6e681fb7fca23ef1c3eb37f8"},
+ {file = "yarl-1.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:65a1a05efca52b102691e64db5fcf973030a1c88fee393804ff91f99c95a6e74"},
+ {file = "yarl-1.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f4cb417d380e2d77961eecec75aaaf6f7ab14e6de26eb3a498f498029a6556a1"},
+ {file = "yarl-1.11.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8aee7c8378c6aa3103b99d1eb9995268ef730fa9f88ea68b9eee4341e204eec9"},
+ {file = "yarl-1.11.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:84624db40e2358cfd5cf2558b1aaffd93366d27ee32228a97785f2ec87d44a17"},
+ {file = "yarl-1.11.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2a596bb15e036952549871a4ccd2205679902dc7f241e3ced6b2ab2e44c55795"},
+ {file = "yarl-1.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c9d4d2cc4b076c8ad0175a15ee9482a387b3303c97d4b71062db7356b2ac04c7"},
+ {file = "yarl-1.11.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:25f8bc849004122591104793a576e9c747b0e5d9486d6a30225521b817255748"},
+ {file = "yarl-1.11.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:e38176a559edde0cfff4b663791a007a5f9f90c73aee1d6f7ddbcf6bfb7287b3"},
+ {file = "yarl-1.11.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:706ac0f77b45e9e0278ec6c98929764e119d3ce3136792b6475e7ae961da53ec"},
+ {file = "yarl-1.11.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:48bac099586cf75ae5837b0ac17a674450d01f451f38afcb02acfc940110b60b"},
+ {file = "yarl-1.11.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:540fd5f62fe21f3d1d9efe8af5c4d9dbbb184ce03ce95acb0289500e46215dd2"},
+ {file = "yarl-1.11.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:05ab59db0bb64e847972373c5cda8924e6605480f6b13cc04573fa0d87bfc637"},
+ {file = "yarl-1.11.0-cp310-cp310-win32.whl", hash = "sha256:ddab47748933ac9cf5f29d6e9e2e2060cff40b2751d02c55129661ea4e577152"},
+ {file = "yarl-1.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:976d02274e6d88b24c7131e7b26a083412b2592f2bbcef53d3b00b2508cad26c"},
+ {file = "yarl-1.11.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:39e3087e1ef70862de81e22af9eb299faee580f41673ef92829949022791b521"},
+ {file = "yarl-1.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7fd535cc41b81a566ad347081b671ab5c7e5f5b6a15526d85b4e748baf065cf0"},
+ {file = "yarl-1.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f7cc02d8e9a612174869f4b983f159e87659096f7e2dc1fe9effd9902e408739"},
+ {file = "yarl-1.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:30f391ccf4b1b1e0ba4880075ba337d41a619a5350f67053927f67ebe764bf44"},
+ {file = "yarl-1.11.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4c19a0d95943bb2c914b4e71043803be34bc75c08c4a6ca232bdc649a1e9ef1b"},
+ {file = "yarl-1.11.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ead4d89eade0e09b8ef97877664abb0e2e8704787db5564f83658fdee5c36497"},
+ {file = "yarl-1.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:195f7791bc23d5f2480efe53f935daf8a61661000dfbfbdd70dbd06397594fff"},
+ {file = "yarl-1.11.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:01a7905e662665ca8e058635377522bc3c98bdb873be761ff42c86eb72b03914"},
+ {file = "yarl-1.11.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:53c80b1927b75aed208d7fd965a3a705dc8c1db4d50b9112418fa0f7784363e6"},
+ {file = "yarl-1.11.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:11af21bbf807688d49b7d4915bb28cbc2e3aa028a2ee194738477eabcc413c65"},
+ {file = "yarl-1.11.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:732d56da00ea7a5da4f0d15adbbd22dcb37da7825510aafde40112e53f6baa52"},
+ {file = "yarl-1.11.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:7bd54d79025b59d1dc5fb26a09734d6a9cc651a04bc381966ed264b28331a168"},
+ {file = "yarl-1.11.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:aacd62ff67efd54cb18cea2aa7ae4fb83cfbca19a07055d4777266b70561defe"},
+ {file = "yarl-1.11.0-cp311-cp311-win32.whl", hash = "sha256:68e14ae71e5b51c8282ae5db53ccb3baffc40e1551370a8a2361f1c1d8a0bf8c"},
+ {file = "yarl-1.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:3ade2265716667b6bd4123d6f684b5f7cf4a8d83dcf1d5581ac44643466bb00a"},
+ {file = "yarl-1.11.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:6e73dab98e3c3b5441720153e72a5f28e717aac2d22f1ec4b08ef33417d9987e"},
+ {file = "yarl-1.11.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:4a0d090d296ced05edfe29c6ff34869412fa6a97d0928c12b00939c4842884cd"},
+ {file = "yarl-1.11.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d29e446cfb0a82d3df7745968b9fa286665a9be8b4d68de46bcc32d917cb218e"},
+ {file = "yarl-1.11.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4c8dc0efcf8266ecfe057b95e01f43eb62516196a4bbf3918fd1dcb8d0dc0dff"},
+ {file = "yarl-1.11.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:202f5ec49ff163dcc767426deb55020a28078e61d6bbe1f80331d92bca53b236"},
+ {file = "yarl-1.11.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8055b0d78ce1cafa657c4b455e22661e8d3b2834de66a0753c3567da47fcc4aa"},
+ {file = "yarl-1.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:60ed3c7f64e820959d7f682ec2f559b4f4df723dc09df619d269853a4214a4b4"},
+ {file = "yarl-1.11.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2371510367d39d74997acfdcd1dead17938c79c99365482821627f7838a8eba0"},
+ {file = "yarl-1.11.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e24bb6a8be89ccc3ce8c47e8940fdfcb7429e9efbf65ce6fa3e7d122fcf0bcf0"},
+ {file = "yarl-1.11.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:18ec42da256cfcb9b4cd5d253e04c291f69911a5228d1438a7d431c15ba0ae40"},
+ {file = "yarl-1.11.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:418eeb8f228ea36c368bf6782ebd6016ecebfb1a8b90145ef6726ffcbba65ef8"},
+ {file = "yarl-1.11.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:07e8cfb1dd7669a129f8fd5df1da65efa73aea77582bde2a3a837412e2863543"},
+ {file = "yarl-1.11.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3c458483711d393dad51340505c3fab3194748fd06bab311d2f8b5b7a7349e9a"},
+ {file = "yarl-1.11.0-cp312-cp312-win32.whl", hash = "sha256:5b008c3127382503e7a1e12b4c3a3236e3dd833a4c62a066f4a0fbd650c655d2"},
+ {file = "yarl-1.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:bc94be7472b9f88d7441340534a3ecae05c86ccfec7ba75ce5b6e4778b2bfc6e"},
+ {file = "yarl-1.11.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a45e51ba3777031e0b20c1e7ab59114ed4e1884b3c1db48962c1d8d08aefb418"},
+ {file = "yarl-1.11.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:765128029218eade3a01187cdd7f375977cc827505ed31828196c8ae9b622928"},
+ {file = "yarl-1.11.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2516e238daf0339c8ac4dfab9d7cda9afad652ff073517f200d653d5d8371f7e"},
+ {file = "yarl-1.11.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d10be62bee117f05b1ad75a6c2538ca9e5367342dc8a4f3c206c87dadbc1189c"},
+ {file = "yarl-1.11.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:50ceaeda771ee3e382291168c90c7ede62b63ecf3e181024bcfeb35c0ea6c84f"},
+ {file = "yarl-1.11.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3a601c99fc20fd0eea84e7bc0dc9e7f196f55a0ded67242d724988c754295538"},
+ {file = "yarl-1.11.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42ff79371614764fc0a4ab8eaba9adb493bf9ad856e2a4664f6c754fc907a903"},
+ {file = "yarl-1.11.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93fca4c9f88c17ead902b3f3285b2d039fc8f26d117e1441973ba64315109b54"},
+ {file = "yarl-1.11.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e7dddf5f41395c84fc59e0ed5493b24bfeb39fb04823e880b52c8c55085d4695"},
+ {file = "yarl-1.11.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ea501ea07e14ba6364ff2621bfc8b2381e5b1e10353927fa9a607057fd2b98e5"},
+ {file = "yarl-1.11.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:a4f7e470f2c9c8b8774a5bda72adfb8e9dc4ec32311fe9bdaa4921e36cf6659b"},
+ {file = "yarl-1.11.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:361fdb3993431157302b7104d525092b5df4d7d346df5a5ffeee2d1ca8e0d15b"},
+ {file = "yarl-1.11.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e300eaf5e0329ad31b3d53e2f3d26b4b6dff1217207c6ab1d4212967b54b2185"},
+ {file = "yarl-1.11.0-cp313-cp313-win32.whl", hash = "sha256:f1e2d4ce72e06e38a16da3e9c24a0520dbc19018a69ef6ed57b6b38527cb275c"},
+ {file = "yarl-1.11.0-cp313-cp313-win_amd64.whl", hash = "sha256:fa9de2f87be58f714a230bd1f3ef3aad1ed65c9931146e3fc55f85fcbe6bacc3"},
+ {file = "yarl-1.11.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:24da0b38274727fe9266d09229987e7f0efdb97beb94c0bb2d327d65f112e78d"},
+ {file = "yarl-1.11.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0310eb2e63872de66047e05ad9982f2e53ad6405dc42fa60d7cc670bf6ca8aa8"},
+ {file = "yarl-1.11.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:52433604340a4ab3d1f32281c6eb9ad9b47c99435b4212f763121bf7348c8c00"},
+ {file = "yarl-1.11.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:98e2eb182d59f0845a79434003f94b4f61cd69465248f9388c2e5bf2191c9f7f"},
+ {file = "yarl-1.11.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b3dd10f0fe0e0f659926c1da791de5bef05fd48974ad74618c9168e302e2b7cc"},
+ {file = "yarl-1.11.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:121d3798e4bb35a4321b2422cb887f80ea39f94bf52f0eb5cb2c168bb0043c9b"},
+ {file = "yarl-1.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8bbac56c80610dd659ace534765d7bcd2488f6600023f6984f35108b2b3f4f0"},
+ {file = "yarl-1.11.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:79d420399f0e82e302236a762d8b8ceec89761ce3b30c83ac1d4d6e29f811444"},
+ {file = "yarl-1.11.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:03a726fb50588307dfe1d233b67535d493fb0bb157bdbfda6bb34e04189f2f57"},
+ {file = "yarl-1.11.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:9057f5de2fade7440e6db358913bc7ae8de43ba72c83cf95420a1fc1a6c6b59e"},
+ {file = "yarl-1.11.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:6471d747d0ac8059895e66d32ca8630c8db5b572ca7763150d0927eaa257df67"},
+ {file = "yarl-1.11.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:d97cb22ad380850754fa16ef8d490d9340d8573d81f73429f3975e8e87db0586"},
+ {file = "yarl-1.11.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:fe78dec8caeda1e7b353cbd8aa0cc5a5bc182b22998d64ec8fa9ee59c898ab3b"},
+ {file = "yarl-1.11.0-cp38-cp38-win32.whl", hash = "sha256:7ff371002fbbb79613269d76a2932c99979dac15fac30107064ef70d25f35474"},
+ {file = "yarl-1.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:4fa9d762eee63eed767895d68b994c58e29f809292a4d0fca483e9cc6fdc22c8"},
+ {file = "yarl-1.11.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:4ae63bc65e5bf8843bd1eca46e75eaa9eb157e0312fb362123181512892daad8"},
+ {file = "yarl-1.11.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3d1bd3262e00043907e0a6d7d4f7b7a4815281acc25699a2384552870c79f1f0"},
+ {file = "yarl-1.11.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0c58656c2e0b41b5d325130b8da4f8e216aad10029e7de5c523a6be25faa9fe8"},
+ {file = "yarl-1.11.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9425c333575fce5e0fb414b766492c6ba4aa335ef910a7540dbdefe58a78232e"},
+ {file = "yarl-1.11.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9dc66e2420e1e282105071934883bbb9c37c16901b5b8aa0a8aee370b477eac6"},
+ {file = "yarl-1.11.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2949067359d1ef5bf3228c7f1deb102c209832a13df5419239f99449bc1d3fa9"},
+ {file = "yarl-1.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c006fe73f851cf20b9986b3b4cc15239795bd5da9c3fda76bb3e043da5bec4ff"},
+ {file = "yarl-1.11.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:969ad4ee3892e893471b6572bbf2bbb091f93e7c81de25d6b3a5c0a5126e5ccb"},
+ {file = "yarl-1.11.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:c9fbe9dc6ee8bfe1af34137e3add6f0e49799dd5467dd6af189d27616879161e"},
+ {file = "yarl-1.11.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:69a45c711fea9b783b592a75f26f6dc59b2e4a923b97bf6eec357566fcb1d922"},
+ {file = "yarl-1.11.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:1a29b82c42a7791ffe53ee6dfbf29acc61ea7ec05643dcacc50510ed6187b897"},
+ {file = "yarl-1.11.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ed0c090f00c3fc024f7b0799cab9dd7c419fcd8f1a00634d1f9952bab7e7bfb2"},
+ {file = "yarl-1.11.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:31df9d9b3fe6e15decee629fc7976a5fb21eaa39e290f60e57e1d422827194c6"},
+ {file = "yarl-1.11.0-cp39-cp39-win32.whl", hash = "sha256:fcb7c36ba8b663a5900e6d40533f0e698ba0f38f744aad5410d4e38129e41a70"},
+ {file = "yarl-1.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:c6c0d640bad721834a737e25267fb71d296684ada21ca7d5ad2e63da7b73f1b7"},
+ {file = "yarl-1.11.0-py3-none-any.whl", hash = "sha256:03717a6627e55934b2a1d9caf24f299b461a2e8d048a90920f42ad5c20ae1b82"},
+ {file = "yarl-1.11.0.tar.gz", hash = "sha256:f86f4f4a57a29ef08fa70c4667d04c5e3ba513500da95586208b285437cb9592"},
]
[package.dependencies]
diff --git a/pyproject.toml b/pyproject.toml
index 7ee2e0761..9b3afc8d2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "camel-ai"
-version = "0.1.7.2"
+version = "0.1.8"
authors = ["CAMEL-AI.org"]
description = "Communicative Agents for AI Society Study"
readme = "README.md"
diff --git a/test/agents/test_chat_agent.py b/test/agents/test_chat_agent.py
index 416f930bd..6c43c7ed8 100644
--- a/test/agents/test_chat_agent.py
+++ b/test/agents/test_chat_agent.py
@@ -32,7 +32,11 @@ from camel.memories import MemoryRecord
from camel.messages import BaseMessage
from camel.models import ModelFactory
from camel.terminators import ResponseWordsTerminator
-from camel.toolkits import MATH_FUNCS, OpenAIFunction
+from camel.toolkits import (
+ MATH_FUNCS,
+ SEARCH_FUNCS,
+ OpenAIFunction,
+)
from camel.types import (
ChatCompletion,
ModelPlatformType,
@@ -155,6 +159,47 @@ def test_chat_agent_step_with_structure_response():
), f"Key {key} not found in response content"
+def test_chat_agent_step_with_external_tools():
+ internal_tools = SEARCH_FUNCS
+ external_tools = MATH_FUNCS
+ tool_list = internal_tools + external_tools
+
+ model_config_dict = ChatGPTConfig(
+ tools=tool_list,
+ temperature=0.0,
+ ).as_dict()
+
+ model = ModelFactory.create(
+ model_platform=ModelPlatformType.OPENAI,
+ model_type=ModelType.GPT_3_5_TURBO,
+ model_config_dict=model_config_dict,
+ )
+
+ # Set external_tools
+ external_tool_agent = ChatAgent(
+ system_message=BaseMessage.make_assistant_message(
+ role_name="Tools calling operator",
+ content="You are a helpful assistant",
+ ),
+ model=model,
+ tools=internal_tools,
+ external_tools=external_tools,
+ )
+
+ usr_msg = BaseMessage.make_user_message(
+ role_name="User",
+ content="What's the result of the release year of Portal subtracted "
+ "from the year that United States was founded?",
+ )
+
+ response = external_tool_agent.step(usr_msg)
+ assert not response.msg.content
+
+ external_tool_request = response.info["external_tool_request"]
+ assert external_tool_request.function.name == "sub"
+
+
@pytest.mark.model_backend
def test_chat_agent_messages_window():
system_msg = BaseMessage(
@@ -368,30 +413,6 @@ def test_set_multiple_output_language():
assert agent.system_message.content == updated_system_message.content
-def test_token_exceed_return():
- system_message = BaseMessage(
- role_name="assistant",
- role_type=RoleType.ASSISTANT,
- meta_dict=None,
- content="You are a help assistant.",
- )
- agent = ChatAgent(system_message=system_message)
-
- expect_info = {
- "id": None,
- "usage": None,
- "termination_reasons": ["max_tokens_exceeded"],
- "num_tokens": 1000,
- "tool_calls": [],
- }
- agent.terminated = True
- response = agent.step_token_exceed(1000, [], "max_tokens_exceeded")
- assert response.msgs == []
- assert response.terminated
- assert response.info == expect_info
-
-
@pytest.mark.model_backend
def test_function_enabled():
system_message = BaseMessage(
@@ -452,8 +473,6 @@ def test_tool_calling_sync():
tool_calls: List[FunctionCallingRecord] = [
call for call in agent_response.info['tool_calls']
]
- for called_func in tool_calls:
- print(str(called_func))
assert len(tool_calls) > 0
assert str(tool_calls[0]).startswith("Function Execution")
@@ -497,13 +516,9 @@ async def test_tool_calling_math_async():
)
agent_response = await agent.step_async(user_msg)
- tool_calls: List[FunctionCallingRecord] = [
- call for call in agent_response.info['tool_calls']
- ]
- for called_func in tool_calls:
- print(str(called_func))
+ tool_calls = agent_response.info['tool_calls']
- assert len(tool_calls) > 0
+ assert tool_calls
assert str(tool_calls[0]).startswith("Function Execution")
assert tool_calls[0].func_name == "mul"
@@ -558,13 +573,9 @@ async def test_tool_calling_async():
)
agent_response = await agent.step_async(user_msg)
- tool_calls: List[FunctionCallingRecord] = [
- call for call in agent_response.info['tool_calls']
- ]
- for called_func in tool_calls:
- print(str(called_func))
+ tool_calls = agent_response.info['tool_calls']
- assert len(tool_calls) > 0
+ assert tool_calls
assert str(tool_calls[0]).startswith("Function Execution")
assert tool_calls[0].func_name == "async_sleep"