6363 from openai import Stream
6464
6565 from camel .terminators import ResponseTerminator
66- from camel .toolkits import OpenAIFunction
66+ from camel .toolkits import FunctionTool
6767
6868
6969logger = logging .getLogger (__name__ )
@@ -131,10 +131,10 @@ class ChatAgent(BaseAgent):
131131 (default: :obj:`None`)
132132 output_language (str, optional): The language to be output by the
133133 agent. (default: :obj:`None`)
134- tools (List[OpenAIFunction ], optional): List of available
135- :obj:`OpenAIFunction `. (default: :obj:`None`)
136- external_tools (List[OpenAIFunction ], optional): List of external tools
137- (:obj:`OpenAIFunction `) bind to one chat agent. When these tools
134+ tools (List[FunctionTool ], optional): List of available
135+ :obj:`FunctionTool `. (default: :obj:`None`)
136+ external_tools (List[FunctionTool ], optional): List of external tools
137+ (:obj:`FunctionTool `) bind to one chat agent. When these tools
138138 are called, the agent will directly return the request instead of
139139 processing it. (default: :obj:`None`)
140140 response_terminators (List[ResponseTerminator], optional): List of
@@ -150,8 +150,8 @@ def __init__(
150150 message_window_size : Optional [int ] = None ,
151151 token_limit : Optional [int ] = None ,
152152 output_language : Optional [str ] = None ,
153- tools : Optional [List [OpenAIFunction ]] = None ,
154- external_tools : Optional [List [OpenAIFunction ]] = None ,
153+ tools : Optional [List [FunctionTool ]] = None ,
154+ external_tools : Optional [List [FunctionTool ]] = None ,
155155 response_terminators : Optional [List [ResponseTerminator ]] = None ,
156156 ) -> None :
157157 self .orig_sys_message : BaseMessage = system_message
@@ -795,12 +795,12 @@ def _structure_output_with_function(
795795 r"""Internal function of structuring the output of the agent based on
796796 the given output schema.
797797 """
798- from camel .toolkits import OpenAIFunction
798+ from camel .toolkits import FunctionTool
799799
800800 schema_json = get_pydantic_object_schema (output_schema )
801801 func_str = json_to_function_code (schema_json )
802802 func_callable = func_string_to_callable (func_str )
803- func = OpenAIFunction (func_callable )
803+ func = FunctionTool (func_callable )
804804
805805 original_func_dict = self .func_dict
806806 original_model_dict = self .model_backend .model_config_dict
0 commit comments