Spaces:
Sleeping
Sleeping
File size: 1,307 Bytes
05c5ed5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import { tool as createTool } from "ai";
import { z } from "zod";
export const createTableTool = createTool({
description:
"Create an interactive table with data. The table will automatically have sorting, filtering, and search functionality.",
inputSchema: z.object({
title: z.string().describe("Table title"),
description: z.string().nullable().describe("Optional table description"),
columns: z
.array(
z.object({
key: z
.string()
.describe("Column key that matches the data object keys"),
label: z.string().describe("Display label for the column header"),
type: z
.enum(["string", "number", "date", "boolean"])
.nullable()
.default("string")
.describe("Data type for proper sorting and formatting"),
}),
)
.describe("Column configuration array"),
data: z
.array(
z
.object({})
.catchall(z.any())
.describe(
"Array of row objects. Each object should have keys matching the column names.",
),
)
.describe(
"Array of row objects. Each object should have keys matching the column names.",
),
}),
execute: async () => {
return "Success";
},
});
|