aisapi
Version:
A JavaScript/TypeScript API library for multiple AI providers
52 lines • 1.42 kB
TypeScript
import { BaseProvider } from './base';
import { TextGenerationParams, TextGenerationResponse, ProviderOptions, ChatCompletionParams } from '../types';
/**
* 智谱AI提供商特定选项
*/
export interface ZhipuOptions extends ProviderOptions {
model?: string;
}
/**
* 智谱AI可用模型
*/
export declare enum ZhipuModel {
GLM_4 = "glm-4",// GLM-4多模态模型,128k上下文
GLM_3_TURBO = "glm-3-turbo",// GLM-3-turbo高性能对话模型
CHATGLM_PRO = "chatglm_pro"
}
/**
* 智谱AI API实现
*/
export declare class ZhipuProvider extends BaseProvider {
readonly name = "Zhipu";
private model;
/**
* 创建智谱AI提供商实例
*/
constructor(options?: ZhipuOptions);
/**
* @inheritdoc
*/
protected getDefaultBaseUrl(): string;
/**
* 获取请求头
*/
protected getHeaders(): Record<string, string>;
/**
* @inheritdoc
*/
generateText(params: TextGenerationParams): Promise<TextGenerationResponse>;
/**
* 聊天完成API
*/
chatCompletion(params: ChatCompletionParams): Promise<TextGenerationResponse>;
/**
* 流式聊天完成
*/
createStreamingChatCompletion(params: ChatCompletionParams): Promise<ReadableStream<any>>;
/**
* 生成JSON格式输出
*/
generateJSON(params: TextGenerationParams): Promise<any>;
}
//# sourceMappingURL=zhipu.d.ts.map