@@ -32,7 +32,7 @@ async def test_chat_stream(mock_model_client):
3232
3333
3434def test_function_to_jsonschema_no_description ():
35- def func (a : int , b : str = "ok" , c : float = None ) -> None :
35+ def func (a : int , b : str = "ok" , c : str = None ) -> None :
3636 """This is a test function."""
3737 pass
3838
@@ -45,7 +45,7 @@ def func(a: int, b: str = "ok", c: float = None) -> None:
4545 "properties" : {
4646 "a" : {"title" : "A" , "type" : "integer" },
4747 "b" : {"default" : "ok" , "title" : "B" , "type" : "string" },
48- "c" : {"default" : None , "title" : "C" , "type" : "number " },
48+ "c" : {"default" : None , "title" : "C" , "type" : "string " },
4949 },
5050 "required" : ["a" ],
5151 "title" : "func" ,
@@ -60,7 +60,7 @@ def test_function_to_jsonschema_annotated_with_string():
6060 def func (
6161 a : Annotated [int , "The description for parameter a" ],
6262 b : Annotated [str , "The description for parameter b" ] = "ok" ,
63- c : Annotated [float , "The description for parameter c" ] = None ,
63+ c : Annotated [str , "The description for parameter c" ] = None ,
6464 ) -> None :
6565 """This is a test function."""
6666 pass
@@ -87,7 +87,7 @@ def func(
8787 "default" : None ,
8888 "description" : "The description for parameter c" ,
8989 "title" : "C" ,
90- "type" : "number " ,
90+ "type" : "string " ,
9191 },
9292 },
9393 "required" : ["a" ],
@@ -103,9 +103,7 @@ def test_function_to_jsonschema_annotated_with_pydantic_field():
103103 def func (
104104 a : Annotated [int , Field (description = "The description for parameter a" )],
105105 b : Annotated [str , Field (description = "The description for parameter b" )] = "ok" ,
106- c : Annotated [
107- float , Field (description = "The description for parameter c" )
108- ] = None ,
106+ c : Annotated [str , Field (description = "The description for parameter c" )] = None ,
109107 ) -> None :
110108 """This is a test function."""
111109 pass
@@ -132,7 +130,7 @@ def func(
132130 "default" : None ,
133131 "description" : "The description for parameter c" ,
134132 "title" : "C" ,
135- "type" : "number " ,
133+ "type" : "string " ,
136134 },
137135 },
138136 "required" : ["a" ],
@@ -148,6 +146,7 @@ def test_function_to_jsonschema_default_to_pydantic_field():
148146 def func (
149147 a : int = Field (description = "The description for parameter a" ),
150148 b : str = Field (default = "ok" , description = "The description for parameter b" ),
149+ c : str = Field (default = None , description = "The description for parameter c" ),
151150 ) -> None :
152151 """This is a test function."""
153152 pass
@@ -170,6 +169,12 @@ def func(
170169 "title" : "B" ,
171170 "type" : "string" ,
172171 },
172+ "c" : {
173+ "default" : None ,
174+ "description" : "The description for parameter c" ,
175+ "title" : "C" ,
176+ "type" : "string" ,
177+ },
173178 },
174179 "required" : ["a" ],
175180 "title" : "func" ,
0 commit comments