@unified-llm/core
Version:
Unified LLM interface (in-memory).
49 lines (48 loc) • 1.44 kB
TypeScript
import { LLMClient } from './llm-client';
import { ConversationThread, Message as UnifiedMessage, UnifiedChatResponse } from './types/unified-api';
/**
* Thread-based chat session
* Multiple LLM clients can join an in-memory conversation thread
* Note: v0.4.0 removed persistence support - threads are now in-memory only
*/
export declare class Thread {
id: string;
title?: string;
description?: string;
clients: Map<string, LLMClient>;
messages: UnifiedMessage[];
constructor(config?: {
threadId?: string;
title?: string;
description?: string;
});
/**
* Add an LLM client to the thread
*/
addAssistant(assistant: LLMClient, name: string): void;
/**
* Remove an LLM client from the thread
*/
removeAssistant(name: string): boolean;
/**
* Send a message to all clients in the thread
*/
broadcast(message: string): Promise<Map<string, UnifiedChatResponse>>;
/**
* Send a message to a specific client in the thread
*/
sendTo(clientName: string, message: string): Promise<UnifiedChatResponse | null>;
/**
* Get the conversation thread as a structured object
*/
getConversation(): ConversationThread;
/**
* Clear all messages from the thread
*/
clearMessages(): void;
/**
* Get all client names in the thread
*/
getClientNames(): string[];
}
export default Thread;