JsonSchema
@JsonInclude(JsonInclude.Include.NON_NULL) public class JsonSchema
io/agentscope/core/formatter/JsonSchema.java:46–130JSON 模式,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.formatter 包。核心成员包括 getName、setName、getDescription、setDescription、getSchema、setSchema。
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();
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 A class in io.agentscope.core.formatter that carries structured messages and events between agents, models and UIs. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public JsonSchema() | 初始化 `JsonSchema` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getName() | 获取名称。 Returns the name. |
public void setName(String name) | 设置名称。 Sets the name. |
public String getDescription() | 获取 `getDescription`。 Returns the description. |
public void setDescription(String description) | 设置 `setDescription`。 Sets the description. |
public Map<String, Object> getSchema() | 获取模式。 Returns the schema. |
public void setSchema(Map<String, Object> schema) | 设置模式。 Sets the schema. |
public Boolean getStrict() | 获取 `getStrict`。 Returns the strict. |
public void setStrict(Boolean strict) | 设置 `setStrict`。 Sets the strict. |
public static Builder builder()static | 返回构建器实例。 Returns the builder. |
构造器详情Constructor Detail
JsonSchema
public JsonSchema()
初始化 JsonSchema 实例。
Creates a new instance.
io/agentscope/core/formatter/JsonSchema.java:65方法详情Method Detail
getName
public String getName()
获取名称。
Returns the name.
Stringio/agentscope/core/formatter/JsonSchema.java:67–69setName
public void setName(String name)
设置名称。
Sets the name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称(类型 `String`)。The name. |
io/agentscope/core/formatter/JsonSchema.java:71–73getDescription
public String getDescription()
获取 getDescription。
Returns the description.
Stringio/agentscope/core/formatter/JsonSchema.java:75–77setDescription
public void setDescription(String description)
设置 setDescription。
Sets the description.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
description | String | 描述(类型 `String`)。The description. |
io/agentscope/core/formatter/JsonSchema.java:79–81getSchema
public Map<String, Object> getSchema()
获取模式。
Returns the schema.
Map<String, Object>io/agentscope/core/formatter/JsonSchema.java:83–85setSchema
public void setSchema(Map<String, Object> schema)
设置模式。
Sets the schema.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
schema | Map<String, Object> | 模式定义(类型 `Map`)。The schema. |
io/agentscope/core/formatter/JsonSchema.java:87–89getStrict
public Boolean getStrict()
获取 getStrict。
Returns the strict.
Booleanio/agentscope/core/formatter/JsonSchema.java:91–93setStrict
public void setStrict(Boolean strict)
设置 setStrict。
Sets the strict.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
strict | Boolean | strict(类型 `Boolean`)。The strict. |
io/agentscope/core/formatter/JsonSchema.java:95–97builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/agentscope/core/formatter/JsonSchema.java:99–101嵌套类详情Nested Class Detail
Builder
public static class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.core.formatter 包。核心成员包括 name、description、schema、strict、build。
A class in io.agentscope.core.formatter that carries structured messages and events between agents, models and UIs. Declared in io.agentscope.core.formatter.