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:
  • Field Details

    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
  • Constructor Details

    • JsonSchemaOutput

      public JsonSchemaOutput()
  • Method Details

    • getByJsonExample

      public JsonSchemaOutputByJsonExample getByJsonExample()
      Applicable only if definitionType is BY_JSON_EXAMPLE. Gets the configuration for that definition type.
      Returns:
      The configuration for the JSON example.
    • setByJsonExample

      public void setByJsonExample(JsonSchemaOutputByJsonExample byJsonExample)
      Applicable only if definitionType is BY_JSON_EXAMPLE. Sets the configuration for BY_JSON_EXAMPLE.
      Parameters:
      byJsonExample - The configuration for the JSON example.
    • getByManualInput

      public JsonSchemaOutputByManualInput getByManualInput()
      Applicable only if definitionType is BY_MANUAL_INPUT. Gets the configuration for that definition type.
      Returns:
      The configuration for the manually entered JSON schema.
    • setByManualInput

      public void setByManualInput(JsonSchemaOutputByManualInput byManualInput)
      Applicable only if definitionType is BY_MANUAL_INPUT. Sets the configuration for BY_MANUAL_INPUT.
      Parameters:
      byManualInput - The configuration for the manually entered JSON schema.
    • getByPropertyList

      public JsonSchemaOutputByPropertyList getByPropertyList()
      Applicable only if definitionType is BY_PROPERTY_LIST. Gets the configuration for that definition type.
      Returns:
      The configuration for the property list.
    • setByPropertyList

      public void setByPropertyList(JsonSchemaOutputByPropertyList byPropertyList)
      Applicable only if definitionType is BY_PROPERTY_LIST. Sets the configuration for BY_PROPERTY_LIST.
      Parameters:
      byPropertyList - The configuration for the property list.
    • getByVisualEditor

      public JsonSchemaOutputByVisualEditor getByVisualEditor()
      Applicable only if definitionType is BY_VISUAL_EDITOR. Gets the configuration for that definition type.
      Returns:
      The configuration for the visual editor.
    • setByVisualEditor

      public void setByVisualEditor(JsonSchemaOutputByVisualEditor byVisualEditor)
      Applicable only if definitionType is BY_VISUAL_EDITOR. Sets the configuration for BY_VISUAL_EDITOR.
      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 to true, 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 to false, 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 to true, 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 to false, 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.