@cloudbase/ai 2.8.20-beta.0 → 2.8.22-beta.0

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 (106) hide show
  1. package/dist/cjs/AI.d.ts +27 -0
  2. package/dist/cjs/AI.js +154 -0
  3. package/dist/cjs/index.d.ts +13 -38
  4. package/dist/cjs/index.js +9 -73
  5. package/dist/cjs/models/Ark/index.d.ts +4 -18
  6. package/dist/cjs/models/Ark/index.js +45 -82
  7. package/dist/cjs/models/Ark/type.d.ts +52 -19
  8. package/dist/cjs/models/Ark/type.js +1 -1
  9. package/dist/cjs/models/DashScope/index.d.ts +4 -18
  10. package/dist/cjs/models/DashScope/index.js +45 -82
  11. package/dist/cjs/models/DashScope/type.d.ts +55 -24
  12. package/dist/cjs/models/DashScope/type.js +1 -1
  13. package/dist/cjs/models/HunYuan/index.d.ts +4 -19
  14. package/dist/cjs/models/HunYuan/index.js +47 -107
  15. package/dist/cjs/models/HunYuan/type.d.ts +68 -48
  16. package/dist/cjs/models/HunYuan/type.js +1 -1
  17. package/dist/cjs/models/HunYuan/util.d.ts +4 -0
  18. package/dist/cjs/models/HunYuan/util.js +58 -0
  19. package/dist/cjs/models/HunYuanBeta/index.d.ts +4 -19
  20. package/dist/cjs/models/HunYuanBeta/index.js +42 -110
  21. package/dist/cjs/models/Moonshot/index.d.ts +4 -18
  22. package/dist/cjs/models/Moonshot/index.js +45 -82
  23. package/dist/cjs/models/Moonshot/type.d.ts +63 -9
  24. package/dist/cjs/models/Moonshot/type.js +1 -1
  25. package/dist/cjs/models/Yi/index.d.ts +4 -18
  26. package/dist/cjs/models/Yi/index.js +48 -82
  27. package/dist/cjs/models/Yi/type.d.ts +41 -15
  28. package/dist/cjs/models/Yi/type.js +1 -1
  29. package/dist/cjs/models/ZhiPu/index.d.ts +4 -18
  30. package/dist/cjs/models/ZhiPu/index.js +59 -87
  31. package/dist/cjs/models/ZhiPu/type.d.ts +19 -19
  32. package/dist/cjs/models/ZhiPu/type.js +1 -1
  33. package/dist/cjs/models/index.d.ts +16 -15
  34. package/dist/cjs/models/index.js +26 -23
  35. package/dist/cjs/models/model.d.ts +38 -0
  36. package/dist/cjs/models/model.js +481 -0
  37. package/dist/cjs/type.d.ts +76 -15
  38. package/dist/cjs/type.js +6 -12
  39. package/dist/cjs/utils.d.ts +9 -1
  40. package/dist/cjs/utils.js +46 -2
  41. package/dist/esm/AI.d.ts +27 -0
  42. package/dist/esm/AI.js +128 -0
  43. package/dist/esm/index.d.ts +13 -38
  44. package/dist/esm/index.js +4 -70
  45. package/dist/esm/models/Ark/index.d.ts +4 -18
  46. package/dist/esm/models/Ark/index.js +45 -82
  47. package/dist/esm/models/Ark/type.d.ts +52 -19
  48. package/dist/esm/models/Ark/type.js +1 -1
  49. package/dist/esm/models/DashScope/index.d.ts +4 -18
  50. package/dist/esm/models/DashScope/index.js +45 -82
  51. package/dist/esm/models/DashScope/type.d.ts +55 -24
  52. package/dist/esm/models/DashScope/type.js +1 -1
  53. package/dist/esm/models/HunYuan/index.d.ts +4 -19
  54. package/dist/esm/models/HunYuan/index.js +47 -107
  55. package/dist/esm/models/HunYuan/type.d.ts +68 -48
  56. package/dist/esm/models/HunYuan/type.js +1 -1
  57. package/dist/esm/models/HunYuan/util.d.ts +4 -0
  58. package/dist/esm/models/HunYuan/util.js +53 -0
  59. package/dist/esm/models/HunYuanBeta/index.d.ts +4 -19
  60. package/dist/esm/models/HunYuanBeta/index.js +42 -110
  61. package/dist/esm/models/Moonshot/index.d.ts +4 -18
  62. package/dist/esm/models/Moonshot/index.js +45 -82
  63. package/dist/esm/models/Moonshot/type.d.ts +63 -9
  64. package/dist/esm/models/Moonshot/type.js +1 -1
  65. package/dist/esm/models/Yi/index.d.ts +4 -18
  66. package/dist/esm/models/Yi/index.js +48 -82
  67. package/dist/esm/models/Yi/type.d.ts +41 -15
  68. package/dist/esm/models/Yi/type.js +1 -1
  69. package/dist/esm/models/ZhiPu/index.d.ts +4 -18
  70. package/dist/esm/models/ZhiPu/index.js +59 -87
  71. package/dist/esm/models/ZhiPu/type.d.ts +19 -19
  72. package/dist/esm/models/ZhiPu/type.js +1 -1
  73. package/dist/esm/models/index.d.ts +16 -15
  74. package/dist/esm/models/index.js +17 -16
  75. package/dist/esm/models/model.d.ts +38 -0
  76. package/dist/esm/models/model.js +478 -0
  77. package/dist/esm/type.d.ts +76 -15
  78. package/dist/esm/type.js +5 -11
  79. package/dist/esm/utils.d.ts +9 -1
  80. package/dist/esm/utils.js +41 -1
  81. package/package.json +3 -3
  82. package/src/AI.ts +77 -0
  83. package/src/index.ts +3 -60
  84. package/src/models/Ark/index.ts +52 -54
  85. package/src/models/Ark/type.ts +60 -19
  86. package/src/models/DashScope/index.ts +56 -55
  87. package/src/models/DashScope/type.ts +63 -21
  88. package/src/models/HunYuan/index.ts +44 -67
  89. package/src/models/HunYuan/type.ts +68 -46
  90. package/src/models/HunYuan/util.ts +59 -0
  91. package/src/models/HunYuanBeta/index.ts +41 -75
  92. package/src/models/Moonshot/index.ts +52 -54
  93. package/src/models/Moonshot/type.ts +61 -7
  94. package/src/models/Yi/index.ts +59 -55
  95. package/src/models/Yi/type.ts +47 -19
  96. package/src/models/ZhiPu/index.ts +60 -52
  97. package/src/models/ZhiPu/type.ts +20 -9
  98. package/src/models/index.ts +25 -15
  99. package/src/models/model.ts +415 -0
  100. package/src/type.ts +100 -13
  101. package/src/utils.ts +53 -1
  102. package/dist/cjs/models/HunYuanBeta/type.d.ts +0 -52
  103. package/dist/cjs/models/HunYuanBeta/type.js +0 -3
  104. package/dist/esm/models/HunYuanBeta/type.d.ts +0 -52
  105. package/dist/esm/models/HunYuanBeta/type.js +0 -2
  106. package/src/models/HunYuanBeta/type.ts +0 -61
package/src/type.ts CHANGED
@@ -1,18 +1,16 @@
1
- import { type ParsedEvent } from './eventsource_parser'
1
+ export abstract class SimpleChatModel {
2
+ public abstract doGenerate(data: BaseChatModelInput): Promise<DoGenerateOutput>
2
3
 
3
- export abstract class ChatModel {
4
- public abstract generateText(data: BaseChatModelInput): Promise<{ text: string; rawResponse: any }>
5
-
6
- public abstract streamText(data: BaseChatModelInput): Promise<StreamTextResult>
4
+ public abstract doStream(data: BaseChatModelInput): Promise<DoStreamOutput>
7
5
  }
8
6
 
9
- export type ChatModelConstructor = typeof ChatModel
7
+ type RawResponse = { rawResponse?: any }
10
8
 
11
- export abstract class StreamTextResult {
12
- public abstract eventSourceStream: AsyncIterableReadableStream<ParsedEvent>
13
- public abstract dataStream: AsyncIterableReadableStream<any>
14
- public abstract textStream: AsyncIterableReadableStream<string>
15
- }
9
+ export type DoGenerateOutput = BaseDoGenerateOutput & RawResponse
10
+
11
+ export type DoStreamOutput = AsyncIterableReadableStream<BaseDoStreamOutputChunk & RawResponse>
12
+
13
+ export type ChatModelConstructor = typeof SimpleChatModel
16
14
 
17
15
  export type AsyncIterableReadableStream<T> = ReadableStream<T> & {
18
16
  [Symbol.asyncIterator]: () => { next(): Promise<IteratorResult<T>> }
@@ -41,14 +39,103 @@ export type BotReq = <T extends IBotReqInput>(
41
39
  props: T,
42
40
  ) => T['stream'] extends true ? Promise<ReadableStream<Uint8Array>> : Promise<Object>
43
41
 
44
- type ChatModelMessage = {
45
- role: 'user' | 'system' | 'assistant'
42
+ export type UserMessage = {
43
+ role: 'user'
44
+ content: string
45
+ }
46
+
47
+ export type SystemMessage = {
48
+ role: 'system'
49
+ content: string
50
+ }
51
+
52
+ export type AssistantMessage = PlainAssistantMessage | ToolCallAssistantMessage
53
+
54
+ export type PlainAssistantMessage = {
55
+ role: 'assistant'
56
+ content: string
57
+ }
58
+
59
+ export type ToolCallAssistantMessage = {
60
+ role: 'assistant'
61
+ tool_calls: Array<ToolCall>
62
+ content?: string
63
+ }
64
+
65
+ export type ToolMessage = {
66
+ role: 'tool'
67
+ tool_call_id: string
46
68
  content: string
47
69
  }
48
70
 
71
+ export type ChatModelMessage = UserMessage | SystemMessage | AssistantMessage | ToolMessage
72
+
73
+ export type FunctionTool = {
74
+ name: string
75
+ description: string
76
+ fn: CallableFunction
77
+ parameters: object
78
+ }
79
+
80
+ // #region 大模型标准输入类型
49
81
  export interface BaseChatModelInput {
50
82
  model: string
51
83
  messages: Array<ChatModelMessage>
52
84
  temperature?: number
53
85
  top_p?: number
86
+ tools?: Array<ModelTool>
87
+ tool_choice?: 'none' | 'auto' | 'custom'
88
+ }
89
+
90
+ /**
91
+ * 给 LLM 发请求时要传的工具
92
+ */
93
+ export type ModelTool = {
94
+ type: string
95
+ function?: ModelToolFunction
96
+ }
97
+
98
+ /**
99
+ * 给 LLM 发请求时要传的工具函数
100
+ */
101
+ export type ModelToolFunction = {
102
+ name: string
103
+ description: string
104
+ /**
105
+ * 描述函数参数的 JSON Schema 字符串
106
+ */
107
+ parameters: string
108
+ }
109
+ // #endregion
110
+
111
+ // #region 大模型标准响应类型
112
+ export type ToolCall = {
113
+ id: string
114
+ type: string
115
+ function: { name: string; arguments: string }
116
+ }
117
+
118
+ type FinishReason = 'tool_calls' | (string & {})
119
+
120
+ export type Usage = {
121
+ completion_tokens: number
122
+ prompt_tokens: number
123
+ total_tokens: number
124
+ }
125
+
126
+ export interface BaseDoGenerateOutput {
127
+ choices?: Array<{
128
+ finish_reason?: FinishReason
129
+ message?: ChatModelMessage
130
+ }>
131
+ usage?: Usage
132
+ }
133
+
134
+ export interface BaseDoStreamOutputChunk {
135
+ choices?: Array<{
136
+ finish_reason?: FinishReason
137
+ delta?: ChatModelMessage
138
+ }>
139
+ usage?: Usage
54
140
  }
141
+ // #endregion
package/src/utils.ts CHANGED
@@ -1,7 +1,13 @@
1
1
  import { TransformStream as _TransformStream, ReadableStream as _ReadableStream } from 'web-streams-polyfill'
2
2
  import { createReadableStreamWrapper } from '@mattiasbuelens/web-streams-adapter'
3
3
  import { createParser, type EventSourceParser, type ParsedEvent } from './eventsource_parser'
4
- import type { AsyncIterableReadableStream } from './type'
4
+ import type {
5
+ AsyncIterableReadableStream,
6
+ ChatModelMessage,
7
+ ToolCallAssistantMessage,
8
+ ModelTool,
9
+ FunctionTool,
10
+ } from './type'
5
11
  import { TextDecoder } from 'text-encoding-shim'
6
12
 
7
13
  export const ReadableStream = _ReadableStream as {
@@ -109,3 +115,49 @@ export function createAsyncIterable<T>(stream: ReadableStream<T>) {
109
115
  }
110
116
  return _stream
111
117
  }
118
+
119
+ /**
120
+ * 将 SSE 二进制流转换为 T 类型的流
121
+ */
122
+ export function intoStandardStream<T>(stream: ReadableStream<Uint8Array>): ReadableStream<T> {
123
+ return createAsyncIterable(stream
124
+ .pipeThrough(new TextDecoderStream())
125
+ .pipeThrough(createEventSourceParserTransformStream())
126
+ .pipeThrough(new TransformStream<ParsedEvent, T>({
127
+ transform(chunk, controller) {
128
+ try {
129
+ const data = JSON.parse(chunk.data) as T
130
+ controller.enqueue(data)
131
+ } catch (e) {
132
+ if (chunk.data !== '[DONE]') {
133
+ console.warn('Error when transforming event source data to json', e)
134
+ }
135
+ }
136
+ },
137
+ }),),)
138
+ }
139
+
140
+ export function createPromise<T = unknown>() {
141
+ let res: (value: T | PromiseLike<T>) => void
142
+ let rej: (reason?: any) => void
143
+ const promise = new Promise<T>((resolve, reject) => {
144
+ res = resolve
145
+ rej = reject
146
+ })
147
+ return { promise, res, rej }
148
+ }
149
+
150
+ export function isToolCallAssistantMessage(message: ChatModelMessage): message is ToolCallAssistantMessage {
151
+ return message.role === 'assistant' && 'tool_calls' in message && message.tool_calls[0] != null
152
+ }
153
+
154
+ export function functionToolToModelTool(tool: FunctionTool): ModelTool {
155
+ return {
156
+ type: 'function',
157
+ function: {
158
+ description: tool.description,
159
+ name: tool.name,
160
+ parameters: JSON.stringify(tool.parameters),
161
+ },
162
+ }
163
+ }
@@ -1,52 +0,0 @@
1
- type HunYuanMessage = {
2
- Role: 'user' | 'system' | 'assistant' | 'tool';
3
- Content?: string;
4
- Contents?: Array<{
5
- Type: 'text' | 'image_url';
6
- Text?: string;
7
- ImageUrl?: string;
8
- }>;
9
- ToolCallId?: string;
10
- ToolCalls?: Array<{
11
- Id: string;
12
- Type: 'function';
13
- Function: {
14
- Name: string;
15
- Arguments: string;
16
- };
17
- }>;
18
- };
19
- type HunYuanTool = {
20
- Type: 'function';
21
- Function: {
22
- Name: string;
23
- Arguments: string;
24
- };
25
- };
26
- export type HunYuanInputData = {
27
- Model: 'hunyuan-lite' | 'hunyuan-standard' | 'hunyuan-standard-256K' | 'hunyuan-pro' | 'hunyuan-code' | 'hunyuan-role' | 'hunyuan-functioncall' | 'hunyuan-vision';
28
- Messages: Array<HunYuanMessage>;
29
- StreamModeration?: boolean;
30
- TopP?: number;
31
- Temperature?: number;
32
- EnableEnhancement?: boolean;
33
- Tools?: Array<HunYuanTool>;
34
- ToolChoice?: 'none' | 'auto' | 'custom';
35
- CustomTool?: HunYuanTool;
36
- SearchInfo?: boolean;
37
- };
38
- export type HunYaunGenerateTextOutput = {
39
- choices?: Array<{
40
- message?: {
41
- content?: string;
42
- };
43
- }>;
44
- };
45
- export type HunYaunStreamTextOutput = {
46
- choices?: Array<{
47
- delta?: {
48
- content?: string;
49
- };
50
- }>;
51
- };
52
- export {};
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tb2RlbHMvSHVuWXVhbkJldGEvdHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsidHlwZSBIdW5ZdWFuTWVzc2FnZSA9IHtcbiAgUm9sZTogJ3VzZXInIHwgJ3N5c3RlbScgfCAnYXNzaXN0YW50JyB8ICd0b29sJ1xuICBDb250ZW50Pzogc3RyaW5nXG4gIENvbnRlbnRzPzogQXJyYXk8e1xuICAgIFR5cGU6ICd0ZXh0JyB8ICdpbWFnZV91cmwnXG4gICAgVGV4dD86IHN0cmluZ1xuICAgIEltYWdlVXJsPzogc3RyaW5nXG4gIH0+XG4gIFRvb2xDYWxsSWQ/OiBzdHJpbmdcbiAgVG9vbENhbGxzPzogQXJyYXk8e1xuICAgIElkOiBzdHJpbmdcbiAgICBUeXBlOiAnZnVuY3Rpb24nXG4gICAgRnVuY3Rpb246IHtcbiAgICAgIE5hbWU6IHN0cmluZ1xuICAgICAgQXJndW1lbnRzOiBzdHJpbmdcbiAgICB9XG4gIH0+XG59XG5cbnR5cGUgSHVuWXVhblRvb2wgPSB7XG4gIFR5cGU6ICdmdW5jdGlvbidcbiAgRnVuY3Rpb246IHtcbiAgICBOYW1lOiBzdHJpbmdcbiAgICBBcmd1bWVudHM6IHN0cmluZ1xuICB9XG59XG5cbmV4cG9ydCB0eXBlIEh1bll1YW5JbnB1dERhdGEgPSB7XG4gIE1vZGVsOlxuICB8ICdodW55dWFuLWxpdGUnXG4gIHwgJ2h1bnl1YW4tc3RhbmRhcmQnXG4gIHwgJ2h1bnl1YW4tc3RhbmRhcmQtMjU2SydcbiAgfCAnaHVueXVhbi1wcm8nXG4gIHwgJ2h1bnl1YW4tY29kZSdcbiAgfCAnaHVueXVhbi1yb2xlJ1xuICB8ICdodW55dWFuLWZ1bmN0aW9uY2FsbCdcbiAgfCAnaHVueXVhbi12aXNpb24nXG4gIE1lc3NhZ2VzOiBBcnJheTxIdW5ZdWFuTWVzc2FnZT5cbiAgU3RyZWFtTW9kZXJhdGlvbj86IGJvb2xlYW5cbiAgVG9wUD86IG51bWJlclxuICBUZW1wZXJhdHVyZT86IG51bWJlclxuICBFbmFibGVFbmhhbmNlbWVudD86IGJvb2xlYW5cbiAgVG9vbHM/OiBBcnJheTxIdW5ZdWFuVG9vbD5cbiAgVG9vbENob2ljZT86ICdub25lJyB8ICdhdXRvJyB8ICdjdXN0b20nXG4gIEN1c3RvbVRvb2w/OiBIdW5ZdWFuVG9vbFxuICBTZWFyY2hJbmZvPzogYm9vbGVhblxufVxuXG4vLyB0b2RvOiBtb3JlIHByZWNpc2VcbmV4cG9ydCB0eXBlIEh1bllhdW5HZW5lcmF0ZVRleHRPdXRwdXQgPSB7XG4gIGNob2ljZXM/OiBBcnJheTx7XG4gICAgbWVzc2FnZT86IHsgY29udGVudD86IHN0cmluZyB9XG4gIH0+XG59XG5cbi8vIHRvZG86IG1vcmUgcHJlY2lzZVxuZXhwb3J0IHR5cGUgSHVuWWF1blN0cmVhbVRleHRPdXRwdXQgPSB7XG4gIGNob2ljZXM/OiBBcnJheTx7XG4gICAgZGVsdGE/OiB7IGNvbnRlbnQ/OiBzdHJpbmcgfVxuICB9PlxufVxuIl19
@@ -1,52 +0,0 @@
1
- type HunYuanMessage = {
2
- Role: 'user' | 'system' | 'assistant' | 'tool';
3
- Content?: string;
4
- Contents?: Array<{
5
- Type: 'text' | 'image_url';
6
- Text?: string;
7
- ImageUrl?: string;
8
- }>;
9
- ToolCallId?: string;
10
- ToolCalls?: Array<{
11
- Id: string;
12
- Type: 'function';
13
- Function: {
14
- Name: string;
15
- Arguments: string;
16
- };
17
- }>;
18
- };
19
- type HunYuanTool = {
20
- Type: 'function';
21
- Function: {
22
- Name: string;
23
- Arguments: string;
24
- };
25
- };
26
- export type HunYuanInputData = {
27
- Model: 'hunyuan-lite' | 'hunyuan-standard' | 'hunyuan-standard-256K' | 'hunyuan-pro' | 'hunyuan-code' | 'hunyuan-role' | 'hunyuan-functioncall' | 'hunyuan-vision';
28
- Messages: Array<HunYuanMessage>;
29
- StreamModeration?: boolean;
30
- TopP?: number;
31
- Temperature?: number;
32
- EnableEnhancement?: boolean;
33
- Tools?: Array<HunYuanTool>;
34
- ToolChoice?: 'none' | 'auto' | 'custom';
35
- CustomTool?: HunYuanTool;
36
- SearchInfo?: boolean;
37
- };
38
- export type HunYaunGenerateTextOutput = {
39
- choices?: Array<{
40
- message?: {
41
- content?: string;
42
- };
43
- }>;
44
- };
45
- export type HunYaunStreamTextOutput = {
46
- choices?: Array<{
47
- delta?: {
48
- content?: string;
49
- };
50
- }>;
51
- };
52
- export {};
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tb2RlbHMvSHVuWXVhbkJldGEvdHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsidHlwZSBIdW5ZdWFuTWVzc2FnZSA9IHtcbiAgUm9sZTogJ3VzZXInIHwgJ3N5c3RlbScgfCAnYXNzaXN0YW50JyB8ICd0b29sJ1xuICBDb250ZW50Pzogc3RyaW5nXG4gIENvbnRlbnRzPzogQXJyYXk8e1xuICAgIFR5cGU6ICd0ZXh0JyB8ICdpbWFnZV91cmwnXG4gICAgVGV4dD86IHN0cmluZ1xuICAgIEltYWdlVXJsPzogc3RyaW5nXG4gIH0+XG4gIFRvb2xDYWxsSWQ/OiBzdHJpbmdcbiAgVG9vbENhbGxzPzogQXJyYXk8e1xuICAgIElkOiBzdHJpbmdcbiAgICBUeXBlOiAnZnVuY3Rpb24nXG4gICAgRnVuY3Rpb246IHtcbiAgICAgIE5hbWU6IHN0cmluZ1xuICAgICAgQXJndW1lbnRzOiBzdHJpbmdcbiAgICB9XG4gIH0+XG59XG5cbnR5cGUgSHVuWXVhblRvb2wgPSB7XG4gIFR5cGU6ICdmdW5jdGlvbidcbiAgRnVuY3Rpb246IHtcbiAgICBOYW1lOiBzdHJpbmdcbiAgICBBcmd1bWVudHM6IHN0cmluZ1xuICB9XG59XG5cbmV4cG9ydCB0eXBlIEh1bll1YW5JbnB1dERhdGEgPSB7XG4gIE1vZGVsOlxuICB8ICdodW55dWFuLWxpdGUnXG4gIHwgJ2h1bnl1YW4tc3RhbmRhcmQnXG4gIHwgJ2h1bnl1YW4tc3RhbmRhcmQtMjU2SydcbiAgfCAnaHVueXVhbi1wcm8nXG4gIHwgJ2h1bnl1YW4tY29kZSdcbiAgfCAnaHVueXVhbi1yb2xlJ1xuICB8ICdodW55dWFuLWZ1bmN0aW9uY2FsbCdcbiAgfCAnaHVueXVhbi12aXNpb24nXG4gIE1lc3NhZ2VzOiBBcnJheTxIdW5ZdWFuTWVzc2FnZT5cbiAgU3RyZWFtTW9kZXJhdGlvbj86IGJvb2xlYW5cbiAgVG9wUD86IG51bWJlclxuICBUZW1wZXJhdHVyZT86IG51bWJlclxuICBFbmFibGVFbmhhbmNlbWVudD86IGJvb2xlYW5cbiAgVG9vbHM/OiBBcnJheTxIdW5ZdWFuVG9vbD5cbiAgVG9vbENob2ljZT86ICdub25lJyB8ICdhdXRvJyB8ICdjdXN0b20nXG4gIEN1c3RvbVRvb2w/OiBIdW5ZdWFuVG9vbFxuICBTZWFyY2hJbmZvPzogYm9vbGVhblxufVxuXG4vLyB0b2RvOiBtb3JlIHByZWNpc2VcbmV4cG9ydCB0eXBlIEh1bllhdW5HZW5lcmF0ZVRleHRPdXRwdXQgPSB7XG4gIGNob2ljZXM/OiBBcnJheTx7XG4gICAgbWVzc2FnZT86IHsgY29udGVudD86IHN0cmluZyB9XG4gIH0+XG59XG5cbi8vIHRvZG86IG1vcmUgcHJlY2lzZVxuZXhwb3J0IHR5cGUgSHVuWWF1blN0cmVhbVRleHRPdXRwdXQgPSB7XG4gIGNob2ljZXM/OiBBcnJheTx7XG4gICAgZGVsdGE/OiB7IGNvbnRlbnQ/OiBzdHJpbmcgfVxuICB9PlxufVxuIl19
@@ -1,61 +0,0 @@
1
- type HunYuanMessage = {
2
- Role: 'user' | 'system' | 'assistant' | 'tool'
3
- Content?: string
4
- Contents?: Array<{
5
- Type: 'text' | 'image_url'
6
- Text?: string
7
- ImageUrl?: string
8
- }>
9
- ToolCallId?: string
10
- ToolCalls?: Array<{
11
- Id: string
12
- Type: 'function'
13
- Function: {
14
- Name: string
15
- Arguments: string
16
- }
17
- }>
18
- }
19
-
20
- type HunYuanTool = {
21
- Type: 'function'
22
- Function: {
23
- Name: string
24
- Arguments: string
25
- }
26
- }
27
-
28
- export type HunYuanInputData = {
29
- Model:
30
- | 'hunyuan-lite'
31
- | 'hunyuan-standard'
32
- | 'hunyuan-standard-256K'
33
- | 'hunyuan-pro'
34
- | 'hunyuan-code'
35
- | 'hunyuan-role'
36
- | 'hunyuan-functioncall'
37
- | 'hunyuan-vision'
38
- Messages: Array<HunYuanMessage>
39
- StreamModeration?: boolean
40
- TopP?: number
41
- Temperature?: number
42
- EnableEnhancement?: boolean
43
- Tools?: Array<HunYuanTool>
44
- ToolChoice?: 'none' | 'auto' | 'custom'
45
- CustomTool?: HunYuanTool
46
- SearchInfo?: boolean
47
- }
48
-
49
- // todo: more precise
50
- export type HunYaunGenerateTextOutput = {
51
- choices?: Array<{
52
- message?: { content?: string }
53
- }>
54
- }
55
-
56
- // todo: more precise
57
- export type HunYaunStreamTextOutput = {
58
- choices?: Array<{
59
- delta?: { content?: string }
60
- }>
61
- }