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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable BooleanbooleanvoidsetEnabled(boolean enabled) Whether the JSON schemas supplied byStructuredOutputSchemaProviderbeans (for example generated by Micronaut JSON Schema) replace the schemas LangChain4j derives reflectively.voidsetForceJsonSchemaResponseFormat(@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 declareRESPONSE_FORMAT_JSON_SCHEMA, instead of appending format instructions to the user message.
-
Field Details
-
PREFIX
- See Also:
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED- See Also:
-
-
Constructor Details
-
StructuredOutputConfiguration
public StructuredOutputConfiguration()
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceio.micronaut.core.util.Toggleable
-
setEnabled
public void setEnabled(boolean enabled) Whether the JSON schemas supplied byStructuredOutputSchemaProviderbeans (for example generated by Micronaut JSON Schema) replace the schemas LangChain4j derives reflectively. Default value true.- Parameters:
enabled- Whether generated schemas are used
-
getForceJsonSchemaResponseFormat
- Returns:
- Whether the JSON schema response format is sent to models that do not declare the capability
-
setForceJsonSchemaResponseFormat
Whether services returning a type with a generated schema send it as the JSON schema response format to chat models that do not declareRESPONSE_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 (seeJsonSchemaResponseFormatSupport), such as Google AI Gemini.- Parameters:
forceJsonSchemaResponseFormat- Whether the response format is forced
-