KernelJsonSchemaBuilder Class
Kernel JSON schema builder.
Constructor
KernelJsonSchemaBuilder()
Methods
| build |
Builds the JSON schema for a given parameter type and description. |
| build_enum_schema |
Builds the JSON schema for an enum type. |
| build_from_type_name |
Builds the JSON schema for a given parameter type name and description. |
| build_model_schema |
Builds the JSON schema for a given model and description. |
| get_json_schema |
Gets JSON schema for a given parameter type. |
| handle_complex_type |
Handles building the JSON schema for complex types. |
build
Builds the JSON schema for a given parameter type and description.
build(parameter_type: type | str | Any, description: str | None = None, structured_output: bool = False) -> dict[str, Any]
Parameters
| Name | Description |
|---|---|
|
parameter_type
Required
|
The parameter type. |
|
description
|
The description of the parameter. Defaults to None. Default value: None
|
|
structured_output
|
Whether the outputs are structured. Defaults to False. Default value: False
|
Returns
| Type | Description |
|---|---|
|
The JSON schema for the parameter type. |
build_enum_schema
Builds the JSON schema for an enum type.
build_enum_schema(enum_type: type, description: str | None = None) -> dict[str, Any]
Parameters
| Name | Description |
|---|---|
|
enum_type
Required
|
The enum type. |
|
description
|
<xref:<xref:semantic_kernel.schema.kernel_json_schema_builder.str, optional>>
The description of the enum. Defaults to None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The JSON schema for the enum type. |
build_from_type_name
Builds the JSON schema for a given parameter type name and description.
build_from_type_name(parameter_type: str, description: str | None = None) -> dict[str, Any]
Parameters
| Name | Description |
|---|---|
|
parameter_type
Required
|
The parameter type name. |
|
description
|
<xref:<xref:semantic_kernel.schema.kernel_json_schema_builder.str, optional>>
The description of the parameter. Defaults to None. Default value: None
|
Returns
| Type | Description |
|---|---|
|
The JSON schema for the parameter type. |
build_model_schema
Builds the JSON schema for a given model and description.
build_model_schema(model: type | KernelBaseModel, description: str | None = None, structured_output: bool = False) -> dict[str, Any]
Parameters
| Name | Description |
|---|---|
|
model
Required
|
The model type. |
|
description
|
The description of the model. Defaults to None. Default value: None
|
|
structured_output
|
Whether the outputs are structured. Defaults to False. Default value: False
|
Returns
| Type | Description |
|---|---|
|
The JSON schema for the model. |
get_json_schema
handle_complex_type
Handles building the JSON schema for complex types.
handle_complex_type(parameter_type: type, description: str | None = None, structured_output: bool = False) -> dict[str, Any]
Parameters
| Name | Description |
|---|---|
|
parameter_type
Required
|
The parameter type. |
|
description
|
The description of the parameter. Defaults to None. Default value: None
|
|
structured_output
|
Whether the outputs are structured. Defaults to False. Default value: False
|
Returns
| Type | Description |
|---|---|
|
The JSON schema for the parameter type. |