Skip to content

Commit 89f7157

Browse files
committed
fix(llm): allow all runtime node root types in google schema
1 parent 81ec675 commit 89f7157

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

packages/llm/src/providers/google.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,28 @@ const RUNTIME_PLAN_JSON_SCHEMA = {
8585
},
8686
root: {
8787
type: "object",
88-
required: ["type", "tag"],
88+
required: ["type"],
8989
additionalProperties: true,
9090
properties: {
9191
type: {
9292
type: "string",
93-
enum: ["element"],
93+
enum: ["text", "element", "component"],
94+
},
95+
value: {
96+
type: "string",
9497
},
9598
tag: {
9699
type: "string",
97100
minLength: 1,
98101
},
102+
module: {
103+
type: "string",
104+
minLength: 1,
105+
},
106+
exportName: {
107+
type: "string",
108+
minLength: 1,
109+
},
99110
props: {
100111
type: "object",
101112
additionalProperties: true,

tests/llm.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,11 @@ test("google interpreter validates structured runtime plan response", async () =
747747
assert.ok(properties.root);
748748
assert.ok(properties.capabilities);
749749
assert.ok(properties.source);
750+
const rootSchema = properties.root as Record<string, unknown>;
751+
assert.deepEqual(rootSchema.required, ["type"]);
752+
const rootProperties = rootSchema.properties as Record<string, unknown>;
753+
const rootType = rootProperties.type as Record<string, unknown>;
754+
assert.deepEqual(rootType.enum, ["text", "element", "component"]);
750755
});
751756

752757
test("google interpreter retries structured request without schema when unsupported", async () => {

0 commit comments

Comments
 (0)