-
-
Notifications
You must be signed in to change notification settings - Fork 133
Open
Description
TanStack AI version
v0.4.2
Framework/Library version
React v19.2.0, Arktype v2.1.28
Describe the bug and the steps to reproduce it
convertSchemaToJsonSchema returns a function instead of object. I ran into this while trying to use the openrouter adapter. The openrouter sdk does it's own validation and did not accept the tool schema.
import { type } from "arktype";
import { convertSchemaToJsonSchema } from "@tanstack/ai";
describe("convertSchemaToJsonSchema", () => {
it("returns an object", () => {
const schema = type({
foo: "boolean",
});
const jsonschema = convertSchemaToJsonSchema(schema);
expect(typeof jsonschema).toEqual("object");
// Expected: "object"
// Received: "function"
});
});In the meantime, this works for me:
import type { JSONSchema } from "@tanstack/ai";
import { type } from "arktype";
const inputSchema = type({
foo: 'boolean'
}).toJsonSchema() as JSONSchema;
// toolDefinition...Related: https://arktype.io/docs/type-api#tojsonschema
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
see the test included in issue
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels