@cloudbase/js-sdk 3.8.2-beta.1 → 3.8.2-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/ai/dist/AI.d.ts +29 -0
  2. package/ai/dist/bot/index.d.ts +41 -0
  3. package/ai/dist/bot/types.d.ts +144 -0
  4. package/ai/dist/errors.d.ts +10 -0
  5. package/ai/dist/eventsource_parser/index.d.ts +2 -0
  6. package/ai/dist/eventsource_parser/parse.d.ts +2 -0
  7. package/ai/dist/eventsource_parser/stream.d.ts +5 -0
  8. package/ai/dist/eventsource_parser/types.d.ts +16 -0
  9. package/ai/dist/index.d.ts +42 -1
  10. package/ai/dist/models/Ark/index.d.ts +10 -0
  11. package/ai/dist/models/Ark/type.d.ts +71 -0
  12. package/ai/dist/models/DashScope/index.d.ts +10 -0
  13. package/ai/dist/models/DashScope/type.d.ts +74 -0
  14. package/ai/dist/models/DeepSeek/index.d.ts +10 -0
  15. package/ai/dist/models/Default/index.d.ts +10 -0
  16. package/ai/dist/models/HunYuan/index.d.ts +10 -0
  17. package/ai/dist/models/HunYuan/type.d.ts +74 -0
  18. package/ai/dist/models/HunYuan/util.d.ts +4 -0
  19. package/ai/dist/models/HunYuanBeta/index.d.ts +10 -0
  20. package/ai/dist/models/HunYuanExp/index.d.ts +10 -0
  21. package/ai/dist/models/HunYuanOpen/index.d.ts +10 -0
  22. package/ai/dist/models/Moonshot/index.d.ts +10 -0
  23. package/ai/dist/models/Moonshot/type.d.ts +85 -0
  24. package/ai/dist/models/Yi/index.d.ts +10 -0
  25. package/ai/dist/models/Yi/type.d.ts +75 -0
  26. package/ai/dist/models/ZhiPu/index.d.ts +10 -0
  27. package/ai/dist/models/ZhiPu/type.d.ts +71 -0
  28. package/ai/dist/models/image-model.d.ts +19 -0
  29. package/ai/dist/models/index.d.ts +26 -0
  30. package/ai/dist/models/model.d.ts +40 -0
  31. package/ai/dist/type.d.ts +192 -0
  32. package/ai/dist/utils.d.ts +38 -0
  33. package/apis/dist/callApis.d.ts +20 -0
  34. package/apis/dist/index.d.ts +5 -1
  35. package/apis/dist/type.d.ts +14 -0
  36. package/app/dist/constants/common.d.ts +38 -0
  37. package/app/dist/index.d.ts +66 -7
  38. package/app/dist/index.esm.js +1 -1
  39. package/app/dist/index.js +1 -1
  40. package/app/dist/index.js.map +1 -1
  41. package/app/dist/index.node.d.ts +6 -0
  42. package/app/dist/index.node.esm.js +1 -1
  43. package/app/dist/index.node.esm.js.map +1 -1
  44. package/app/dist/index.node.js +1 -1
  45. package/app/dist/index.node.js.map +1 -1
  46. package/app/dist/libs/adapter-node/constants.d.ts +33 -0
  47. package/app/dist/libs/adapter-node/context.d.ts +18 -0
  48. package/app/dist/libs/adapter-node/index.d.ts +26 -0
  49. package/app/dist/libs/adapter-node/metadata.d.ts +14 -0
  50. package/app/dist/libs/adapter-node/optional-require.d.ts +1 -0
  51. package/app/dist/libs/adapter-node/request.d.ts +44 -0
  52. package/app/dist/libs/adapter-node/tool.d.ts +2 -0
  53. package/app/dist/libs/adapter-node/types.d.ts +103 -0
  54. package/app/dist/libs/adapter-node/utils.d.ts +37 -0
  55. package/app/dist/libs/adapter-node/wx.d.ts +39 -0
  56. package/app/dist/libs/adapter.d.ts +3 -0
  57. package/app/dist/libs/cache.d.ts +6 -0
  58. package/app/dist/libs/component.d.ts +3 -0
  59. package/app/dist/libs/lang.d.ts +23 -0
  60. package/app/dist/libs/request.d.ts +62 -0
  61. package/auth/dist/adapter.d.ts +2 -0
  62. package/auth/dist/index.d.ts +271 -2
  63. package/auth/dist/type.d.ts +295 -0
  64. package/auth/dist/utilities.d.ts +7 -0
  65. package/auth/dist/utils.d.ts +5 -0
  66. package/auth/dist/v1-compat.d.ts +77 -0
  67. package/cloudrun/dist/index.d.ts +4 -1
  68. package/container/dist/constants/index.d.ts +1 -0
  69. package/container/dist/go_wams_exec.d.ts +2 -0
  70. package/container/dist/index.d.ts +13 -2
  71. package/container/dist/utils/index.d.ts +3 -0
  72. package/container/dist/utils/loader.d.ts +8 -0
  73. package/container/dist/utils/request.d.ts +12 -0
  74. package/core.d.ts +84 -81
  75. package/database/dist/index.d.ts +1 -1
  76. package/dist/index.cjs.js +1 -1
  77. package/dist/index.esm.js +1 -1
  78. package/dist/index.node.cjs.js +1 -1
  79. package/dist/index.node.esm.js +1 -1
  80. package/dist/index.node.esm.js.map +1 -1
  81. package/functions/dist/index.d.ts +2 -2
  82. package/miniprogram_dist/ai/index.d.ts +1 -1
  83. package/miniprogram_dist/apis/index.d.ts +1 -1
  84. package/miniprogram_dist/app/index.d.ts +5 -5
  85. package/miniprogram_dist/auth/index.d.ts +7 -7
  86. package/miniprogram_dist/cloudrun/index.d.ts +2 -2
  87. package/miniprogram_dist/container/index.d.ts +2 -2
  88. package/miniprogram_dist/database/index.d.ts +1 -1
  89. package/miniprogram_dist/functions/index.d.ts +1 -1
  90. package/miniprogram_dist/index.js +1 -1
  91. package/miniprogram_dist/model/index.d.ts +1 -1
  92. package/miniprogram_dist/mysql/index.d.ts +1 -1
  93. package/miniprogram_dist/realtime/index.d.ts +1 -1
  94. package/miniprogram_dist/storage/index.d.ts +1 -1
  95. package/model/dist/index.d.ts +5 -1
  96. package/mysql/dist/index.d.ts +4 -1
  97. package/oauth/dist/auth/apis.d.ts +143 -0
  98. package/oauth/dist/auth/auth-error.d.ts +32 -0
  99. package/oauth/dist/auth/consts.d.ts +165 -0
  100. package/oauth/dist/auth/models.d.ts +557 -0
  101. package/oauth/dist/captcha/captcha-dom.d.ts +3 -0
  102. package/oauth/dist/captcha/captcha.d.ts +42 -0
  103. package/oauth/dist/index.d.ts +22 -1
  104. package/oauth/dist/oauth2client/consts.d.ts +20 -0
  105. package/oauth/dist/oauth2client/interface.d.ts +15 -0
  106. package/oauth/dist/oauth2client/models.d.ts +75 -0
  107. package/oauth/dist/oauth2client/oauth2client.d.ts +154 -0
  108. package/oauth/dist/utils/base64.d.ts +9 -0
  109. package/oauth/dist/utils/encrypt.d.ts +4 -0
  110. package/oauth/dist/utils/encryptlong/index.d.ts +546 -0
  111. package/oauth/dist/utils/function/single-promise.d.ts +10 -0
  112. package/oauth/dist/utils/index.d.ts +2 -0
  113. package/oauth/dist/utils/mp.d.ts +2 -0
  114. package/oauth/dist/utils/urlSearchParams.d.ts +13 -0
  115. package/oauth/dist/utils/uuid.d.ts +1 -0
  116. package/package.json +20 -3
  117. package/realtime/dist/common.d.ts +4 -0
  118. package/realtime/dist/error.d.ts +36 -0
  119. package/realtime/dist/index.d.ts +4 -2
  120. package/realtime/dist/listener.d.ts +14 -0
  121. package/realtime/dist/message.d.ts +3 -0
  122. package/realtime/dist/snapshot.d.ts +17 -0
  123. package/realtime/dist/utils.d.ts +1 -0
  124. package/realtime/dist/virtual-websocket-client.d.ts +62 -0
  125. package/realtime/dist/websocket-client.d.ts +78 -0
  126. package/realtime/dist/ws-event.d.ts +126 -0
  127. package/storage/dist/cloudbase-storage.d.ts +58 -0
  128. package/storage/dist/download-builder.d.ts +24 -0
  129. package/storage/dist/encoding.d.ts +3 -0
  130. package/storage/dist/http.d.ts +38 -0
  131. package/storage/dist/index.d.ts +13 -2
  132. package/storage/dist/node-types.d.ts +6 -0
  133. package/storage/dist/storage-bucket-api-neo.d.ts +15 -0
  134. package/storage/dist/storage-file-api-classic.d.ts +80 -0
  135. package/storage/dist/storage-file-api-neo.d.ts +48 -0
  136. package/storage/dist/supabase/errors.d.ts +20 -0
  137. package/storage/dist/supabase/types.d.ts +63 -0
  138. package/storage/dist/types.d.ts +142 -0
  139. package/storage/dist/validation.d.ts +2 -0
  140. package/types/auth.d.ts +1 -1
  141. package/types/index.d.ts +3 -2
  142. package/types/package.json +1 -1
  143. package/utilities/dist/cjs/libs/cache.d.ts +2 -2
  144. package/utilities/dist/cjs/libs/events.d.ts +1 -1
  145. package/utilities/dist/cjs/libs/util.d.ts +1 -1
  146. package/utilities/dist/esm/libs/cache.d.ts +2 -2
  147. package/utilities/dist/esm/libs/events.d.ts +1 -1
  148. package/utilities/dist/esm/libs/util.d.ts +1 -1
  149. package/utilities/package.json +1 -1
@@ -0,0 +1,29 @@
1
+ import type { SDKRequestInterface } from '@cloudbase/adapter-interface';
2
+ import { Bot } from './bot';
3
+ import * as models from './models';
4
+ import * as types from './type';
5
+ import { ICloudbaseConfig } from '@cloudbase/js-sdk/types';
6
+ declare class AI {
7
+ private req;
8
+ baseUrl: string;
9
+ bot: Bot;
10
+ i18n: ICloudbaseConfig['i18n'];
11
+ defaultHeaders: {
12
+ [x: string]: any;
13
+ };
14
+ private _getBaseUrl?;
15
+ get aiBaseUrl(): string;
16
+ get aiBotBaseUrl(): string;
17
+ constructor(req: SDKRequestInterface, baseUrl: string, i18n: ICloudbaseConfig['i18n'], getBaseUrl?: () => string);
18
+ handleResponseData(responseData: Promise<unknown> | ReadableStream<Uint8Array>, header?: Headers): Promise<unknown>;
19
+ createModel(model: string, options?: {
20
+ defaultModelSubUrl?: string;
21
+ }): models.ReactModel;
22
+ registerModel(name: string, model: types.ChatModelConstructor): void;
23
+ createImageModel<T extends 'hunyuan-image' | (string & {})>(provider: T): models.DefaultImageModel<T>;
24
+ modelRequest: types.ModelReq;
25
+ botRequest: types.BotReq;
26
+ registerFunctionTool(functionTool: types.FunctionTool): void;
27
+ private resolveUrl;
28
+ }
29
+ export { AI };
@@ -0,0 +1,41 @@
1
+ import { type ParsedEvent } from '../eventsource_parser';
2
+ import { BotReq, ReqOptions } from '../type';
3
+ import { IBotCreateConversation, IBotDeleteConversation, IBotGetConversation, IBotGetTextToSpeechResult, IBotPreview, IBotSendMessage, IBotSpeechToText, IBotTextToSpeech, IBotUploadFiles, ICreateBot, IDeleteBot, IGenerateBot, IGenerateImage, IGetBot, IGetBotChatRecords, IGetBotFeedback, IGetBotList, IGetBotRecommendQuestions, ISendBotFeedback, IUpdateBot } from './types';
4
+ export declare class Bot {
5
+ baseUrl: string;
6
+ req: BotReq;
7
+ constructor(req: BotReq, baseUrl: string);
8
+ list(props: IGetBotList, options?: ReqOptions): Promise<Object>;
9
+ create({ botInfo }: ICreateBot, options?: ReqOptions): Promise<Object>;
10
+ get({ botId }: IGetBot, options?: ReqOptions): Promise<Object>;
11
+ update({ botId, botInfo }: IUpdateBot, options?: ReqOptions): Promise<Object>;
12
+ delete({ botId }: IDeleteBot, options?: ReqOptions): Promise<Object>;
13
+ getChatRecords(props: IGetBotChatRecords, options?: ReqOptions): Promise<Object>;
14
+ sendFeedback({ userFeedback }: ISendBotFeedback, options?: ReqOptions): Promise<Object>;
15
+ getFeedback(props: IGetBotFeedback, options?: ReqOptions): Promise<Object>;
16
+ uploadFiles(props: IBotUploadFiles, options?: ReqOptions): Promise<Object>;
17
+ createConversation({ botId, ...rest }: IBotCreateConversation, options?: ReqOptions): Promise<Object>;
18
+ getConversation({ pageSize, pageNumber, botId, ...rest }: IBotGetConversation, options?: ReqOptions): Promise<Object>;
19
+ deleteConversation({ botId, conversationId, ...rest }: IBotDeleteConversation, options?: ReqOptions): Promise<Object>;
20
+ speechToText(props: IBotSpeechToText, options?: ReqOptions): Promise<Object>;
21
+ textToSpeech(props: IBotTextToSpeech, options?: ReqOptions): Promise<Object>;
22
+ getTextToSpeechResult(props: IBotGetTextToSpeechResult, options?: ReqOptions): Promise<Object>;
23
+ getRecommendQuestions(props: IGetBotRecommendQuestions, options?: ReqOptions): Promise<StreamResult>;
24
+ generateBot(props: IGenerateBot, options?: ReqOptions): Promise<StreamResult>;
25
+ getPreview(props: IBotPreview, options?: ReqOptions): Promise<StreamResult>;
26
+ generateImage(props: IGenerateImage, options?: ReqOptions): Promise<Object>;
27
+ sendMessage(props: IBotSendMessage, options?: ReqOptions): Promise<StreamResult>;
28
+ private join;
29
+ }
30
+ type BotEventStreamData = {
31
+ content: string;
32
+ };
33
+ declare class StreamResult {
34
+ private _eventSourceStream;
35
+ constructor(_stream: ReadableStream<Uint8Array>);
36
+ private get teeedStream();
37
+ get eventSourceStream(): import("../type").AsyncIterableReadableStream<ParsedEvent>;
38
+ get dataStream(): import("../type").AsyncIterableReadableStream<BotEventStreamData>;
39
+ get textStream(): import("../type").AsyncIterableReadableStream<string>;
40
+ }
41
+ export {};
@@ -0,0 +1,144 @@
1
+ export interface IGetBotList {
2
+ name: string;
3
+ introduction: string;
4
+ information: string;
5
+ enable: boolean;
6
+ pageSize: number;
7
+ pageNumber: number;
8
+ }
9
+ export interface ICreateBot {
10
+ botInfo: BotInfo;
11
+ }
12
+ export interface IGetBot {
13
+ botId: string;
14
+ }
15
+ export interface IUpdateBot {
16
+ botId: string;
17
+ botInfo: BotInfo;
18
+ }
19
+ export interface IDeleteBot {
20
+ botId: string;
21
+ }
22
+ export interface IGetBotChatRecords {
23
+ botId: string;
24
+ sort: 'asc' | 'desc' | string;
25
+ pageSize: number;
26
+ pageNumber: number;
27
+ }
28
+ export interface ISendBotFeedback {
29
+ userFeedback: IUserFeedback;
30
+ }
31
+ export interface IGetBotFeedback {
32
+ botId: string;
33
+ type: 'upvote' | 'downvote' | string;
34
+ sender: string;
35
+ senderFilter: 'include' | 'exclude' | 'equal' | 'unequal' | 'prefix' | string;
36
+ minRating: number;
37
+ maxRating: number;
38
+ from: number;
39
+ to: number;
40
+ pageSize: number;
41
+ pageNumber: number;
42
+ }
43
+ export interface IGetBotRecommendQuestions {
44
+ botId: string;
45
+ name: string;
46
+ introduction: string;
47
+ agentSetting: string;
48
+ msg: string;
49
+ history: Array<{
50
+ role: string;
51
+ content: string;
52
+ }>;
53
+ }
54
+ export interface IGenerateBot {
55
+ simple: boolean;
56
+ prompt: string;
57
+ }
58
+ export interface IBotPreview {
59
+ name: string;
60
+ introduction: string;
61
+ agentSetting: string;
62
+ msg: string;
63
+ history: Array<{
64
+ role: string;
65
+ content: string;
66
+ }>;
67
+ knowledgeBase: Array<string>;
68
+ }
69
+ export interface IGenerateImage {
70
+ prompt: string;
71
+ }
72
+ export interface IBotSendMessage {
73
+ botId: string;
74
+ msg: string;
75
+ history: Array<{
76
+ role: string;
77
+ content: string;
78
+ }>;
79
+ }
80
+ export interface IBotUploadFiles {
81
+ botId: string;
82
+ fileList: Array<{
83
+ fileName: string;
84
+ fileId: string;
85
+ type: string;
86
+ }>;
87
+ }
88
+ export interface IBotCreateConversation {
89
+ botId: string;
90
+ title?: string;
91
+ }
92
+ export interface IBotGetConversation {
93
+ botId: string;
94
+ pageSize?: number;
95
+ pageNumber?: number;
96
+ isDefault?: boolean;
97
+ }
98
+ export interface IBotDeleteConversation {
99
+ botId: string;
100
+ conversationId: string;
101
+ }
102
+ export interface IBotSpeechToText {
103
+ botId: string;
104
+ engSerViceType: string;
105
+ voiceFormat: string;
106
+ url: string;
107
+ isPreview?: boolean;
108
+ }
109
+ export interface IBotTextToSpeech {
110
+ botId: string;
111
+ voiceType: number;
112
+ text: string;
113
+ isPreview?: boolean;
114
+ }
115
+ export interface IBotGetTextToSpeechResult {
116
+ botId: string;
117
+ taskId: string;
118
+ isPreview?: boolean;
119
+ }
120
+ export interface IUserFeedback {
121
+ recordId: string;
122
+ type: string;
123
+ botId: string;
124
+ comment: string;
125
+ rating: number;
126
+ tags: Array<string>;
127
+ input: string;
128
+ aiAnswer: string;
129
+ }
130
+ export interface BotInfo {
131
+ botId: string;
132
+ name: string;
133
+ introduction: string;
134
+ agentSetting: string;
135
+ welcomeMessage: string;
136
+ avatar: string;
137
+ background: string;
138
+ tags: Array<string>;
139
+ isNeedRecommend: boolean;
140
+ knowledgeBase: Array<string>;
141
+ type: string;
142
+ initQuestions: Array<string>;
143
+ enable: true;
144
+ }
@@ -0,0 +1,10 @@
1
+ export declare class InvalidParamsError extends Error {
2
+ code: string;
3
+ field?: string;
4
+ constructor(message: string, field?: string);
5
+ toJSON(): {
6
+ code: string;
7
+ message: string;
8
+ field: string;
9
+ };
10
+ }
@@ -0,0 +1,2 @@
1
+ export type { EventSourceParser, ParsedEvent, ReconnectInterval, ParseEvent, EventSourceParseCallback } from './types';
2
+ export { createParser } from './parse';
@@ -0,0 +1,2 @@
1
+ import type { EventSourceParseCallback, EventSourceParser } from './types';
2
+ export declare function createParser(onParse: EventSourceParseCallback): EventSourceParser;
@@ -0,0 +1,5 @@
1
+ import type { ParsedEvent } from './types';
2
+ export declare class EventSourceParserStream extends TransformStream<string, ParsedEvent> {
3
+ constructor();
4
+ }
5
+ export type { ParsedEvent } from './types';
@@ -0,0 +1,16 @@
1
+ export interface EventSourceParser {
2
+ feed(chunk: string): void;
3
+ reset(): void;
4
+ }
5
+ export interface ParsedEvent {
6
+ type: 'event';
7
+ event?: string;
8
+ id?: string;
9
+ data: string;
10
+ }
11
+ export interface ReconnectInterval {
12
+ type: 'reconnect-interval';
13
+ value: number;
14
+ }
15
+ export type ParseEvent = ParsedEvent | ReconnectInterval;
16
+ export type EventSourceParseCallback = (event: ParseEvent) => void;
@@ -1 +1,42 @@
1
- export * from '@cloudbase/ai';
1
+ import type { SDKRequestInterface } from '@cloudbase/adapter-interface';
2
+ import type { ICloudbase, ICloudbaseConfig } from '@cloudbase/js-sdk/types';
3
+ import { AI } from './AI';
4
+ import { Bot } from './bot';
5
+ import * as models from './models';
6
+ import * as utils from './utils';
7
+ declare const restModels: {
8
+ ZhiPuSimpleModel: typeof models.ZhiPuSimpleModel;
9
+ HunYuanBetaSimpleModel: typeof models.HunYuanBetaSimpleModel;
10
+ HunYuanSimpleModel: typeof models.HunYuanSimpleModel;
11
+ ArkSimpleModel: typeof models.ArkSimpleModel;
12
+ DSSimpleModel: typeof models.DSSimpleModel;
13
+ YiSimpleModel: typeof models.YiSimpleModel;
14
+ MoonshotSimpleModel: typeof models.MoonshotSimpleModel;
15
+ HunYuanExpSimpleModel: typeof models.HunYuanExpSimpleModel;
16
+ HunYuanOpenSimpleModel: typeof models.HunYuanOpenSimpleModel;
17
+ DefaultSimpleModel: typeof models.DefaultSimpleModel;
18
+ DefaultImageModel: typeof models.DefaultImageModel;
19
+ ReactModel: typeof models.ReactModel;
20
+ toolMap: Map<string, CallableFunction>;
21
+ };
22
+ interface IHandleRequestInstance {
23
+ req: SDKRequestInterface;
24
+ }
25
+ type HandleRequestInstanceFunc = (options: IHandleRequestInstance) => SDKRequestInterface;
26
+ interface ICreateAI {
27
+ req: SDKRequestInterface;
28
+ baseUrl?: string;
29
+ getBaseUrl?: () => string;
30
+ env?: string;
31
+ getAccessToken?: () => Promise<{
32
+ accessToken: string;
33
+ }>;
34
+ handleReqInstance?: HandleRequestInstanceFunc;
35
+ i18n?: ICloudbaseConfig['i18n'];
36
+ }
37
+ declare function createAI({ env, baseUrl, getBaseUrl: getBaseUrlFunc, req, getAccessToken, handleReqInstance, i18n }: ICreateAI): AI;
38
+ declare const createAi: typeof createAI;
39
+ declare function registerAi(app: ICloudbase): void;
40
+ export { AI, Bot, createAi, createAI, restModels as models, registerAi, utils };
41
+ export * from './type';
42
+ export * from './errors';
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, SimpleChatModel, DoGenerateOutput, DoStreamOutput, ReqOptions } from '../../type';
2
+ export declare class ArkSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput, options?: ReqOptions): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput, options?: ReqOptions): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,71 @@
1
+ type UserMessage = {
2
+ role: 'user';
3
+ content: string;
4
+ };
5
+ type SystemMessage = {
6
+ role: 'system';
7
+ content: string;
8
+ };
9
+ type ToolMessage = {
10
+ role: 'tool';
11
+ content: string;
12
+ tool_call_id: string;
13
+ };
14
+ type AssistantMessage = {
15
+ role: 'assistant';
16
+ content: string;
17
+ } | {
18
+ role: 'assistant';
19
+ tool_calls: Array<ToolCall>;
20
+ content?: string;
21
+ };
22
+ type ToolCall = {
23
+ id: string;
24
+ type: string;
25
+ function: {
26
+ name: string;
27
+ arguments: string;
28
+ };
29
+ };
30
+ type ArkMessage = UserMessage | SystemMessage | AssistantMessage | ToolMessage;
31
+ export type ArkInputData = {
32
+ model: string;
33
+ messages: Array<ArkMessage>;
34
+ max_tokens?: number;
35
+ stop?: string | Array<string>;
36
+ frequency_penalty?: number;
37
+ temperature?: number;
38
+ top_p?: number;
39
+ tools?: Array<Tool>;
40
+ };
41
+ type Tool = {
42
+ type: string;
43
+ function: {
44
+ name: string;
45
+ description?: string;
46
+ parameters?: object;
47
+ };
48
+ };
49
+ export type ArkGenerateTextOutput = {
50
+ choices?: Array<{
51
+ finish_reason: string;
52
+ message?: AssistantMessage;
53
+ }>;
54
+ usage?: {
55
+ prompt_tokens: number;
56
+ completion_tokens: number;
57
+ total_tokens: number;
58
+ };
59
+ };
60
+ export type ArkStreamTextOutput = {
61
+ choices?: Array<{
62
+ finish_reason: string;
63
+ delta: AssistantMessage;
64
+ }>;
65
+ usage?: {
66
+ prompt_tokens: number;
67
+ completion_tokens: number;
68
+ total_tokens: number;
69
+ };
70
+ };
71
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, DoGenerateOutput, DoStreamOutput, SimpleChatModel, ReqOptions } from '../../type';
2
+ export declare class DSSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput, options?: ReqOptions): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput, options?: ReqOptions): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,74 @@
1
+ export type DSInput = {
2
+ model: string;
3
+ messages: Array<Message>;
4
+ temperature?: number;
5
+ top_p?: number;
6
+ tools?: Array<{
7
+ type: string;
8
+ function: {
9
+ name: string;
10
+ description: string;
11
+ parameters: object;
12
+ };
13
+ }>;
14
+ };
15
+ type Message = SystemMessage | UserMessage | AssistantMessage | ToolMessage;
16
+ type SystemMessage = {
17
+ content: string;
18
+ role: 'system';
19
+ };
20
+ type UserMessage = {
21
+ content: string;
22
+ role: 'user';
23
+ };
24
+ type ToolMessage = {
25
+ content: string;
26
+ role: 'tool';
27
+ };
28
+ type AssistantMessage = {
29
+ role: 'assistant';
30
+ content: string;
31
+ } | {
32
+ role: 'assistant';
33
+ tool_calls: Array<ToolCall>;
34
+ content?: string;
35
+ };
36
+ type ToolCall = {
37
+ id: string;
38
+ type: string;
39
+ function: {
40
+ name: string;
41
+ arguments: string;
42
+ };
43
+ };
44
+ export type DSGenerateOutput = {
45
+ choices: Array<{
46
+ finish_reason: string;
47
+ message: {
48
+ content: string;
49
+ role: 'assistant';
50
+ tool_calls?: Array<ToolCall>;
51
+ };
52
+ }>;
53
+ usage: {
54
+ prompt_tokens: number;
55
+ completion_tokens: number;
56
+ total_tokens: number;
57
+ };
58
+ };
59
+ export type DSStreamOutput = {
60
+ choices: Array<{
61
+ delta: {
62
+ content: string;
63
+ tool_calls?: Array<ToolCall>;
64
+ role?: 'assistant';
65
+ };
66
+ finish_reason: string;
67
+ }>;
68
+ usage?: {
69
+ prompt_tokens: number;
70
+ completion_tokens: number;
71
+ total_tokens: number;
72
+ };
73
+ };
74
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, SimpleChatModel, DoStreamOutput, DoGenerateOutput, ReqOptions } from '../../type';
2
+ export declare class DeepSeekSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput, options?: ReqOptions): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput, options?: ReqOptions): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, SimpleChatModel, DoStreamOutput, DoGenerateOutput } from '../../type';
2
+ export declare class DefaultSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, DoStreamOutput, SimpleChatModel, DoGenerateOutput, ReqOptions } from '../../type';
2
+ export declare class HunYuanSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput, options?: ReqOptions): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput, options?: ReqOptions): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,74 @@
1
+ type HunYuanUserMessage = {
2
+ role: 'user';
3
+ content: string;
4
+ };
5
+ type HunYuanSystemMessage = {
6
+ role: 'system';
7
+ content: string;
8
+ };
9
+ type HunYuanToolMessage = {
10
+ role: 'tool';
11
+ content: string;
12
+ tool_call_id: string;
13
+ };
14
+ type HunYuanAssistantMessage = {
15
+ role: 'assistant';
16
+ content: string;
17
+ } | {
18
+ role: 'assistant';
19
+ tool_calls: Array<HunYuanToolCall>;
20
+ content?: string;
21
+ };
22
+ type HunYuanToolCall = {
23
+ id: string;
24
+ type: 'function';
25
+ function: HunYuanToolCallFunction;
26
+ };
27
+ type HunYuanToolCallFunction = {
28
+ name: string;
29
+ arguments: string;
30
+ };
31
+ export type HunYuanMessage = HunYuanUserMessage | HunYuanSystemMessage | HunYuanToolMessage | HunYuanAssistantMessage;
32
+ type HunYuanTool = {
33
+ type: 'function';
34
+ function: HunYuanToolFunction;
35
+ };
36
+ type HunYuanToolFunction = {
37
+ name: string;
38
+ parameters: object;
39
+ description?: string;
40
+ };
41
+ export type HunYuanInputData = {
42
+ model: (string & {}) | 'hunyuan-lite' | 'hunyuan-standard' | 'hunyuan-standard-256K' | 'hunyuan-pro' | 'hunyuan-code' | 'hunyuan-role' | 'hunyuan-functioncall' | 'hunyuan-vision';
43
+ messages: Array<HunYuanMessage>;
44
+ stream_moderation?: boolean;
45
+ top_p?: number;
46
+ temperature?: number;
47
+ enable_enhancement?: boolean;
48
+ tools?: Array<HunYuanTool>;
49
+ tool_choice?: 'none' | 'auto' | 'custom';
50
+ custom_tool?: HunYuanTool;
51
+ search_info?: boolean;
52
+ };
53
+ type Usage = {
54
+ prompt_tokens: number;
55
+ completion_tokens: number;
56
+ total_tokens: number;
57
+ };
58
+ export type HunYuanGenerateTextOutput = {
59
+ choices?: Array<GenerateChoice>;
60
+ usage?: Usage;
61
+ };
62
+ type GenerateChoice = {
63
+ finish_reason?: string;
64
+ message: HunYuanMessage;
65
+ };
66
+ type StreamChoice = {
67
+ finish_reason?: string;
68
+ delta: HunYuanAssistantMessage;
69
+ };
70
+ export type HunYuanStreamTextOutput = {
71
+ choices?: Array<StreamChoice>;
72
+ usage?: Usage;
73
+ };
74
+ export {};
@@ -0,0 +1,4 @@
1
+ import { HunYuanInputData } from './type';
2
+ import { BaseChatModelInput } from '../../type';
3
+ export declare function processInput(input: BaseChatModelInput): HunYuanInputData;
4
+ export declare function titleCaseToSnakeCase(obj: unknown): any;
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, SimpleChatModel, DoStreamOutput, DoGenerateOutput, ReqOptions } from '../../type';
2
+ export declare class HunYuanBetaSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput, options?: ReqOptions): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput, options?: ReqOptions): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, SimpleChatModel, DoStreamOutput, DoGenerateOutput } from '../../type';
2
+ export declare class HunYuanExpSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, BaseChatModelInput, SimpleChatModel, DoStreamOutput, DoGenerateOutput, ReqOptions } from '../../type';
2
+ export declare class HunYuanOpenSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput, options?: ReqOptions): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput, options?: ReqOptions): Promise<DoStreamOutput>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import type { ModelReq, DoGenerateOutput, DoStreamOutput, SimpleChatModel, BaseChatModelInput, ReqOptions } from '../../type';
2
+ export declare class MoonshotSimpleModel implements SimpleChatModel {
3
+ private req;
4
+ baseUrl: string;
5
+ subUrl: string;
6
+ constructor(req: ModelReq, baseUrl: string, subUrl?: string);
7
+ private get url();
8
+ doGenerate(data: BaseChatModelInput, options?: ReqOptions): Promise<DoGenerateOutput>;
9
+ doStream(data: BaseChatModelInput, options?: ReqOptions): Promise<DoStreamOutput>;
10
+ }