@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
43 lines (42 loc) • 2.21 kB
TypeScript
/**
* Request-building rules from `src/lib/providers/rules/<id>.json`: the wire
* names of request parameters (`requestFields`), how a failed tool call is
* reported (`toolResults`) and fixed conversation texts
* (`contextTexts`).
*/
import type { ProviderContextTexts, ProviderRequestFields, ProviderToolDeclarationParts, ProviderToolResultRules, ProviderWireParamValues } from "../../types/index.js";
/** The provider's request field names; throws when its rules file has none. */
export declare function getRequestFields(id: string): ProviderRequestFields;
/**
* Request parameters under the provider's wire names. Unset values and empty
* lists are left out, as every request builder did by hand, and so is any
* parameter the rules file omits while extended thinking is on.
*/
export declare function toWireParams(id: string, values: ProviderWireParamValues, context?: {
thinkingOn?: boolean;
}): Record<string, unknown>;
/**
* The two output budget field names a provider's wire accepts: the ordinary
* one and the one some models take in its place.
*/
export declare function getOutputBudgetFields(id: string): {
maxTokens: string;
maxCompletionTokens: string;
};
/**
* Moves a request's output budget from the ordinary field to the field some
* models take in its place. The value moves to the end of the body; a body
* with no budget comes back without either field.
*/
export declare function moveToCompletionBudgetField<T extends object>(id: string, body: T): T;
/**
* A tool declaration under the provider's wire names: the name, the
* description when there is one, the schema, then any extra fields.
*/
export declare function toolDeclaration(id: string, parts: ProviderToolDeclarationParts): Record<string, unknown>;
/** The JSON Schema a tool declaration carries, read by the wire name. */
export declare function toolSchemaOf(id: string, declaration: object): Record<string, unknown> | undefined;
/** How a failed tool call is reported back to the model. */
export declare function getToolResultRules(id: string): ProviderToolResultRules;
/** Fixed texts inserted into the conversation. */
export declare function getContextTexts(id: string): ProviderContextTexts;