gpt4free-ts/model/base.ts

32 行
577 B
TypeScript
Raw 通常表示 履歴

2023-05-05 10:57:42 +09:00
import {Stream} from "stream";
export interface ChatOptions {
}
export interface Response {
text: string | null;
2023-05-05 19:36:27 +09:00
other?: any;
2023-05-05 10:57:42 +09:00
}
export interface ResponseStream {
text: Stream;
2023-05-05 19:36:27 +09:00
other?: any;
2023-05-05 10:57:42 +09:00
}
export interface Request {
prompt: string;
options?: any;
}
export abstract class Chat {
2023-05-07 01:30:22 +09:00
protected options: ChatOptions | undefined;
2023-05-05 10:57:42 +09:00
2023-05-05 19:36:27 +09:00
protected constructor(options?: ChatOptions) {
2023-05-07 01:30:22 +09:00
this.options = options;
2023-05-05 10:57:42 +09:00
}
public abstract ask(req: Request): Promise<Response>
public abstract askStream(req: Request): Promise<ResponseStream>
}