Class JsonSchemas

java.lang.Object
dev.langchain4j.service.output.JsonSchemas

public class JsonSchemas extends Object
  • Constructor Details

    • JsonSchemas

      public JsonSchemas()
  • Method Details

    • jsonSchemaFrom

      public static Optional<JsonSchema> jsonSchemaFrom(Type returnType)
      Generates a JsonSchema for the given POJO type, for example to configure a ResponseFormat.
      Parameters:
      returnType - the type to generate the JSON schema for
      Returns:
      the JSON schema, or an empty Optional if the type is not a POJO (e.g. String, Integer, an enum, a List, or a LangChain4j type such as AiMessage or ChatResponse)