@@ -168,9 +168,7 @@ def _build_function_parameters_property(func) -> _JSONSchemaFunctionParameters:
168168 inspect .Parameter .VAR_POSITIONAL ,
169169 inspect .Parameter .VAR_KEYWORD ,
170170 ):
171- raise ValueError (
172- f"{ func .__name__ } : *args and **kwargs are not supported by the @tool decorator"
173- )
171+ raise ValueError (f"{ func .__name__ } : *args and **kwargs are not supported by the @tool decorator" )
174172
175173 for parameter in signature .parameters .values ():
176174 try :
@@ -337,9 +335,7 @@ def _parse_annotation(annotation: typing.Type) -> _ParsedAnnotation:
337335 # Union has sub_types and is Optional
338336 return _ParsedOptionalAnnotation (
339337 annotation = _ParsedUnionAnnotation (
340- annotation = [
341- _parse_annotation (sub_type ) for sub_type in sub_types [:- 1 ]
342- ],
338+ annotation = [_parse_annotation (sub_type ) for sub_type in sub_types [:- 1 ]],
343339 )
344340 )
345341 # Union type that is not Optional
@@ -373,10 +369,7 @@ def _annotation_parse_to_json_schema(
373369
374370 if isinstance (arg , _ParsedUnionAnnotation ):
375371 arg_type = {
376- "anyOf" : [
377- _annotation_parse_to_json_schema (sub_type )
378- for sub_type in arg .annotation
379- ],
372+ "anyOf" : [_annotation_parse_to_json_schema (sub_type ) for sub_type in arg .annotation ],
380373 }
381374
382375 elif isinstance (arg , _ParsedTupleAnnotation ):
@@ -391,10 +384,7 @@ def _annotation_parse_to_json_schema(
391384 else :
392385 arg_type = {
393386 "type" : "array" ,
394- "items" : [
395- _annotation_parse_to_json_schema (sub_type )
396- for sub_type in arg .annotation
397- ],
387+ "items" : [_annotation_parse_to_json_schema (sub_type ) for sub_type in arg .annotation ],
398388 }
399389
400390 elif isinstance (arg , _ParsedListAnnotation ):
@@ -464,8 +454,8 @@ def _annotation_parse_to_json_schema(
464454 if isinstance (arg , _ParsedUnionAnnotation ):
465455 for type_option in arg_type ["anyOf" ]:
466456 if (
467- isinstance (type_option ["type" ], list )
468- and "null" not in type_option ["type" ]
457+ isinstance (type_option ["type" ], list ) # type: ignore
458+ and "null" not in type_option ["type" ] # type: ignore
469459 ): # type: ignore
470460 type_option ["type" ] = [* type_option ["type" ], "null" ] # type: ignore
471461 elif not isinstance (type_option ["type" ], list ): # type: ignore
0 commit comments