UNPKG

@barosell/streamllm

Version:

Support streaming LLM responses using rxjs observables

14 lines (13 loc) 376 B
import OpenAI from "openai"; import { Observable } from "rxjs"; export type ChatRole = 'SYSTEM' | 'USER' | 'ASSISTANT'; export interface Completion { role: ChatRole; content: string; } export declare class AiInterface { private openai; private model; constructor(openai: OpenAI, model: string); stream(completions: Completion[]): Observable<string>; }