UNPKG

@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

24 lines (23 loc) • 1.33 kB
import type { Tool, ToolChoice } from "../types/index.js"; export declare function resolveToolChoice(options: { toolChoice?: ToolChoice<Record<string, Tool>>; }, tools: Record<string, Tool> | undefined, shouldUseTools: boolean): ToolChoice<Record<string, Tool>> | "none"; /** * Normalise an already-resolved tool choice into the shape * `toolChoiceToAnthropic` (and its peers) accept. * * A provider's model handle sees a value that has *already* been through * `resolveToolChoice` upstream, so it must translate rather than re-resolve — * re-resolving there would apply the `auto`/`none` defaulting twice, and the * `tools`/`shouldUseTools` inputs it needs are not in scope at that layer * anyway. * * What does vary is the shape. The value arrives either as a bare string * (`"auto"` / `"none"` / `"required"`), as `{ type: "tool", toolName }`, or — * on the native loop's tool-free re-ask — as an injected `{ type: "none" }` * object. Reading `.type` off the string forms yields `undefined`, which is * how string choices were silently dropped from the Anthropic generate * request. This exists so that normalisation lives in one place instead of * being re-derived at each call site. */ export declare function normalizeResolvedToolChoice(value: unknown): ToolChoice<Record<string, Tool>> | undefined;