@@ -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" ) -> None :
35+ def func (a : int , b : str = "ok" , c : float = None ) -> None :
3636 """This is a test function."""
3737 pass
3838
@@ -45,6 +45,7 @@ def func(a: int, b: str = "ok") -> 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" },
4849 },
4950 "required" : ["a" ],
5051 "title" : "func" ,
@@ -59,6 +60,7 @@ def test_function_to_jsonschema_annotated_with_string():
5960 def func (
6061 a : Annotated [int , "The description for parameter a" ],
6162 b : Annotated [str , "The description for parameter b" ] = "ok" ,
63+ c : Annotated [float , "The description for parameter c" ] = None ,
6264 ) -> None :
6365 """This is a test function."""
6466 pass
@@ -81,6 +83,12 @@ def func(
8183 "title" : "B" ,
8284 "type" : "string" ,
8385 },
86+ "c" : {
87+ "default" : None ,
88+ "description" : "The description for parameter c" ,
89+ "title" : "C" ,
90+ "type" : "number" ,
91+ },
8492 },
8593 "required" : ["a" ],
8694 "title" : "func" ,
@@ -95,6 +103,9 @@ def test_function_to_jsonschema_annotated_with_pydantic_field():
95103 def func (
96104 a : Annotated [int , Field (description = "The description for parameter a" )],
97105 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 ,
98109 ) -> None :
99110 """This is a test function."""
100111 pass
@@ -117,6 +128,12 @@ def func(
117128 "title" : "B" ,
118129 "type" : "string" ,
119130 },
131+ "c" : {
132+ "default" : None ,
133+ "description" : "The description for parameter c" ,
134+ "title" : "C" ,
135+ "type" : "number" ,
136+ },
120137 },
121138 "required" : ["a" ],
122139 "title" : "func" ,
0 commit comments