@@ -32,7 +32,7 @@ async def test_chat_stream(mock_model_client):
32
32
33
33
34
34
def 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 :
36
36
"""This is a test function."""
37
37
pass
38
38
@@ -45,7 +45,7 @@ def func(a: int, b: str = "ok", c: float = None) -> None:
45
45
"properties" : {
46
46
"a" : {"title" : "A" , "type" : "integer" },
47
47
"b" : {"default" : "ok" , "title" : "B" , "type" : "string" },
48
- "c" : {"default" : None , "title" : "C" , "type" : "number " },
48
+ "c" : {"default" : None , "title" : "C" , "type" : "string " },
49
49
},
50
50
"required" : ["a" ],
51
51
"title" : "func" ,
@@ -60,7 +60,7 @@ def test_function_to_jsonschema_annotated_with_string():
60
60
def func (
61
61
a : Annotated [int , "The description for parameter a" ],
62
62
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 ,
64
64
) -> None :
65
65
"""This is a test function."""
66
66
pass
@@ -87,7 +87,7 @@ def func(
87
87
"default" : None ,
88
88
"description" : "The description for parameter c" ,
89
89
"title" : "C" ,
90
- "type" : "number " ,
90
+ "type" : "string " ,
91
91
},
92
92
},
93
93
"required" : ["a" ],
@@ -103,9 +103,7 @@ def test_function_to_jsonschema_annotated_with_pydantic_field():
103
103
def func (
104
104
a : Annotated [int , Field (description = "The description for parameter a" )],
105
105
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 ,
109
107
) -> None :
110
108
"""This is a test function."""
111
109
pass
@@ -132,7 +130,7 @@ def func(
132
130
"default" : None ,
133
131
"description" : "The description for parameter c" ,
134
132
"title" : "C" ,
135
- "type" : "number " ,
133
+ "type" : "string " ,
136
134
},
137
135
},
138
136
"required" : ["a" ],
@@ -148,6 +146,7 @@ def test_function_to_jsonschema_default_to_pydantic_field():
148
146
def func (
149
147
a : int = Field (description = "The description for parameter a" ),
150
148
b : str = Field (default = "ok" , description = "The description for parameter b" ),
149
+ c : str = Field (default = None , description = "The description for parameter c" ),
151
150
) -> None :
152
151
"""This is a test function."""
153
152
pass
@@ -170,6 +169,12 @@ def func(
170
169
"title" : "B" ,
171
170
"type" : "string" ,
172
171
},
172
+ "c" : {
173
+ "default" : None ,
174
+ "description" : "The description for parameter c" ,
175
+ "title" : "C" ,
176
+ "type" : "string" ,
177
+ },
173
178
},
174
179
"required" : ["a" ],
175
180
"title" : "func" ,
0 commit comments