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 Summary
Modifier and TypeMethodDescriptionSets 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.jsonSchemaOutput(IPromptQueryConfig_JsonSchemaOutput jsonSchemaOutput) Sets the JSON schema output configuration from which to derive the value descriptor.jsonSchemaOutput(JsonSchemaOutput jsonSchemaOutput) Sets the JSON schema output model from which to derive the value descriptor.transformer(IJsonSchemaTransformer transformer) Sets the optional JSON schema transformer to use to transform the schema before deriving the value descriptor.
-
Method Details
-
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
-
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.
-