I wrote something to let me use Vals as tools for LLM calls.
A Val Tool is an HTTP Val that exposes two endpoints:
Calls the tool
Serves a JSON schema for the request payload
Fetches body of specified file in a github repo
export const FileIdentSchemaProper = z.object({
repo: z.object({
owner: z.string().describe("Repo Owner"),
repo: z.string().describe("Repo Name"),
}),
ref: z.string().describe("git sha or branch name"),
file: z.string().describe("relative path within repo"),
}).describe("Github File to read");
Accepts a method to execute and a Zod schema
Returns a Hono app meeting the spec
This is the main code for connecting a Val Tool to an LLM call. This is uses the Vercel AI SDK, but the concept makes sense regardless.