import debug from "debug"; import { z } from "zod"; import { ToolRegistrationInput, JsonSchemaInput } from "./types"; import { Workflow } from "./workflows/workflow"; import { ToolConfigSchema } from "./contract"; import L1M from "l1m"; export declare const log: debug.Debugger; /** * The Inferable client. This is the main entry point for using Inferable. * * ```ts * // create a new Inferable instance * const client = new Inferable({ * apiSecret: "API_SECRET", * }); * * * // Register a tool * client.tools.register("hello", z.object({name: z.string()}), async ({name}: {name: string}) => { * return `Hello ${name}`; * }) * * await client.tools.listen(); * * // stop the service on shutdown * process.on("beforeExit", async () => { * await myService.stop(); * }); * * ``` */ export declare class Inferable { static getVersion(): string; private clusterId?; private apiSecret; private endpoint; private machineId; private client; private pollingAgents; private toolsRegistry; /** * Initializes a new Inferable instance. * @param apiSecret The API Secret for your Inferable cluster. If not provided, it will be read from the `INFERABLE_API_SECRET` environment variable. * @param options Additional options for the Inferable client. * @param options.endpoint The endpoint for the Inferable cluster. Defaults to https://api.inferable.ai. * * @example * ```ts * // Basic usage * const client = new Inferable({ * apiSecret: "API_SECRET", * }); * * // OR * * process.env.INFERABLE_API_SECRET = "API_SECRET"; * const client = new Inferable(); * ``` */ constructor(options?: { apiSecret?: string; endpoint?: string; machineId?: string; }); tools: { /** * Registers a tool with Inferable. * @param input The tool definition. * @example * ```ts * const client = new Inferable({apiSecret: "API_SECRET"}); * * client.tools.register("hello", z.object({name: z.string()}), async ({name}: {name: string}) => { * return `Hello ${name}`; * }); * * // start the service * await client.tools.listen(); * * // stop the service on shutdown * process.on("beforeExit", async () => { * await client.tools.stop(); * }); * ``` */ register: (input: ToolRegistrationInput) => void; listen: () => Promise; unlisten: () => Promise; }; llm: { structured: , TOutput = z.TypeOf>({ input, schema, instructions, }: { input: string; schema: T; instructions?: string; }, options?: Parameters[1]) => Promise; }; private registerTool; private getClusterId; workflows: { helpers: { structuredPrompt: (params: { facts: string[]; goals: string[]; }) => string; }; create: ({ name, description, inputSchema, config, }: { name: string; description?: string; inputSchema: TInput; config?: z.infer; }) => Workflow; trigger: (name: string, input: TWorkflowInput) => Promise; }; }