Skip to content

Structured message schema generation does not allow output effort to be set #366

Description

@triphora

When using the outputConfig(Class<T>) overload to generate a structured message schema, there is no way to specify other configuration options. Most namely, there is no way to set the effort option that is also specified through OutputConfig. It is forced to be unset, since schema generation calls the OutputConfig builder directly.

/**
* Sets the output configuration with a JSON schema format derived from the structure of the
* given class. This is the recommended way to specify structured outputs.
*
* Unlike the beta version, this GA version does NOT auto-inject any beta header.
*
* @see MessageCreateParams.Builder.outputConfig
*/
@JvmOverloads
fun outputConfig(
outputType: Class<T>,
localValidation: JsonSchemaLocalValidation = JsonSchemaLocalValidation.YES,
) = apply {
if (outputConfigSet) {
throw IllegalArgumentException(
"outputConfig was called multiple times. Please use only one outputConfig call."
)
}
this.outputType = outputType
val format = outputFormatFromClass(outputType, localValidation)
paramsBuilder.outputConfig(OutputConfig.builder().format(format).build())
// GA version: NO beta header injection
outputConfigSet = true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions