-
Notifications
You must be signed in to change notification settings - Fork 151
Closed
Labels
julesGoogle JulesGoogle Jules
Description
I’m seeing a validation error when using f.object(...).array() for an input field.
Minimal repro (simplified)
import { ax, f } from "@ax-llm/ax";
const sig = f()
.input(
"items",
f
.object(
{
id: f.number("Index"),
name: f.string("Name"),
},
"Item",
)
.array(),
)
.output(
"classifiedItems",
f
.object(
{
id: f.number("Index"),
label: f.string("Label"),
},
"Classification",
)
.array(),
)
.build();
const gen = ax(sig);
await gen.forward(llm, {
items: [
{ id: 0, name: "Foo" },
{ id: 1, name: "Bar" },
],
});Actual behavior
At runtime, Ax fails during validation with an error similar to:
Validation failed: Expected 'items' to be a an array of object instead got 'array' ([{"id":0,"name":"Foo"}, ...])
If I change the input field to a looser schema:
.input("items", f.json("Item {id, name}").array())then the same payload works fine and the model call succeeds. The issue seems specific to f.object(...).array() on inputs; using f.object(...).array() on outputs works as expected.
Is f.object(...).array() for inputs supposed to be supported, or is this a current limitation/bug in the validator?
ogizanagi
Metadata
Metadata
Assignees
Labels
julesGoogle JulesGoogle Jules