Interface IPromptJsonAnswerDescriptorBuilder
-
public interface IPromptJsonAnswerDescriptorBuilderBuilder for the JSON answer descriptor of a prompt query. Given aJsonSchemaOutputmodel, derives the value descriptor for that JSON schema and creates arecord value descriptorwith a single property named"answer"of that type.- Since:
- 8.5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IPromptJsonAnswerDescriptorBuilderanswerKey(String answerKey)Sets the key for the single text property that contains the answer.voidappendTo(IRecordValueDescriptorBuilder builder)IValueDescriptor<?,?>build()Creates a value descriptor with the current settings, derived from the configured JSON schema output.IRecordValueDescriptorbuildRecord()IPromptJsonAnswerDescriptorBuilderjsonSchemaOutput(IPromptQueryConfig_JsonSchemaOutput jsonSchemaOutput)Sets the JSON schema output configuration from which to derive the value descriptor.IPromptJsonAnswerDescriptorBuilderjsonSchemaOutput(JsonSchemaOutput jsonSchemaOutput)Sets the JSON schema output model from which to derive the value descriptor.IRecordValueDescriptorBuilderrecordBuilder()IPromptJsonAnswerDescriptorBuildertransformer(IJsonSchemaTransformer transformer)Sets the optional JSON schema transformer to use to transform the schema before deriving the value descriptor.
-
-
-
Method Detail
-
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)
Buildsthe value descriptor with the current settings, then appends a single property named as configured byanswerKeyto 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()
Buildsthe value descriptor with the current settings, then creates a new record value descriptor with a single property named as configured byanswerKey.- 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
IRecordValueDescriptorBuilder recordBuilder()
Buildsthe value descriptor with the current settings, then creates a new record value descriptor builder with a single property named as configured byanswerKey. 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.
-
-