@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.
- package/dist/cjs/AI.d.ts +27 -0
- package/dist/cjs/AI.js +154 -0
- package/dist/cjs/index.d.ts +13 -38
- package/dist/cjs/index.js +9 -73
- package/dist/cjs/models/Ark/index.d.ts +4 -18
- package/dist/cjs/models/Ark/index.js +45 -82
- package/dist/cjs/models/Ark/type.d.ts +52 -19
- package/dist/cjs/models/Ark/type.js +1 -1
- package/dist/cjs/models/DashScope/index.d.ts +4 -18
- package/dist/cjs/models/DashScope/index.js +45 -82
- package/dist/cjs/models/DashScope/type.d.ts +55 -24
- package/dist/cjs/models/DashScope/type.js +1 -1
- package/dist/cjs/models/HunYuan/index.d.ts +4 -19
- package/dist/cjs/models/HunYuan/index.js +47 -107
- package/dist/cjs/models/HunYuan/type.d.ts +68 -48
- package/dist/cjs/models/HunYuan/type.js +1 -1
- package/dist/cjs/models/HunYuan/util.d.ts +4 -0
- package/dist/cjs/models/HunYuan/util.js +58 -0
- package/dist/cjs/models/HunYuanBeta/index.d.ts +4 -19
- package/dist/cjs/models/HunYuanBeta/index.js +42 -110
- package/dist/cjs/models/Moonshot/index.d.ts +4 -18
- package/dist/cjs/models/Moonshot/index.js +45 -82
- package/dist/cjs/models/Moonshot/type.d.ts +63 -9
- package/dist/cjs/models/Moonshot/type.js +1 -1
- package/dist/cjs/models/Yi/index.d.ts +4 -18
- package/dist/cjs/models/Yi/index.js +48 -82
- package/dist/cjs/models/Yi/type.d.ts +41 -15
- package/dist/cjs/models/Yi/type.js +1 -1
- package/dist/cjs/models/ZhiPu/index.d.ts +4 -18
- package/dist/cjs/models/ZhiPu/index.js +59 -87
- package/dist/cjs/models/ZhiPu/type.d.ts +19 -19
- package/dist/cjs/models/ZhiPu/type.js +1 -1
- package/dist/cjs/models/index.d.ts +16 -15
- package/dist/cjs/models/index.js +26 -23
- package/dist/cjs/models/model.d.ts +38 -0
- package/dist/cjs/models/model.js +481 -0
- package/dist/cjs/type.d.ts +76 -15
- package/dist/cjs/type.js +6 -12
- package/dist/cjs/utils.d.ts +9 -1
- package/dist/cjs/utils.js +46 -2
- package/dist/esm/AI.d.ts +27 -0
- package/dist/esm/AI.js +128 -0
- package/dist/esm/index.d.ts +13 -38
- package/dist/esm/index.js +4 -70
- package/dist/esm/models/Ark/index.d.ts +4 -18
- package/dist/esm/models/Ark/index.js +45 -82
- package/dist/esm/models/Ark/type.d.ts +52 -19
- package/dist/esm/models/Ark/type.js +1 -1
- package/dist/esm/models/DashScope/index.d.ts +4 -18
- package/dist/esm/models/DashScope/index.js +45 -82
- package/dist/esm/models/DashScope/type.d.ts +55 -24
- package/dist/esm/models/DashScope/type.js +1 -1
- package/dist/esm/models/HunYuan/index.d.ts +4 -19
- package/dist/esm/models/HunYuan/index.js +47 -107
- package/dist/esm/models/HunYuan/type.d.ts +68 -48
- package/dist/esm/models/HunYuan/type.js +1 -1
- package/dist/esm/models/HunYuan/util.d.ts +4 -0
- package/dist/esm/models/HunYuan/util.js +53 -0
- package/dist/esm/models/HunYuanBeta/index.d.ts +4 -19
- package/dist/esm/models/HunYuanBeta/index.js +42 -110
- package/dist/esm/models/Moonshot/index.d.ts +4 -18
- package/dist/esm/models/Moonshot/index.js +45 -82
- package/dist/esm/models/Moonshot/type.d.ts +63 -9
- package/dist/esm/models/Moonshot/type.js +1 -1
- package/dist/esm/models/Yi/index.d.ts +4 -18
- package/dist/esm/models/Yi/index.js +48 -82
- package/dist/esm/models/Yi/type.d.ts +41 -15
- package/dist/esm/models/Yi/type.js +1 -1
- package/dist/esm/models/ZhiPu/index.d.ts +4 -18
- package/dist/esm/models/ZhiPu/index.js +59 -87
- package/dist/esm/models/ZhiPu/type.d.ts +19 -19
- package/dist/esm/models/ZhiPu/type.js +1 -1
- package/dist/esm/models/index.d.ts +16 -15
- package/dist/esm/models/index.js +17 -16
- package/dist/esm/models/model.d.ts +38 -0
- package/dist/esm/models/model.js +478 -0
- package/dist/esm/type.d.ts +76 -15
- package/dist/esm/type.js +5 -11
- package/dist/esm/utils.d.ts +9 -1
- package/dist/esm/utils.js +41 -1
- package/package.json +3 -3
- package/src/AI.ts +77 -0
- package/src/index.ts +3 -60
- package/src/models/Ark/index.ts +52 -54
- package/src/models/Ark/type.ts +60 -19
- package/src/models/DashScope/index.ts +56 -55
- package/src/models/DashScope/type.ts +63 -21
- package/src/models/HunYuan/index.ts +44 -67
- package/src/models/HunYuan/type.ts +68 -46
- package/src/models/HunYuan/util.ts +59 -0
- package/src/models/HunYuanBeta/index.ts +41 -75
- package/src/models/Moonshot/index.ts +52 -54
- package/src/models/Moonshot/type.ts +61 -7
- package/src/models/Yi/index.ts +59 -55
- package/src/models/Yi/type.ts +47 -19
- package/src/models/ZhiPu/index.ts +60 -52
- package/src/models/ZhiPu/type.ts +20 -9
- package/src/models/index.ts +25 -15
- package/src/models/model.ts +415 -0
- package/src/type.ts +100 -13
- package/src/utils.ts +53 -1
- package/dist/cjs/models/HunYuanBeta/type.d.ts +0 -52
- package/dist/cjs/models/HunYuanBeta/type.js +0 -3
- package/dist/esm/models/HunYuanBeta/type.d.ts +0 -52
- package/dist/esm/models/HunYuanBeta/type.js +0 -2
- package/src/models/HunYuanBeta/type.ts +0 -61
package/src/type.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
export abstract class SimpleChatModel {
|
|
2
|
+
public abstract doGenerate(data: BaseChatModelInput): Promise<DoGenerateOutput>
|
|
2
3
|
|
|
3
|
-
|
|
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
|
-
|
|
7
|
+
type RawResponse = { rawResponse?: any }
|
|
10
8
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
45
|
-
role: 'user'
|
|
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 {
|
|
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tb2RlbHMvSHVuWXVhbkJldGEvdHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsidHlwZSBIdW5ZdWFuTWVzc2FnZSA9IHtcbiAgUm9sZTogJ3VzZX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TxIdW5ZdWFuVG9vbD5cbiAgVG9vbENob2ljZT86ICdub25lJyB8ICdhdXRvJyB8ICdjdXN0b20nXG4gIEN1c3RvbVRvb2w/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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9tb2RlbHMvSHVuWXVhbkJldGEvdHlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsidHlwZSBIdW5ZdWFuTWVzc2FnZSA9IHtcbiAgUm9sZTogJ3VzZXInIHwgJ3N5c3RlbScgfCAnYXNzaXN0YW50JyB8ICd0b29sJ1xuICBDb250ZW50Pzogc3RyaW5nXG4gIENvbnRlbnRzPzogQXJyYXk8e1xuICAgIFR5cGU6ICd0ZXh0JyB8ICdpbWFnZV91cmwnXG4gICAgVGV4dD86IHN0cmluZ1xuICAgIEltYW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VcbmV4cG9ydCB0eXBlIEh1bllhdW5HZW5lcmF0ZVRleHRPdXRwdXQgPSB7XG4gIGNob2ljZXM/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
|
-
}
|