Class JsonSchemaOutput
java.lang.Object
de.xima.fc.prompt.service.support.JsonSchemaOutput
- All Implemented Interfaces:
Serializable
View model POJO for users to define a JSON schema for the prompt response. The prompt provider will ensure that the
response conforms to the configured JSON schema.
- Since:
- 8.5.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the by JSON example attribute.static final StringThe name of the by manual input attribute.static final StringThe name of the by property list attribute.static final StringThe name of the by visual editor attribute.static final StringThe name of the definition type attribute.static final StringThe name of the description attribute.static final StringThe name of the definition type attribute.static final StringThe name of the name attribute. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApplicable only ifdefinitionTypeisBY_JSON_EXAMPLE.Applicable only ifdefinitionTypeisBY_MANUAL_INPUT.Applicable only ifdefinitionTypeisBY_PROPERTY_LIST.Applicable only ifdefinitionTypeisBY_VISUAL_EDITOR.Gets the type that controls how the user defines the JSON schema.An optional description of what the response format is for, used by the service to determine how to respond in the format.getName()The name of the response format.booleanGets the flag that determines whether schema adjustments are allowed or forbidden.voidsetByJsonExample(JsonSchemaOutputByJsonExample byJsonExample) Applicable only ifdefinitionTypeisBY_JSON_EXAMPLE.voidsetByManualInput(JsonSchemaOutputByManualInput byManualInput) Applicable only ifdefinitionTypeisBY_MANUAL_INPUT.voidsetByPropertyList(JsonSchemaOutputByPropertyList byPropertyList) Applicable only ifdefinitionTypeisBY_PROPERTY_LIST.voidsetByVisualEditor(JsonSchemaOutputByVisualEditor byVisualEditor) Applicable only ifdefinitionTypeisBY_VISUAL_EDITOR.voidsetDefinitionType(EJsonSchemaDefinitionMethod definitionType) Sets the type that controls how the user defines the JSON schema.voidsetDescription(String description) Sets an optional description of what the response format is for, used by the service to determine how to respond in the format.voidsetForbidSchemaAdjustments(boolean forbidSchemaAdjustments) Sets the flag that determines whether schema adjustments are allowed or forbidden.voidSets the name of the response format.
-
Field Details
-
ATTR_BY_JSON_EXAMPLE
The name of the by JSON example attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
ATTR_BY_MANUAL_INPUT
The name of the by manual input attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
ATTR_BY_PROPERTY_LIST
The name of the by property list attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
ATTR_BY_VISUAL_EDITOR
The name of the by visual editor attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
ATTR_DEFINITION_TYPE
The name of the definition type attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
ATTR_DESCRIPTION
The name of the description attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
ATTR_FORBID_SCHEMA_ADJUSTMENTS
The name of the definition type attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
ATTR_NAME
The name of the name attribute. If you implement a custom serialization / deserialization, use this name for the attribute to increase compatibility with other prompt service handlers.- See Also:
-
-
Constructor Details
-
JsonSchemaOutput
public JsonSchemaOutput()
-
-
Method Details
-
getByJsonExample
Applicable only ifdefinitionTypeisBY_JSON_EXAMPLE. Gets the configuration for that definition type.- Returns:
- The configuration for the JSON example.
-
setByJsonExample
- Parameters:
byJsonExample- The configuration for the JSON example.
-
getByManualInput
Applicable only ifdefinitionTypeisBY_MANUAL_INPUT. Gets the configuration for that definition type.- Returns:
- The configuration for the manually entered JSON schema.
-
setByManualInput
- Parameters:
byManualInput- The configuration for the manually entered JSON schema.
-
getByPropertyList
Applicable only ifdefinitionTypeisBY_PROPERTY_LIST. Gets the configuration for that definition type.- Returns:
- The configuration for the property list.
-
setByPropertyList
- Parameters:
byPropertyList- The configuration for the property list.
-
getByVisualEditor
Applicable only ifdefinitionTypeisBY_VISUAL_EDITOR. Gets the configuration for that definition type.- Returns:
- The configuration for the visual editor.
-
setByVisualEditor
- Parameters:
byVisualEditor- The configuration for the visual editor.
-
getDefinitionType
Gets the type that controls how the user defines the JSON schema.- Returns:
- The type of JSON schema configuration
-
setDefinitionType
Sets the type that controls how the user defines the JSON schema.- Parameters:
definitionType- The type of JSON schema configuration
-
getDescription
An optional description of what the response format is for, used by the service to determine how to respond in the format.- Returns:
- The description.
-
setDescription
Sets an optional description of what the response format is for, used by the service to determine how to respond in the format.- Parameters:
description- The description.
-
getName
-
setName
Sets the name of the response format.- Parameters:
name- The name of the response format.
-
isForbidSchemaAdjustments
public boolean isForbidSchemaAdjustments()Gets the flag that determines whether schema adjustments are allowed or forbidden. Some prompt services may impose certain restrictions on the JSON schema or support only a subset of JSON Schema features. If this flag is set totrue, the system is allowed to modify the provided JSON schema to ensure compatibility with the prompt service's requirements. This could involve simplifying complex schema constructs, removing unsupported features, or restructuring the schema to fit within the service's capabilities. If set tofalse, the system will use the provided schema as-is, which may lead to errors if the schema is not fully compatible with the prompt service.One use case for setting this flag to true is when you wish to use cutting edge features. A prompt service's capabilities can evolve, lifting certain restrictions over time. The system may not yet be aware of these changes, and might remove features from the schema that you wish to use.
- Returns:
- true if schema adjustments are allowed, false otherwise.
-
setForbidSchemaAdjustments
public void setForbidSchemaAdjustments(boolean forbidSchemaAdjustments) Sets the flag that determines whether schema adjustments are allowed or forbidden. Some prompt services may impose certain restrictions on the JSON schema or support only a subset of JSON Schema features. If this flag is set totrue, the system is allowed to modify the provided JSON schema to ensure compatibility with the prompt service's requirements. This could involve simplifying complex schema constructs, removing unsupported features, or restructuring the schema to fit within the service's capabilities. If set tofalse, the system will use the provided schema as-is, which may lead to errors if the schema is not fully compatible with the prompt service.One use case for setting this flag to true is when you wish to use cutting edge features. A prompt service's capabilities can evolve, lifting certain restrictions over time. The system may not yet be aware of these changes, and might remove features from the schema that you wish to use.
- Parameters:
forbidSchemaAdjustments- true if schema adjustments are allowed, false otherwise.
-