UNPKG

@unified-llm/core

Version:

Unified LLM interface (in-memory).

52 lines 1.43 kB
export type ThreadSnapshot = { previousResponseId?: string; history: any[]; }; /** * Maintain thread state for LLM invocations. * Prioritize previousResponseId if present, otherwise uses history to continue the conversation. */ export declare class Thread { private previousResponseId?; private history; /** * @param options.previousResponseId Previous response ID (used only when available) * @param options.history Initial input history */ constructor(options?: { previousResponseId?: string; history?: any[]; }); /** * Get the current history. */ getHistory(): any[]; /** * Replace the entire history. */ setHistory(items: any[]): void; /** * Append elements to the history. */ appendToHistory(items: any[]): void; /** * Build the input and previous_response_id required for the next request. */ buildRequestContextForResponsesAPI(nextInput: any[]): { input: any[]; previous_response_id?: string; }; /** * Update the previous_response_id. */ updatePreviousResponseId(responseId?: string): void; /** * Convert the thread state to a serializable format. */ toJSON(): ThreadSnapshot; /** * Restore from a saved thread state. */ static fromJSON(snapshot: ThreadSnapshot): Thread; } //# sourceMappingURL=thread.d.ts.map