Package de.espirit.firstspirit.ai.dto
Interface JsonSchema.Builder
- Enclosing interface:
- JsonSchema
public static interface JsonSchema.Builder
Builder for a
JsonSchema definition.- Since:
- 5.2.251104
-
Method Summary
Modifier and TypeMethodDescription@NotNull JsonSchemacreate()Creates a new schema definition.@NotNull JsonSchema.Builderdescription(@NotNull String description) Configures a description of the value type, used by the model to choose how to call the function.default @NotNull JsonSchema.Builderfrom(@NotNull JsonSchema jsonSchema) Pre-configures this builder using the given schema.@NotNull JsonSchema.BuilderConfigures the JSON schema descriptor for the value type.@NotNull JsonSchema.Builderproperties(@NotNull Map<String, Object> schema) Configures the JSON schema descriptor for the value type.@NotNull JsonSchema.BuilderGenerates and configures a simple JSON schema descriptor for the given object type.@NotNull JsonSchema.BuilderConfigures the type of the value.
-
Method Details
-
from
@Contract("_ -> this") @NotNull default @NotNull JsonSchema.Builder from(@NotNull @NotNull JsonSchema jsonSchema) Pre-configures this builder using the given schema. Calling this method will reset all settings previously configured in this builder instance.- Parameters:
jsonSchema- The schema to apply the settings from.- Returns:
- This builder instance.
- Since:
- 5.2.251104
-
type
Configures the type of the value.- Parameters:
type- The value type.- Returns:
- This builder instance.
- Since:
- 5.2.251104
-
description
@Contract("_ -> this") @NotNull @NotNull JsonSchema.Builder description(@NotNull @NotNull String description) Configures a description of the value type, used by the model to choose how to call the function.- Parameters:
description- The value type description.- Returns:
- This builder instance.
- Since:
- 5.2.251104
-
properties
@Contract("_ -> this") @NotNull @NotNull JsonSchema.Builder properties(@NotNull @NotNull Map<String, Object> schema) Configures the JSON schema descriptor for the value type. Calling this method will reset all settings previously configured in this builder instance.- Parameters:
schema- The schema descriptor.- Returns:
- This builder instance.
- Since:
- 5.2.251104
-
json
Configures the JSON schema descriptor for the value type. Calling this method will reset all settings previously configured in this builder instance.- Parameters:
schema- The schema descriptor as JSON string.- Returns:
- This builder instance.
- Since:
- 5.2.251104
- See Also:
-
type
@Contract("_ -> this") @NotNull @NotNull JsonSchema.Builder type(@NotNull @NotNull Class<?> type) throws IOException Generates and configures a simple JSON schema descriptor for the given object type. Calling this method will reset all settings previously configured in this builder instance.NOTE: This method is intended to be used for simple objects and use-cases, for any more advanced scenario you should consider using libraries like Jackson supporting fully functional JSON schema generation.
- Parameters:
type- The object type.- Returns:
- This builder instance.
- Throws:
IOException- If the JSON schema string could not be created.- Since:
- 5.2.251303
-
create
Creates a new schema definition.- Returns:
- The schema definition.
- Since:
- 5.2.251104
-