Class StructuredOutputConfiguration

java.lang.Object
io.micronaut.langchain4j.jsonschema.StructuredOutputConfiguration
All Implemented Interfaces:
io.micronaut.core.util.Toggleable

@ConfigurationProperties("langchain4j.structured-output") public final class StructuredOutputConfiguration extends Object implements io.micronaut.core.util.Toggleable
Configuration of the structured outputs backed by generated JSON schemas.
Since:
2.4.0
  • Field Details

  • Constructor Details

    • StructuredOutputConfiguration

      public StructuredOutputConfiguration()
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface io.micronaut.core.util.Toggleable
    • setEnabled

      public void setEnabled(boolean enabled)
      Whether the JSON schemas supplied by StructuredOutputSchemaProvider beans (for example generated by Micronaut JSON Schema) replace the schemas LangChain4j derives reflectively. Default value true.
      Parameters:
      enabled - Whether generated schemas are used
    • getForceJsonSchemaResponseFormat

      public @Nullable Boolean getForceJsonSchemaResponseFormat()
      Returns:
      Whether the JSON schema response format is sent to models that do not declare the capability
    • setForceJsonSchemaResponseFormat

      public void setForceJsonSchemaResponseFormat(@Nullable Boolean forceJsonSchemaResponseFormat)
      Whether services returning a type with a generated schema send it as the JSON schema response format to chat models that do not declare RESPONSE_FORMAT_JSON_SCHEMA, instead of appending format instructions to the user message. When not set, it is done for the models of the providers known to accept it (see JsonSchemaResponseFormatSupport), such as Google AI Gemini.
      Parameters:
      forceJsonSchemaResponseFormat - Whether the response format is forced