Class JsonSchemaOutput
- java.lang.Object
-
- de.xima.fc.prompt.service.support.JsonSchemaOutput
-
- All Implemented Interfaces:
Serializable
public final class JsonSchemaOutput extends Object implements 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_BY_JSON_EXAMPLEThe name of the by JSON example attribute.static StringATTR_BY_MANUAL_INPUTThe name of the by manual input attribute.static StringATTR_BY_PROPERTY_LISTThe name of the by property list attribute.static StringATTR_BY_VISUAL_EDITORThe name of the by visual editor attribute.static StringATTR_DEFINITION_TYPEThe name of the definition type attribute.static StringATTR_DESCRIPTIONThe name of the description attribute.static StringATTR_FORBID_SCHEMA_ADJUSTMENTSThe name of the definition type attribute.static StringATTR_NAMEThe name of the name attribute.
-
Constructor Summary
Constructors Constructor Description JsonSchemaOutput()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonSchemaOutputByJsonExamplegetByJsonExample()Applicable only ifdefinitionTypeisBY_JSON_EXAMPLE.JsonSchemaOutputByManualInputgetByManualInput()Applicable only ifdefinitionTypeisBY_MANUAL_INPUT.JsonSchemaOutputByPropertyListgetByPropertyList()Applicable only ifdefinitionTypeisBY_PROPERTY_LIST.JsonSchemaOutputByVisualEditorgetByVisualEditor()Applicable only ifdefinitionTypeisBY_VISUAL_EDITOR.EJsonSchemaDefinitionMethodgetDefinitionType()Gets the type that controls how the user defines the JSON schema.StringgetDescription()An optional description of what the response format is for, used by the service to determine how to respond in the format.StringgetName()The name of the response format.booleanisForbidSchemaAdjustments()Gets 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.voidsetName(String name)Sets the name of the response format.
-
-
-
Field Detail
-
ATTR_BY_JSON_EXAMPLE
public static final String 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:
- Constant Field Values
-
ATTR_BY_MANUAL_INPUT
public static final String 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:
- Constant Field Values
-
ATTR_BY_PROPERTY_LIST
public static final String 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:
- Constant Field Values
-
ATTR_BY_VISUAL_EDITOR
public static final String 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:
- Constant Field Values
-
ATTR_DEFINITION_TYPE
public static final String 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:
- Constant Field Values
-
ATTR_DESCRIPTION
public static final String 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:
- Constant Field Values
-
ATTR_FORBID_SCHEMA_ADJUSTMENTS
public static final String 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:
- Constant Field Values
-
ATTR_NAME
public static final String 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:
- Constant Field Values
-
-
Method Detail
-
getByJsonExample
public JsonSchemaOutputByJsonExample getByJsonExample()
Applicable only ifdefinitionTypeisBY_JSON_EXAMPLE. Gets the configuration for that definition type.- Returns:
- The configuration for the JSON example.
-
setByJsonExample
public void setByJsonExample(JsonSchemaOutputByJsonExample byJsonExample)
- Parameters:
byJsonExample- The configuration for the JSON example.
-
getByManualInput
public JsonSchemaOutputByManualInput getByManualInput()
Applicable only ifdefinitionTypeisBY_MANUAL_INPUT. Gets the configuration for that definition type.- Returns:
- The configuration for the manually entered JSON schema.
-
setByManualInput
public void setByManualInput(JsonSchemaOutputByManualInput byManualInput)
- Parameters:
byManualInput- The configuration for the manually entered JSON schema.
-
getByPropertyList
public JsonSchemaOutputByPropertyList getByPropertyList()
Applicable only ifdefinitionTypeisBY_PROPERTY_LIST. Gets the configuration for that definition type.- Returns:
- The configuration for the property list.
-
setByPropertyList
public void setByPropertyList(JsonSchemaOutputByPropertyList byPropertyList)
- Parameters:
byPropertyList- The configuration for the property list.
-
getByVisualEditor
public JsonSchemaOutputByVisualEditor getByVisualEditor()
Applicable only ifdefinitionTypeisBY_VISUAL_EDITOR. Gets the configuration for that definition type.- Returns:
- The configuration for the visual editor.
-
setByVisualEditor
public void setByVisualEditor(JsonSchemaOutputByVisualEditor byVisualEditor)
- Parameters:
byVisualEditor- The configuration for the visual editor.
-
getDefinitionType
public EJsonSchemaDefinitionMethod getDefinitionType()
Gets the type that controls how the user defines the JSON schema.- Returns:
- The type of JSON schema configuration
-
setDefinitionType
public void setDefinitionType(EJsonSchemaDefinitionMethod definitionType)
Sets the type that controls how the user defines the JSON schema.- Parameters:
definitionType- The type of JSON schema configuration
-
getDescription
public String 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
public void setDescription(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.- Parameters:
description- The description.
-
getName
public String getName()
The name of the response format.- Returns:
- The name of the response format.
-
setName
public void setName(String name)
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.
-
-