@h-lumos/llm-sdk
Version:
66 lines (64 loc) • 2.97 kB
TypeScript
import { Agent } from 'node:http';
import { APIClient, DefaultQuery, Fetch, FinalRequestOptions, Headers } from 'openai/core';
import * as API from './resources';
export interface QWenAIOptions {
baseURL?: string;
apiKey?: string;
timeout?: number | undefined;
httpAgent?: Agent;
fetch?: Fetch | undefined;
/**
* Default headers to include with every request to the API.
*
* These can be removed in individual requests by explicitly setting the
* header to `undefined` or `null` in request options.
*/
defaultHeaders?: Headers;
/**
* Default query parameters to include with every request to the API.
*
* These can be removed in individual requests by explicitly setting the
* param to `undefined` in request options.
*/
defaultQuery?: DefaultQuery;
}
/**
* 基于阿里云 [DashScope 灵积模型服务](https://help.aliyun.com/zh/dashscope/product-overview/product-introduction) 的接口封装
*
* @deprecated 请重点关注阿里云的 [OpenAI接口兼容](https://help.aliyun.com/zh/dashscope/developer-reference/compatibility-of-openai-with-dashscope/) 计划。
*/
export declare class QWenAI extends APIClient {
protected apiKey: string;
private _options;
constructor(options?: QWenAIOptions);
chat: API.Chat;
completions: API.Completions;
embeddings: API.Embeddings;
images: API.Images;
protected authHeaders(): {
Authorization: string;
};
protected defaultHeaders(opts: FinalRequestOptions): Headers;
protected defaultQuery(): DefaultQuery | undefined;
fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
protected makeStatusError(status: number | undefined, error: Record<string, any> | undefined, message: string | undefined, headers: Headers | undefined): import('openai/error').APIError;
}
export declare namespace QWenAI {
export import Chat = API.Chat;
export import ChatModel = API.ChatModel;
export import ChatCompletionCreateParams = API.ChatCompletionCreateParams;
export import ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming;
export import ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming;
export import Completions = API.Completions;
export import CompletionModel = API.CompletionModel;
type CompletionCreateParams = API.CompletionCreateParams;
type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
type CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming;
export import Embeddings = API.Embeddings;
type EmbeddingModel = API.EmbeddingModel;
type EmbeddingCreateParams = API.EmbeddingCreateParams;
export import Images = API.Images;
type ImageModel = API.ImageModel;
type ImageGenerateParams = API.ImageGenerateParams;
}
export default QWenAI;