Interface IPromptJsonAnswerDescriptorBuilder


public interface IPromptJsonAnswerDescriptorBuilder
Builder for the JSON answer descriptor of a prompt query. Given a JsonSchemaOutput model, derives the value descriptor for that JSON schema and creates a record value descriptor with a single property named "answer" of that type.
Since:
8.5.0
  • Method Details

    • answerKey

      @CanIgnoreReturnValue IPromptJsonAnswerDescriptorBuilder answerKey(String answerKey)
      Sets the key for the single text property that contains the answer. Defaults to "answer".
      Parameters:
      answerKey - The key for the answer property.
      Returns:
      This builder for chaining method calls.
    • appendTo

      void appendTo(IRecordValueDescriptorBuilder builder)
      Builds the value descriptor with the current settings, then appends a single property named as configured by answerKey to the given builder.
      Parameters:
      builder - The builder to append to.
    • build

      IValueDescriptor<?,?> build()
      Creates a value descriptor with the current settings, derived from the configured JSON schema output.
      Returns:
      A new value descriptor.
    • buildRecord

      IRecordValueDescriptor buildRecord()
      Builds the value descriptor with the current settings, then creates a new record value descriptor with a single property named as configured by answerKey.
      Returns:
      A new record value descriptor.
    • jsonSchemaOutput

      @CanIgnoreReturnValue IPromptJsonAnswerDescriptorBuilder jsonSchemaOutput(IPromptQueryConfig_JsonSchemaOutput jsonSchemaOutput)
      Sets the JSON schema output configuration from which to derive the value descriptor.
      Parameters:
      jsonSchemaOutput - The JSON schema output configuration.
      Returns:
      This builder for chaining method calls.
    • jsonSchemaOutput

      @CanIgnoreReturnValue IPromptJsonAnswerDescriptorBuilder jsonSchemaOutput(JsonSchemaOutput jsonSchemaOutput)
      Sets the JSON schema output model from which to derive the value descriptor.
      Parameters:
      jsonSchemaOutput - The JSON schema output model.
      Returns:
      This builder for chaining method calls.
    • recordBuilder

      Builds the value descriptor with the current settings, then creates a new record value descriptor builder with a single property named as configured by answerKey. Useful if you want to further customize the descriptor.
      Returns:
      A new record value descriptor builder.
    • transformer

      @CanIgnoreReturnValue IPromptJsonAnswerDescriptorBuilder transformer(IJsonSchemaTransformer transformer)
      Sets the optional JSON schema transformer to use to transform the schema before deriving the value descriptor. Can be null when no transformation is needed.
      Parameters:
      transformer - The JSON schema transformer.
      Returns:
      This builder for chaining method calls.