From f992c99476905e43b42d45d19087474b03272fa4 Mon Sep 17 00:00:00 2001 From: Kye Date: Wed, 24 Apr 2024 20:49:14 -0400 Subject: [PATCH] [FEAT][get_openai_function_schema] --- swarms/tools/__init__.py | 32 ++++++++++++++++------ swarms/tools/py_func_to_openai_func_str.py | 4 +-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/swarms/tools/__init__.py b/swarms/tools/__init__.py index 7c243efb..cf5e9a59 100644 --- a/swarms/tools/__init__.py +++ b/swarms/tools/__init__.py @@ -24,28 +24,44 @@ from swarms.tools.pydantic_to_json import ( from swarms.tools.openai_func_calling_schema import ( OpenAIFunctionCallSchema, ) +from swarms.tools.py_func_to_openai_func_str import ( + get_parameter_json_schema, + get_required_params, + get_parameters, + get_openai_function_schema, + get_load_param_if_needed_function, + load_basemodels_if_needed, + serialize_to_str, +) __all__ = [ - "scrape_tool_func_docs", - "CodeExecutor", - "tool_find_by_name", - "extract_tool_commands", - "parse_and_execute_tools", - "execute_tools", "BaseTool", "Tool", "StructuredTool", "tool", + "CodeExecutor", "AgentAction", - "BaseAgentOutputParser", - "preprocess_json_input", "AgentOutputParser", + "BaseAgentOutputParser", "execute_tool_by_name", + "preprocess_json_input", + "execute_tools", + "extract_tool_commands", + "parse_and_execute_tools", + "scrape_tool_func_docs", + "tool_find_by_name", "_remove_a_key", "pydantic_to_functions", "multi_pydantic_to_functions", "function_to_str", "functions_to_str", "OpenAIFunctionCallSchema", + "get_parameter_json_schema", + "get_required_params", + "get_parameters", + "get_openai_function_schema", + "get_load_param_if_needed_function", + "load_basemodels_if_needed", + "serialize_to_str", ] diff --git a/swarms/tools/py_func_to_openai_func_str.py b/swarms/tools/py_func_to_openai_func_str.py index fce670fc..2fd39736 100644 --- a/swarms/tools/py_func_to_openai_func_str.py +++ b/swarms/tools/py_func_to_openai_func_str.py @@ -453,10 +453,8 @@ def get_openai_function_schema( return model_dump(function) -def test(a: int = 1, b: int = 2): - return a + b -# +# def get_load_param_if_needed_function( t: Any, ) -> Optional[Callable[[Dict[str, Any], Type[BaseModel]], BaseModel]]: