@h-lumos/llm-sdk
Version:
63 lines (61 loc) • 2.03 kB
TypeScript
import { APIClient, DefaultQuery, Fetch, Headers } from 'openai/core';
import * as API from './resources';
export interface SparkAIOptions {
baseURL?: string;
appId?: string;
apiKey?: string;
apiSecret?: string;
timeout?: number | undefined;
httpAgent?: unknown;
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;
}
export declare class SparkAI extends APIClient {
appId: string;
protected apiKey: string;
protected apiSecret: string;
private _options;
constructor(options?: SparkAIOptions);
chat: API.Chat;
images: API.Images;
protected defaultQuery(): DefaultQuery | undefined;
/**
* @param url - 需要签名的 URL
* @param method - HTTP method
* @returns 签名后的 URL
*/
generateAuthorizationURL(url: string | URL, method?: string): string;
/**
* 生成鉴权信息
*
* See https://www.xfyun.cn/doc/spark/general_url_authentication.html
*/
generateAuthorization({ method, host, path, date }: {
method: string;
host: string;
path: string;
date: string;
}): string;
protected hash(data: string): string;
}
export declare namespace SparkAI {
type Chat = API.Chat;
type ChatModel = API.ChatModel;
type ChatCompletionCreateParams = API.ChatCompletionCreateParams;
type ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming;
type ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming;
}
export default SparkAI;