aiwrapper
Version:
A Universal AI Wrapper for JavaScript & TypeScript
33 lines (32 loc) • 1.01 kB
TypeScript
import { Agent } from "./agent";
import { LangMessage, LangMessages, LanguageProvider } from "../lang/index.ts";
import { LangMessageItem, LangMessageRole, LangTool } from "../lang/messages";
export type ChatOutput = {
answer: string;
messages: LangMessage[];
};
export interface ChatStreamingEvent {
type: "streaming";
data: {
msg: LangMessage;
idx: number;
};
}
export declare class ChatAgent extends Agent<{
role: LangMessageRole;
items: LangMessageItem[];
}[] | LangMessages | LangMessage[], LangMessages, ChatStreamingEvent> {
private lang?;
messages: LangMessages;
constructor(lang?: LanguageProvider, options?: {
tools?: LangTool[];
});
protected runInternal(input: {
role: LangMessageRole;
items: LangMessageItem[];
}[] | LangMessages | LangMessage[], options?: {
signal?: AbortSignal;
}): Promise<LangMessages>;
getMessages(): LangMessages;
setLanguageProvider(lang: LanguageProvider): void;
}