Interface JsonSchemaResponseFormatSupport
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Identifies chat models that accept a JSON schema response format on each request although they do not declare
Capability.RESPONSE_FORMAT_JSON_SCHEMA.
LangChain4j only sends a JSON schema to models declaring the capability, and otherwise appends format instructions to the user message. Google AI Gemini, for example, honors the response format of the request but declares the capability only when a JSON response format is configured on the model. For the models identified here, the AI services and agents returning a type with a generated schema use the structured output of the model.
Provider modules register a bean for their models; the
langchain4j.structured-output.force-json-schema-response-format property overrides them.
- Since:
- 2.4.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsJsonSchemaResponseFormat(@NonNull dev.langchain4j.model.chat.ChatModel chatModel) Whether the model sends the JSON schema of the response format of a request.
-
Method Details
-
acceptsJsonSchemaResponseFormat
boolean acceptsJsonSchemaResponseFormat(@NonNull dev.langchain4j.model.chat.ChatModel chatModel) Whether the model sends the JSON schema of the response format of a request.- Parameters:
chatModel- The chat model- Returns:
- Whether the model accepts a JSON schema response format on the request
-