@fugood/bricks-ctor 2.25.0-beta.6 → 2.25.0-beta.61
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/package.json +4 -24
- package/tools/deploy.ts +19 -165
- package/tools/mcp-server.ts +17 -26
- package/tools/postinstall.ts +21 -235
- package/tools/pull.ts +18 -121
- package/tools/push-config.ts +19 -0
- package/tools/simulator.ts +21 -0
- package/compile/action-name-map.ts +0 -1015
- package/compile/index.ts +0 -1278
- package/compile/util.ts +0 -358
- package/index.ts +0 -6
- package/skills/bricks-ctor/SKILL.md +0 -32
- package/skills/bricks-ctor/rules/animation.md +0 -159
- package/skills/bricks-ctor/rules/architecture-patterns.md +0 -69
- package/skills/bricks-ctor/rules/automations.md +0 -221
- package/skills/bricks-ctor/rules/buttress.md +0 -156
- package/skills/bricks-ctor/rules/data-calculation.md +0 -209
- package/skills/bricks-ctor/rules/local-sync.md +0 -129
- package/skills/bricks-ctor/rules/media-flow.md +0 -158
- package/skills/bricks-ctor/rules/remote-data-bank.md +0 -196
- package/skills/bricks-ctor/rules/standby-transition.md +0 -124
- package/skills/bricks-design/LICENSE.txt +0 -180
- package/skills/bricks-design/SKILL.md +0 -66
- package/skills/rive-marketplace/SKILL.md +0 -99
- package/tools/_git-author.ts +0 -29
- package/tools/_shell.ts +0 -173
- package/tools/icons/.gitattributes +0 -1
- package/tools/icons/fa6pro-glyphmap.json +0 -4686
- package/tools/icons/fa6pro-meta.json +0 -1
- package/tools/mcp-tools/compile.ts +0 -92
- package/tools/mcp-tools/huggingface.ts +0 -762
- package/tools/mcp-tools/icons.ts +0 -81
- package/tools/mcp-tools/lottie.ts +0 -102
- package/tools/mcp-tools/media.ts +0 -110
- package/tools/preview-main.mjs +0 -293
- package/tools/preview.ts +0 -150
- package/types/animation.ts +0 -100
- package/types/automation.ts +0 -235
- package/types/brick-base.ts +0 -80
- package/types/bricks/Camera.ts +0 -246
- package/types/bricks/Chart.ts +0 -372
- package/types/bricks/GenerativeMedia.ts +0 -290
- package/types/bricks/Icon.ts +0 -98
- package/types/bricks/Image.ts +0 -114
- package/types/bricks/Items.ts +0 -476
- package/types/bricks/Lottie.ts +0 -168
- package/types/bricks/Maps.ts +0 -262
- package/types/bricks/QrCode.ts +0 -117
- package/types/bricks/Rect.ts +0 -150
- package/types/bricks/RichText.ts +0 -128
- package/types/bricks/Rive.ts +0 -220
- package/types/bricks/Sketch.ts +0 -254
- package/types/bricks/Slideshow.ts +0 -201
- package/types/bricks/Svg.ts +0 -99
- package/types/bricks/Text.ts +0 -148
- package/types/bricks/TextInput.ts +0 -242
- package/types/bricks/Video.ts +0 -175
- package/types/bricks/VideoStreaming.ts +0 -112
- package/types/bricks/WebRtcStream.ts +0 -65
- package/types/bricks/WebView.ts +0 -168
- package/types/bricks/index.ts +0 -22
- package/types/canvas.ts +0 -82
- package/types/common.ts +0 -144
- package/types/data-calc-command.ts +0 -7005
- package/types/data-calc-script.ts +0 -21
- package/types/data-calc.ts +0 -11
- package/types/data.ts +0 -95
- package/types/generators/AlarmClock.ts +0 -110
- package/types/generators/Assistant.ts +0 -621
- package/types/generators/BleCentral.ts +0 -247
- package/types/generators/BlePeripheral.ts +0 -208
- package/types/generators/CanvasMap.ts +0 -74
- package/types/generators/CastlesPay.ts +0 -87
- package/types/generators/DataBank.ts +0 -160
- package/types/generators/File.ts +0 -432
- package/types/generators/GraphQl.ts +0 -132
- package/types/generators/Http.ts +0 -222
- package/types/generators/HttpServer.ts +0 -176
- package/types/generators/Information.ts +0 -103
- package/types/generators/Intent.ts +0 -168
- package/types/generators/Iterator.ts +0 -108
- package/types/generators/Keyboard.ts +0 -105
- package/types/generators/LlmAnthropicCompat.ts +0 -212
- package/types/generators/LlmAppleBuiltin.ts +0 -159
- package/types/generators/LlmGgml.ts +0 -861
- package/types/generators/LlmMediaTekNeuroPilot.ts +0 -235
- package/types/generators/LlmMlx.ts +0 -227
- package/types/generators/LlmOnnx.ts +0 -213
- package/types/generators/LlmOpenAiCompat.ts +0 -312
- package/types/generators/LlmQualcommAiEngine.ts +0 -247
- package/types/generators/Mcp.ts +0 -637
- package/types/generators/McpServer.ts +0 -289
- package/types/generators/MediaFlow.ts +0 -170
- package/types/generators/MqttBroker.ts +0 -141
- package/types/generators/MqttClient.ts +0 -141
- package/types/generators/Question.ts +0 -408
- package/types/generators/RealtimeTranscription.ts +0 -287
- package/types/generators/RerankerGgml.ts +0 -191
- package/types/generators/SerialPort.ts +0 -151
- package/types/generators/SoundPlayer.ts +0 -94
- package/types/generators/SoundRecorder.ts +0 -130
- package/types/generators/SpeechToTextGgml.ts +0 -419
- package/types/generators/SpeechToTextOnnx.ts +0 -236
- package/types/generators/SpeechToTextPlatform.ts +0 -85
- package/types/generators/SqLite.ts +0 -159
- package/types/generators/Step.ts +0 -107
- package/types/generators/SttAppleBuiltin.ts +0 -130
- package/types/generators/Tcp.ts +0 -126
- package/types/generators/TcpServer.ts +0 -147
- package/types/generators/TextToSpeechAppleBuiltin.ts +0 -127
- package/types/generators/TextToSpeechGgml.ts +0 -221
- package/types/generators/TextToSpeechOnnx.ts +0 -178
- package/types/generators/TextToSpeechOpenAiLike.ts +0 -121
- package/types/generators/ThermalPrinter.ts +0 -191
- package/types/generators/Tick.ts +0 -83
- package/types/generators/Udp.ts +0 -120
- package/types/generators/VadGgml.ts +0 -250
- package/types/generators/VadOnnx.ts +0 -231
- package/types/generators/VadTraditional.ts +0 -138
- package/types/generators/VectorStore.ts +0 -257
- package/types/generators/Watchdog.ts +0 -107
- package/types/generators/WebCrawler.ts +0 -103
- package/types/generators/WebRtc.ts +0 -181
- package/types/generators/WebSocket.ts +0 -148
- package/types/generators/index.ts +0 -57
- package/types/index.ts +0 -13
- package/types/subspace.ts +0 -60
- package/types/switch.ts +0 -51
- package/types/system.ts +0 -707
- package/utils/calc.ts +0 -126
- package/utils/data.ts +0 -497
- package/utils/event-props.ts +0 -886
- package/utils/id.ts +0 -80
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
/* Auto generated by build script
|
|
2
|
-
*
|
|
3
|
-
* LLM inference using OpenAI-compatible API endpoints
|
|
4
|
-
*
|
|
5
|
-
* ## Features
|
|
6
|
-
* - Compatible with OpenAI API format
|
|
7
|
-
* - Supports function calling
|
|
8
|
-
* - Streaming responses
|
|
9
|
-
* - OpenResponses and OpenAI Responses API support
|
|
10
|
-
* - Custom API endpoints, like
|
|
11
|
-
* - OpenAI API: https://platform.openai.com/docs/guides/text?api-mode=chat
|
|
12
|
-
* - OpenAI Responses API: https://platform.openai.com/docs/api-reference/responses/create
|
|
13
|
-
* - OpenResponses API: https://www.openresponses.org/reference
|
|
14
|
-
* - Anthropic API: https://docs.anthropic.com/en/api/openai-sdk
|
|
15
|
-
* - Gemini API: https://ai.google.dev/gemini-api/docs/openai
|
|
16
|
-
* - llama.cpp server: https://github.com/ggml-org/llama.cpp/tree/master/tools/server
|
|
17
|
-
*/
|
|
18
|
-
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
19
|
-
import type { Data, DataLink } from '../data'
|
|
20
|
-
import type {
|
|
21
|
-
Brick,
|
|
22
|
-
Generator,
|
|
23
|
-
EventAction,
|
|
24
|
-
ActionWithDataParams,
|
|
25
|
-
ActionWithParams,
|
|
26
|
-
Action,
|
|
27
|
-
EventProperty,
|
|
28
|
-
} from '../common'
|
|
29
|
-
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
30
|
-
|
|
31
|
-
/* Run text completion */
|
|
32
|
-
export type GeneratorOpenAILLMActionCompletion = ActionWithParams & {
|
|
33
|
-
__actionName: 'GENERATOR_OPENAI_LLM_COMPLETION'
|
|
34
|
-
params?: Array<
|
|
35
|
-
| {
|
|
36
|
-
input: 'apiMode'
|
|
37
|
-
value?: string | DataLink | EventProperty
|
|
38
|
-
mapping?: string
|
|
39
|
-
}
|
|
40
|
-
| {
|
|
41
|
-
input: 'previousResponseId'
|
|
42
|
-
value?: string | DataLink | EventProperty
|
|
43
|
-
mapping?: string
|
|
44
|
-
}
|
|
45
|
-
| {
|
|
46
|
-
input: 'promptCacheKey'
|
|
47
|
-
value?: string | DataLink | EventProperty
|
|
48
|
-
mapping?: string
|
|
49
|
-
}
|
|
50
|
-
| {
|
|
51
|
-
input: 'responseOptions'
|
|
52
|
-
value?: {} | DataLink | EventProperty
|
|
53
|
-
mapping?: string
|
|
54
|
-
}
|
|
55
|
-
| {
|
|
56
|
-
input: 'messages'
|
|
57
|
-
value?: Array<any> | DataLink | EventProperty
|
|
58
|
-
mapping?: string
|
|
59
|
-
}
|
|
60
|
-
| {
|
|
61
|
-
input: 'maxTokens'
|
|
62
|
-
value?: number | DataLink | EventProperty
|
|
63
|
-
mapping?: string
|
|
64
|
-
}
|
|
65
|
-
| {
|
|
66
|
-
input: 'temperature'
|
|
67
|
-
value?: number | DataLink | EventProperty
|
|
68
|
-
mapping?: string
|
|
69
|
-
}
|
|
70
|
-
| {
|
|
71
|
-
input: 'topP'
|
|
72
|
-
value?: number | DataLink | EventProperty
|
|
73
|
-
mapping?: string
|
|
74
|
-
}
|
|
75
|
-
| {
|
|
76
|
-
input: 'frequencyPenalty'
|
|
77
|
-
value?: number | DataLink | EventProperty
|
|
78
|
-
mapping?: string
|
|
79
|
-
}
|
|
80
|
-
| {
|
|
81
|
-
input: 'presencePenalty'
|
|
82
|
-
value?: number | DataLink | EventProperty
|
|
83
|
-
mapping?: string
|
|
84
|
-
}
|
|
85
|
-
| {
|
|
86
|
-
input: 'stop'
|
|
87
|
-
value?: Array<any> | DataLink | EventProperty
|
|
88
|
-
mapping?: string
|
|
89
|
-
}
|
|
90
|
-
| {
|
|
91
|
-
input: 'tools'
|
|
92
|
-
value?: {} | DataLink | EventProperty
|
|
93
|
-
mapping?: string
|
|
94
|
-
}
|
|
95
|
-
| {
|
|
96
|
-
input: 'toolChoice'
|
|
97
|
-
value?: string | DataLink | EventProperty
|
|
98
|
-
mapping?: string
|
|
99
|
-
}
|
|
100
|
-
| {
|
|
101
|
-
input: 'parallelToolCalls'
|
|
102
|
-
value?: boolean | DataLink | EventProperty
|
|
103
|
-
mapping?: string
|
|
104
|
-
}
|
|
105
|
-
| {
|
|
106
|
-
input: 'responseFormat'
|
|
107
|
-
value?: {} | DataLink | EventProperty
|
|
108
|
-
mapping?: string
|
|
109
|
-
}
|
|
110
|
-
>
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/* Stop text completion */
|
|
114
|
-
export type GeneratorOpenAILLMActionStopCompletion = Action & {
|
|
115
|
-
__actionName: 'GENERATOR_OPENAI_LLM_STOP_COMPLETION'
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
interface GeneratorOpenAILLMDef {
|
|
119
|
-
/*
|
|
120
|
-
Default property:
|
|
121
|
-
{
|
|
122
|
-
"apiEndpoint": "https://api.openai.com/v1",
|
|
123
|
-
"model": "gpt-4o",
|
|
124
|
-
"apiMode": "chat_completions",
|
|
125
|
-
"completionMessages": [
|
|
126
|
-
{
|
|
127
|
-
"role": "system",
|
|
128
|
-
"content": "You are a helpful assistant."
|
|
129
|
-
}
|
|
130
|
-
],
|
|
131
|
-
"completionMaxTokens": 1024,
|
|
132
|
-
"completionTemperature": 1,
|
|
133
|
-
"completionTopP": 1,
|
|
134
|
-
"completionStop": []
|
|
135
|
-
}
|
|
136
|
-
*/
|
|
137
|
-
property?: {
|
|
138
|
-
/* API endpoint URL */
|
|
139
|
-
apiEndpoint?: string | DataLink
|
|
140
|
-
/* API key */
|
|
141
|
-
apiKey?: string | DataLink
|
|
142
|
-
/* Model name (Default: gpt-4o-mini) */
|
|
143
|
-
model?: string | DataLink
|
|
144
|
-
/* API mode. Keep chat_completions for legacy OpenAI-compatible endpoints, or use responses for OpenResponses/OpenAI Responses endpoints. */
|
|
145
|
-
apiMode?: 'chat_completions' | 'responses' | DataLink
|
|
146
|
-
/* Previous response ID for continuing a Responses/OpenResponses conversation. */
|
|
147
|
-
previousResponseId?: string | DataLink
|
|
148
|
-
/* Prompt cache key for Responses/OpenResponses prompt cache optimization. */
|
|
149
|
-
promptCacheKey?: string | DataLink
|
|
150
|
-
/* Additional Responses/OpenResponses request options merged into the /responses payload, such as instructions, metadata, reasoning, truncation, service_tier, store, and text. */
|
|
151
|
-
responseOptions?: {} | DataLink
|
|
152
|
-
/* Chat messages */
|
|
153
|
-
completionMessages?:
|
|
154
|
-
| Array<
|
|
155
|
-
| DataLink
|
|
156
|
-
| {
|
|
157
|
-
role?: string | DataLink
|
|
158
|
-
content?:
|
|
159
|
-
| string
|
|
160
|
-
| DataLink
|
|
161
|
-
| DataLink
|
|
162
|
-
| {
|
|
163
|
-
type?: string | DataLink
|
|
164
|
-
text?: string | DataLink
|
|
165
|
-
image_url?: string | DataLink
|
|
166
|
-
}
|
|
167
|
-
| DataLink
|
|
168
|
-
}
|
|
169
|
-
>
|
|
170
|
-
| DataLink
|
|
171
|
-
/* Tools for chat mode following OpenAI function calling format
|
|
172
|
-
Format: Array of objects with {type, function: {name, description, parameters}} structure
|
|
173
|
-
See: https://platform.openai.com/docs/guides/function-calling */
|
|
174
|
-
completionTools?: Array<{} | DataLink> | DataLink
|
|
175
|
-
/* Enable parallel tool calls */
|
|
176
|
-
completionParallelToolCalls?: boolean | DataLink
|
|
177
|
-
/* Tool choice for chat mode */
|
|
178
|
-
completionToolChoice?: 'none' | 'auto' | 'required' | DataLink
|
|
179
|
-
/* Response format */
|
|
180
|
-
completionResponseFormat?:
|
|
181
|
-
| DataLink
|
|
182
|
-
| {
|
|
183
|
-
type?: 'text' | 'json_schema' | 'json_object' | DataLink
|
|
184
|
-
json_schema?:
|
|
185
|
-
| DataLink
|
|
186
|
-
| {
|
|
187
|
-
strict?: boolean | DataLink
|
|
188
|
-
schema?: {} | DataLink
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/* Maximum tokens to generate */
|
|
192
|
-
completionMaxTokens?: number | DataLink
|
|
193
|
-
/* Temperature */
|
|
194
|
-
completionTemperature?: number | DataLink
|
|
195
|
-
/* Top P sampling */
|
|
196
|
-
completionTopP?: number | DataLink
|
|
197
|
-
/* Frequency penalty. Only sent in chat_completions mode. */
|
|
198
|
-
completionFrequencyPenalty?: number | DataLink
|
|
199
|
-
/* Presence penalty. Only sent in chat_completions mode. */
|
|
200
|
-
completionPresencePenalty?: number | DataLink
|
|
201
|
-
/* Stop sequences. Only sent in chat_completions mode. */
|
|
202
|
-
completionStop?: Array<string | DataLink> | DataLink
|
|
203
|
-
}
|
|
204
|
-
events?: {
|
|
205
|
-
/* Error event */
|
|
206
|
-
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onError']>>
|
|
207
|
-
/* Completion event */
|
|
208
|
-
onCompletion?: Array<
|
|
209
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onCompletion']>
|
|
210
|
-
>
|
|
211
|
-
/* Completion finished event */
|
|
212
|
-
onCompletionFinished?: Array<
|
|
213
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onCompletionFinished']>
|
|
214
|
-
>
|
|
215
|
-
/* Completion function call event */
|
|
216
|
-
onCompletionFunctionCall?: Array<
|
|
217
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onCompletionFunctionCall']>
|
|
218
|
-
>
|
|
219
|
-
/* Response created event */
|
|
220
|
-
onResponseCreated?: Array<
|
|
221
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onResponseCreated']>
|
|
222
|
-
>
|
|
223
|
-
/* Output item added event */
|
|
224
|
-
onOutputItemAdded?: Array<
|
|
225
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onOutputItemAdded']>
|
|
226
|
-
>
|
|
227
|
-
/* Output text delta event */
|
|
228
|
-
onOutputTextDelta?: Array<
|
|
229
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onOutputTextDelta']>
|
|
230
|
-
>
|
|
231
|
-
/* Output item done event */
|
|
232
|
-
onOutputItemDone?: Array<
|
|
233
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onOutputItemDone']>
|
|
234
|
-
>
|
|
235
|
-
/* Response completed event */
|
|
236
|
-
onResponseCompleted?: Array<
|
|
237
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onResponseCompleted']>
|
|
238
|
-
>
|
|
239
|
-
/* Response failed event */
|
|
240
|
-
onResponseFailed?: Array<
|
|
241
|
-
EventAction<string & keyof TemplateEventPropsMap['OpenaiLlm']['onResponseFailed']>
|
|
242
|
-
>
|
|
243
|
-
}
|
|
244
|
-
outlets?: {
|
|
245
|
-
/* Evaluating outlet */
|
|
246
|
-
isEvaluating?: () => Data<boolean>
|
|
247
|
-
/* Completion result outlet */
|
|
248
|
-
completionResult?: () => Data<string>
|
|
249
|
-
/* Completion details outlet */
|
|
250
|
-
completionDetails?: () => Data<{
|
|
251
|
-
text?: string
|
|
252
|
-
content?: string
|
|
253
|
-
finish_reason?: string
|
|
254
|
-
usage?: { [key: string]: any }
|
|
255
|
-
tool_calls?: Array<{
|
|
256
|
-
id?: string
|
|
257
|
-
type?: string
|
|
258
|
-
function?: {
|
|
259
|
-
name?: string
|
|
260
|
-
arguments?: string
|
|
261
|
-
[key: string]: any
|
|
262
|
-
}
|
|
263
|
-
[key: string]: any
|
|
264
|
-
}>
|
|
265
|
-
[key: string]: any
|
|
266
|
-
}>
|
|
267
|
-
/* Response ID outlet */
|
|
268
|
-
responseId?: () => Data<string>
|
|
269
|
-
/* Output items outlet */
|
|
270
|
-
outputItems?: () => Data<Array<any>>
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/* LLM inference using OpenAI-compatible API endpoints
|
|
275
|
-
|
|
276
|
-
## Features
|
|
277
|
-
- Compatible with OpenAI API format
|
|
278
|
-
- Supports function calling
|
|
279
|
-
- Streaming responses
|
|
280
|
-
- OpenResponses and OpenAI Responses API support
|
|
281
|
-
- Custom API endpoints, like
|
|
282
|
-
- OpenAI API: https://platform.openai.com/docs/guides/text?api-mode=chat
|
|
283
|
-
- OpenAI Responses API: https://platform.openai.com/docs/api-reference/responses/create
|
|
284
|
-
- OpenResponses API: https://www.openresponses.org/reference
|
|
285
|
-
- Anthropic API: https://docs.anthropic.com/en/api/openai-sdk
|
|
286
|
-
- Gemini API: https://ai.google.dev/gemini-api/docs/openai
|
|
287
|
-
- llama.cpp server: https://github.com/ggml-org/llama.cpp/tree/master/tools/server */
|
|
288
|
-
export type GeneratorOpenAILLM = Generator &
|
|
289
|
-
GeneratorOpenAILLMDef & {
|
|
290
|
-
templateKey: 'GENERATOR_OPENAI_LLM'
|
|
291
|
-
switches?: Array<
|
|
292
|
-
SwitchDef &
|
|
293
|
-
GeneratorOpenAILLMDef & {
|
|
294
|
-
conds?: Array<{
|
|
295
|
-
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
296
|
-
cond:
|
|
297
|
-
| SwitchCondInnerStateCurrentCanvas
|
|
298
|
-
| SwitchCondData
|
|
299
|
-
| {
|
|
300
|
-
__typename: 'SwitchCondInnerStateOutlet'
|
|
301
|
-
outlet:
|
|
302
|
-
| 'isEvaluating'
|
|
303
|
-
| 'completionResult'
|
|
304
|
-
| 'completionDetails'
|
|
305
|
-
| 'responseId'
|
|
306
|
-
| 'outputItems'
|
|
307
|
-
value: any
|
|
308
|
-
}
|
|
309
|
-
}>
|
|
310
|
-
}
|
|
311
|
-
>
|
|
312
|
-
}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/* Auto generated by build script
|
|
2
|
-
*
|
|
3
|
-
* Local LLM inference using Qualcomm AI Engine
|
|
4
|
-
*/
|
|
5
|
-
import type { SwitchCondInnerStateCurrentCanvas, SwitchCondData, SwitchDef } from '../switch'
|
|
6
|
-
import type { Data, DataLink } from '../data'
|
|
7
|
-
import type {
|
|
8
|
-
Brick,
|
|
9
|
-
Generator,
|
|
10
|
-
EventAction,
|
|
11
|
-
ActionWithDataParams,
|
|
12
|
-
ActionWithParams,
|
|
13
|
-
Action,
|
|
14
|
-
EventProperty,
|
|
15
|
-
} from '../common'
|
|
16
|
-
import type { TemplateEventPropsMap } from '../../utils/event-props'
|
|
17
|
-
|
|
18
|
-
/* Load the model */
|
|
19
|
-
export type GeneratorQnnLlmActionLoadModel = Action & {
|
|
20
|
-
__actionName: 'GENERATOR_QNN_LLM_LOAD_MODEL'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/* Abort model download */
|
|
24
|
-
export type GeneratorQnnLlmActionAbortModelDownload = Action & {
|
|
25
|
-
__actionName: 'GENERATOR_QNN_LLM_ABORT_MODEL_DOWNLOAD'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* Pre-process the prompt, to prepare KV cache */
|
|
29
|
-
export type GeneratorQnnLlmActionProcess = ActionWithParams & {
|
|
30
|
-
__actionName: 'GENERATOR_QNN_LLM_PROCESS'
|
|
31
|
-
params?: Array<
|
|
32
|
-
| {
|
|
33
|
-
input: 'prompt'
|
|
34
|
-
value?: string | DataLink | EventProperty
|
|
35
|
-
mapping?: string
|
|
36
|
-
}
|
|
37
|
-
| {
|
|
38
|
-
input: 'messages'
|
|
39
|
-
value?: Array<any> | DataLink | EventProperty
|
|
40
|
-
mapping?: string
|
|
41
|
-
}
|
|
42
|
-
| {
|
|
43
|
-
input: 'tools'
|
|
44
|
-
value?: Array<any> | DataLink | EventProperty
|
|
45
|
-
mapping?: string
|
|
46
|
-
}
|
|
47
|
-
>
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* Generate text */
|
|
51
|
-
export type GeneratorQnnLlmActionGenerate = ActionWithParams & {
|
|
52
|
-
__actionName: 'GENERATOR_QNN_LLM_GENERATE'
|
|
53
|
-
params?: Array<
|
|
54
|
-
| {
|
|
55
|
-
input: 'prompt'
|
|
56
|
-
value?: string | DataLink | EventProperty
|
|
57
|
-
mapping?: string
|
|
58
|
-
}
|
|
59
|
-
| {
|
|
60
|
-
input: 'messages'
|
|
61
|
-
value?: Array<any> | DataLink | EventProperty
|
|
62
|
-
mapping?: string
|
|
63
|
-
}
|
|
64
|
-
| {
|
|
65
|
-
input: 'tools'
|
|
66
|
-
value?: Array<any> | DataLink | EventProperty
|
|
67
|
-
mapping?: string
|
|
68
|
-
}
|
|
69
|
-
>
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/* Abort generation */
|
|
73
|
-
export type GeneratorQnnLlmActionAbortGeneration = Action & {
|
|
74
|
-
__actionName: 'GENERATOR_QNN_LLM_ABORT_GENERATION'
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* Release context */
|
|
78
|
-
export type GeneratorQnnLlmActionReleaseContext = Action & {
|
|
79
|
-
__actionName: 'GENERATOR_QNN_LLM_RELEASE_CONTEXT'
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
interface GeneratorQnnLlmDef {
|
|
83
|
-
/*
|
|
84
|
-
Default property:
|
|
85
|
-
{
|
|
86
|
-
"modelType": "Llama 3.2 3B Chat",
|
|
87
|
-
"chatFormat": "Llama 3.x",
|
|
88
|
-
"toolsInUserMessage": true,
|
|
89
|
-
"toolCallParser": "llama3_json",
|
|
90
|
-
"toolChoice": "auto",
|
|
91
|
-
"parallelToolCalls": false,
|
|
92
|
-
"temperature": 0.8,
|
|
93
|
-
"seed": 42,
|
|
94
|
-
"topK": 40,
|
|
95
|
-
"topP": 0.95,
|
|
96
|
-
"greedy": false
|
|
97
|
-
}
|
|
98
|
-
*/
|
|
99
|
-
property?: {
|
|
100
|
-
/* Load model context when generator is initialized */
|
|
101
|
-
init?: boolean | DataLink
|
|
102
|
-
/* Model type */
|
|
103
|
-
modelType?:
|
|
104
|
-
| 'Llama 3 8B Chat'
|
|
105
|
-
| 'Llama 3.1 8B Chat'
|
|
106
|
-
| 'Llama 3.2 3B Chat'
|
|
107
|
-
| 'Mistral 7B Instruct v0.3'
|
|
108
|
-
| 'Qwen 2 7B Chat'
|
|
109
|
-
| 'Phi 3.5 Mini'
|
|
110
|
-
| 'Granite v3.1 8B Instruct'
|
|
111
|
-
| 'Custom'
|
|
112
|
-
| DataLink
|
|
113
|
-
/* SOC model */
|
|
114
|
-
socModel?: 'X Elite' | 'X Plus' | '8 Elite' | '8 Gen 3' | 'QCS8550' | DataLink
|
|
115
|
-
/* Custom model base URL
|
|
116
|
-
The model should be bundled, for details see https://github.com/mybigday/node-qnn-llm?tab=readme-ov-file#bundled-file */
|
|
117
|
-
customModelUrl?: string | DataLink
|
|
118
|
-
/* Custom model MD5 */
|
|
119
|
-
customModelMd5?: string | DataLink
|
|
120
|
-
/* Chat format */
|
|
121
|
-
chatFormat?:
|
|
122
|
-
| 'Llama 2'
|
|
123
|
-
| 'Llama 3'
|
|
124
|
-
| 'Llama 3.x'
|
|
125
|
-
| 'Mistral v0.3'
|
|
126
|
-
| 'Qwen 2'
|
|
127
|
-
| 'Custom'
|
|
128
|
-
| DataLink
|
|
129
|
-
/* Custom chat format template */
|
|
130
|
-
customChatFormat?: string | DataLink
|
|
131
|
-
/* Put tools in user message */
|
|
132
|
-
toolsInUserMessage?: boolean | DataLink
|
|
133
|
-
/* Prompt to generate */
|
|
134
|
-
prompt?: string | DataLink
|
|
135
|
-
/* Chat messages */
|
|
136
|
-
messages?:
|
|
137
|
-
| Array<
|
|
138
|
-
| DataLink
|
|
139
|
-
| {
|
|
140
|
-
role?: string | DataLink
|
|
141
|
-
content?: string | DataLink
|
|
142
|
-
}
|
|
143
|
-
>
|
|
144
|
-
| DataLink
|
|
145
|
-
/* Stop words */
|
|
146
|
-
stopWords?: Array<string | DataLink> | DataLink
|
|
147
|
-
/* Tool call parser */
|
|
148
|
-
toolCallParser?: 'llama3_json' | 'mistral' | 'hermes' | 'internlm' | 'phi4' | DataLink
|
|
149
|
-
/* Tools for chat mode using OpenAI-compatible function calling format
|
|
150
|
-
Format: Array of objects with {type, function: {name, description, parameters}} structure
|
|
151
|
-
See: https://platform.openai.com/docs/guides/function-calling */
|
|
152
|
-
tools?: Array<{} | DataLink> | DataLink
|
|
153
|
-
/* Tool choice for chat mode */
|
|
154
|
-
toolChoice?: 'none' | 'auto' | 'required' | DataLink
|
|
155
|
-
/* Enable parallel tool calls */
|
|
156
|
-
parallelToolCalls?: boolean | DataLink
|
|
157
|
-
/* Number of threads, -1 to use n-threads from model config */
|
|
158
|
-
nThreads?: number | DataLink
|
|
159
|
-
/* Temperature, -1 to use temperature from model config */
|
|
160
|
-
temperature?: number | DataLink
|
|
161
|
-
/* Seed, -1 to use seed from model config */
|
|
162
|
-
seed?: number | DataLink
|
|
163
|
-
/* Top K, -1 to use top-k from model config */
|
|
164
|
-
topK?: number | DataLink
|
|
165
|
-
/* Top P, -1 to use top-p from model config */
|
|
166
|
-
topP?: number | DataLink
|
|
167
|
-
/* Greedy, use greedy sampling */
|
|
168
|
-
greedy?: boolean | DataLink
|
|
169
|
-
}
|
|
170
|
-
events?: {
|
|
171
|
-
/* Event triggered when context state changes */
|
|
172
|
-
onContextStateChange?: Array<
|
|
173
|
-
EventAction<string & keyof TemplateEventPropsMap['QnnLlm']['onContextStateChange']>
|
|
174
|
-
>
|
|
175
|
-
/* Event triggered when generate is done */
|
|
176
|
-
onGenerate?: Array<EventAction<string & keyof TemplateEventPropsMap['QnnLlm']['onGenerate']>>
|
|
177
|
-
/* Event triggered on get function call request */
|
|
178
|
-
onFunctionCall?: Array<
|
|
179
|
-
EventAction<string & keyof TemplateEventPropsMap['QnnLlm']['onFunctionCall']>
|
|
180
|
-
>
|
|
181
|
-
/* Event triggered when error occurs */
|
|
182
|
-
onError?: Array<EventAction<string & keyof TemplateEventPropsMap['QnnLlm']['onError']>>
|
|
183
|
-
}
|
|
184
|
-
outlets?: {
|
|
185
|
-
/* Context state */
|
|
186
|
-
contextState?: () => Data<string>
|
|
187
|
-
/* Generation result */
|
|
188
|
-
result?: () => Data<string>
|
|
189
|
-
/* Full context (Prompt + Generation Result) */
|
|
190
|
-
fullContext?: () => Data<string>
|
|
191
|
-
/* Last function call details */
|
|
192
|
-
lastFunctionCall?: () => Data<{
|
|
193
|
-
id?: string
|
|
194
|
-
type?: string
|
|
195
|
-
function?: {
|
|
196
|
-
name?: string
|
|
197
|
-
arguments?: string
|
|
198
|
-
[key: string]: any
|
|
199
|
-
}
|
|
200
|
-
[key: string]: any
|
|
201
|
-
}>
|
|
202
|
-
/* Completion details */
|
|
203
|
-
completionDetails?: () => Data<{
|
|
204
|
-
text?: string
|
|
205
|
-
content?: string
|
|
206
|
-
reasoning_content?: string
|
|
207
|
-
tool_calls?: Array<{
|
|
208
|
-
id?: string
|
|
209
|
-
type?: string
|
|
210
|
-
function?: {
|
|
211
|
-
name?: string
|
|
212
|
-
arguments?: string
|
|
213
|
-
[key: string]: any
|
|
214
|
-
}
|
|
215
|
-
[key: string]: any
|
|
216
|
-
}>
|
|
217
|
-
[key: string]: any
|
|
218
|
-
}>
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/* Local LLM inference using Qualcomm AI Engine */
|
|
223
|
-
export type GeneratorQnnLlm = Generator &
|
|
224
|
-
GeneratorQnnLlmDef & {
|
|
225
|
-
templateKey: 'GENERATOR_QNN_LLM'
|
|
226
|
-
switches?: Array<
|
|
227
|
-
SwitchDef &
|
|
228
|
-
GeneratorQnnLlmDef & {
|
|
229
|
-
conds?: Array<{
|
|
230
|
-
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
231
|
-
cond:
|
|
232
|
-
| SwitchCondInnerStateCurrentCanvas
|
|
233
|
-
| SwitchCondData
|
|
234
|
-
| {
|
|
235
|
-
__typename: 'SwitchCondInnerStateOutlet'
|
|
236
|
-
outlet:
|
|
237
|
-
| 'contextState'
|
|
238
|
-
| 'result'
|
|
239
|
-
| 'fullContext'
|
|
240
|
-
| 'lastFunctionCall'
|
|
241
|
-
| 'completionDetails'
|
|
242
|
-
value: any
|
|
243
|
-
}
|
|
244
|
-
}>
|
|
245
|
-
}
|
|
246
|
-
>
|
|
247
|
-
}
|