A2uiSchemaSource
public interface A2uiSchemaSource
源码Source
io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:31–57定义 A 2 ui 模式来源契约的接口。位于 io.agentscope.examples.copilotkit.a2ui 包。核心成员包括 name、systemPrompt、parse。
Supplies the A2UI grammar shown to the model and turns the reply back into a checked payload.
The default implementation is BundledA2uiSchemaSource: a hand-written grammar plus the
structural checks in A2uiOperations.
Prompting and parsing are deliberately one contract rather than two: a grammar is only meaningful next to the validator that enforces it.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String name() | 返回名称。 Short identifier surfaced to the browser so the demo can show which path is active. |
public String systemPrompt(Set<String> clientComponents) | 设置系统提示词。 Builds the system prompt for the A2UI composer. |
public List<Map<String, Object>> parse(String rawModelReply, String surfaceId, Set<String> clientComponents) | 执行解析相关操作。 Parses and validates a raw model reply. |
方法详情Method Detail
name
public String name()
返回名称。
Short identifier surfaced to the browser so the demo can show which path is active.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:34systemPrompt
public String systemPrompt(Set<String> clientComponents)
设置系统提示词。
Builds the system prompt for the A2UI composer.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
clientComponents | Set<String> | 客户端 Components(类型 `Set`)。the custom components the browser declared it can render; empty means no restriction, so the full server-side catalog is advertised |
String返回字符串结果。Returns a string.
源码Source
io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:42parse
public List<Map<String, Object>> parse(String rawModelReply, String surfaceId, Set<String> clientComponents)
执行解析相关操作。
Parses and validates a raw model reply.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rawModelReply | String | 原始模型回复(类型 `String`)。the model's full answer, expected to carry a ` ` block |
surfaceId | String | surface 标识(类型 `String`)。the id the caller allocated; operations are rewritten onto it so a model that invents its own id still produces a surface the browser can address |
clientComponents | Set<String> | 客户端 Components(类型 `Set`)。components the browser can render, used to scope validation |
List<Map<String, Object>>返回列出>。the A2UI server-to-client messages, ready to be put on the wire
RuntimeException可能抛出 `RuntimeException`。when the reply is unusable, which makes the composer fall through to the next model client and finally to the deterministic fallback
源码Source
io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:55–56