@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
14 lines (13 loc) • 921 B
TypeScript
import type { AssistantOutput } from "../types/index.js";
/**
* @description Reads the role of a chat message, treating anything without a string role as a user message.
* @param message {T} - Message of any provider shape.
* @returns {string} The message role, or `user` when it declares none.
*/
export declare function messageRole<T>(message: T): string;
/**
* @description Shapes a model response as an assistant message array that Langfuse renders as a conversation.
* @param output {AssistantOutput | undefined} - A text string, a reply with `text`, `reasoning` and `toolCalls`, a message array, or provider content parts.
* @returns {object[] | undefined} `[{ role: "assistant", content, tool_calls? }]`, the input untouched when it is already a message array, or `undefined` when there is no output.
*/
export declare function assistantMessages(output: AssistantOutput | undefined): object[] | undefined;