类 JsonSchema

java.lang.Object
io.agentscope.core.formatter.openai.dto.JsonSchema

public class JsonSchema extends Object
JSON Schema definition for structured outputs.

This class represents a JSON Schema that defines the structure of the expected response from the model.

Example usage:


 JsonSchema schema = JsonSchema.builder()
     .name("MathResponse")
     .description("Response with answer and steps")
     .schema(Map.of(
         "type", "object",
         "properties", Map.of(
             "answer", Map.of("type", "number"),
             "steps", Map.of("type", "array", "items", Map.of("type", "string"))
         ),
         "required", List.of("answer", "steps"),
         "additionalProperties", false
     ))
     .strict(true)
     .build();
 
  • 构造器详细资料

    • JsonSchema

      public JsonSchema()
  • 方法详细资料

    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getSchema

      public Map<String,Object> getSchema()
    • setSchema

      public void setSchema(Map<String,Object> schema)
    • getStrict

      public Boolean getStrict()
    • setStrict

      public void setStrict(Boolean strict)
    • builder

      public static JsonSchema.Builder builder()