17
17
from pydantic .fields import FieldInfo
18
18
from pydantic .json_schema import GenerateJsonSchema , JsonSchemaMode
19
19
20
- from marvin .types import Function , Tool
20
+ from marvin .types import Function , FunctionTool
21
21
from marvin .utilities .asyncio import run_sync
22
22
from marvin .utilities .logging import get_logger
23
23
@@ -63,7 +63,7 @@ def generate(self, schema: Any, mode: JsonSchemaMode = "validation"):
63
63
return json_schema
64
64
65
65
66
- def tool_from_type (type_ : U , tool_name : str = None ) -> Tool [U ]:
66
+ def tool_from_type (type_ : U , tool_name : str = None ) -> FunctionTool [U ]:
67
67
"""
68
68
Creates an OpenAI-compatible tool from a Python type.
69
69
"""
@@ -99,7 +99,7 @@ def tool_from_model(model: type[M], python_fn: Callable[[str], M] = None):
99
99
def tool_fn (** data ) -> M :
100
100
return TypeAdapter (model ).validate_python (data )
101
101
102
- return Tool [M ](
102
+ return FunctionTool [M ](
103
103
type = "function" ,
104
104
function = Function [M ].create (
105
105
name = model .__name__ ,
@@ -130,7 +130,7 @@ def tool_from_function(
130
130
fn , config = pydantic .ConfigDict (arbitrary_types_allowed = True )
131
131
).json_schema ()
132
132
133
- return Tool [T ](
133
+ return FunctionTool [T ](
134
134
type = "function" ,
135
135
function = Function [T ].create (
136
136
name = name or fn .__name__ ,
@@ -142,7 +142,7 @@ def tool_from_function(
142
142
143
143
144
144
def call_function_tool (
145
- tools : list [Tool ],
145
+ tools : list [FunctionTool ],
146
146
function_name : str ,
147
147
function_arguments_json : str ,
148
148
return_string : bool = False ,
0 commit comments