@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
25 lines (24 loc) • 1.69 kB
TypeScript
/**
* Message identity and metadata for a stored conversation turn.
*
* Both memory managers store a turn as a user message followed by an assistant
* message. When the caller supplies a `turnId` the two messages get stable ids
* (`${turnId}:user`, `${turnId}:assistant`), which lets a repeated store of the
* same turn be recognised and skipped. When the caller sets neither a
* `turnId` nor a `modality`, nothing here changes what is stored: ids stay
* random and no metadata is added, so typed chat is byte-for-byte as before.
*/
import type { ChatMessage, ChatMessageMetadata, StoreConversationTurnOptions, TurnMessageIdentity } from "../types/index.js";
export declare function userTurnMessageId(turnId: string): string;
export declare function assistantTurnMessageId(turnId: string): string;
/** Identity and metadata for the user message of a turn. */
export declare function userTurnIdentity(options: Pick<StoreConversationTurnOptions, "turnId" | "modality">): TurnMessageIdentity;
/** Identity and metadata for the assistant message of a turn. */
export declare function assistantTurnIdentity(options: Pick<StoreConversationTurnOptions, "turnId" | "modality" | "interrupted" | "callEnded">, thoughtSignature?: string): TurnMessageIdentity;
/** `id` and optional `metadata` of a stored message, ready to spread into it. */
export declare function turnMessageFields(identity: TurnMessageIdentity): {
id: string;
metadata?: ChatMessageMetadata;
};
/** True when a turn with this id is already among the session's recent messages. */
export declare function isTurnAlreadyStored(messages: ReadonlyArray<Pick<ChatMessage, "id">>, turnId: string | undefined): boolean;