@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
34 lines (33 loc) • 1.51 kB
TypeScript
/**
* Tool and schema primitives.
*
* These were re-exported from the `ai` package. They are implemented here now,
* against the local type algebra in `types/aiCompat.ts`. The function and the
* type had to move together: replacing `tool()` alone leaves it producing an
* upstream `Tool` that no longer matches the local one, which is how the first
* attempt failed.
*
* Upstream behaviour, reproduced exactly:
* - `tool()` is identity. It exists for inference, not for runtime.
* - `jsonSchema()` wraps a raw JSON Schema in the duck-typed shape the rest of
* this repo reads — `convertZodToJsonSchema` looks for the `jsonSchema`
* property, not for the brand — and still stamps
* `Symbol.for("vercel.ai.schema")` so anything that does check it keeps
* working.
* - `stepCountIs(n)` returns `({steps}) => steps.length === n`.
*/
import type { JSONSchema7, Schema, Tool } from "../types/index.js";
export declare function tool<INPUT, OUTPUT>(definition: Tool<INPUT, OUTPUT>): Tool<INPUT, OUTPUT>;
export declare function tool<INPUT>(definition: Tool<INPUT, never>): Tool<INPUT, never>;
export declare function jsonSchema<OBJECT = unknown>(schema: JSONSchema7 | (() => JSONSchema7), options?: {
validate?: (value: unknown) => {
success: true;
value: OBJECT;
} | {
success: false;
error: unknown;
};
}): Schema<OBJECT>;
export declare const stepCountIs: (stepCount: number) => ({ steps }: {
steps: unknown[];
}) => boolean;