@fugood/bricks-project 2.21.12 → 2.21.14
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/compile/action-name-map.ts +25 -0
- package/package.json +1 -1
- package/types/generators.ts +279 -25
- package/utils/event-props.ts +25 -0
|
@@ -654,6 +654,9 @@ export const templateActionNameMap = {
|
|
|
654
654
|
promptTemplateData: 'GENERATOR_LLM_PROMPT_TEMPLATE_DATA',
|
|
655
655
|
promptTemplateType: 'GENERATOR_LLM_PROMPT_TEMPLATE_TYPE',
|
|
656
656
|
responseFormat: 'GENERATOR_LLM_RESPONSE_FORMAT',
|
|
657
|
+
chatTemplateKwargs: 'GENERATOR_LLM_CHAT_TEMPLATE_KWARGS',
|
|
658
|
+
addGenerationPrompt: 'GENERATOR_LLM_ADD_GENERATION_PROMPT',
|
|
659
|
+
now: 'GENERATOR_LLM_NOW',
|
|
657
660
|
},
|
|
658
661
|
GENERATOR_LLM_COMPLETION: {
|
|
659
662
|
sessionKey: 'GENERATOR_LLM_SESSION_KEY',
|
|
@@ -663,11 +666,15 @@ export const templateActionNameMap = {
|
|
|
663
666
|
parallelToolCalls: 'GENERATOR_LLM_PARALLEL_TOOL_CALLS',
|
|
664
667
|
toolChoice: 'GENERATOR_LLM_TOOL_CHOICE',
|
|
665
668
|
enableThinking: 'GENERATOR_LLM_ENABLE_THINKING',
|
|
669
|
+
useReasoningFormat: 'GENERATOR_LLM_USE_REASONING_FORMAT',
|
|
666
670
|
prompt: 'GENERATOR_LLM_PROMPT',
|
|
667
671
|
promptMediaPaths: 'GENERATOR_LLM_PROMPT_MEDIA_PATHS',
|
|
668
672
|
promptTemplateData: 'GENERATOR_LLM_PROMPT_TEMPLATE_DATA',
|
|
669
673
|
promptTemplateType: 'GENERATOR_LLM_PROMPT_TEMPLATE_TYPE',
|
|
670
674
|
responseFormat: 'GENERATOR_LLM_RESPONSE_FORMAT',
|
|
675
|
+
chatTemplateKwargs: 'GENERATOR_LLM_CHAT_TEMPLATE_KWARGS',
|
|
676
|
+
addGenerationPrompt: 'GENERATOR_LLM_ADD_GENERATION_PROMPT',
|
|
677
|
+
now: 'GENERATOR_LLM_NOW',
|
|
671
678
|
grammar: 'GENERATOR_LLM_GRAMMAR',
|
|
672
679
|
stopWords: 'GENERATOR_LLM_STOP_WORDS',
|
|
673
680
|
predict: 'GENERATOR_LLM_PREDICT',
|
|
@@ -713,6 +720,11 @@ export const templateActionNameMap = {
|
|
|
713
720
|
},
|
|
714
721
|
},
|
|
715
722
|
GENERATOR_QNN_LLM: {
|
|
723
|
+
GENERATOR_QNN_LLM_PROCESS: {
|
|
724
|
+
prompt: 'GENERATOR_QNN_LLM_PROMPT',
|
|
725
|
+
messages: 'GENERATOR_QNN_LLM_MESSAGES',
|
|
726
|
+
tools: 'GENERATOR_QNN_LLM_TOOLS',
|
|
727
|
+
},
|
|
716
728
|
GENERATOR_QNN_LLM_GENERATE: {
|
|
717
729
|
prompt: 'GENERATOR_QNN_LLM_PROMPT',
|
|
718
730
|
messages: 'GENERATOR_QNN_LLM_MESSAGES',
|
|
@@ -739,6 +751,19 @@ export const templateActionNameMap = {
|
|
|
739
751
|
text: 'GENERATOR_OPENAI_TTS_TEXT',
|
|
740
752
|
},
|
|
741
753
|
},
|
|
754
|
+
GENERATOR_ANTHROPIC_LLM: {
|
|
755
|
+
GENERATOR_ANTHROPIC_LLM_COMPLETION: {
|
|
756
|
+
systemMessage: 'GENERATOR_ANTHROPIC_LLM_SYSTEM_MESSAGE',
|
|
757
|
+
messages: 'GENERATOR_ANTHROPIC_LLM_MESSAGES',
|
|
758
|
+
maxTokens: 'GENERATOR_ANTHROPIC_LLM_MAX_TOKENS',
|
|
759
|
+
temperature: 'GENERATOR_ANTHROPIC_LLM_TEMPERATURE',
|
|
760
|
+
topP: 'GENERATOR_ANTHROPIC_LLM_TOP_P',
|
|
761
|
+
topK: 'GENERATOR_ANTHROPIC_LLM_TOP_K',
|
|
762
|
+
stopSequences: 'GENERATOR_ANTHROPIC_LLM_STOP_SEQUENCES',
|
|
763
|
+
tools: 'GENERATOR_ANTHROPIC_LLM_TOOLS',
|
|
764
|
+
toolChoice: 'GENERATOR_ANTHROPIC_LLM_TOOL_CHOICE',
|
|
765
|
+
},
|
|
766
|
+
},
|
|
742
767
|
GENERATOR_ASSISTANT: {
|
|
743
768
|
GENERATOR_ASSISTANT_ADD_MESSAGE: {
|
|
744
769
|
role: 'GENERATOR_ASSISTANT_ROLE',
|
package/package.json
CHANGED
package/types/generators.ts
CHANGED
|
@@ -1929,9 +1929,10 @@ interface GeneratorBleCentralDef {
|
|
|
1929
1929
|
Default property:
|
|
1930
1930
|
{
|
|
1931
1931
|
"init": false,
|
|
1932
|
-
"scanTime":
|
|
1933
|
-
"updateInterval":
|
|
1932
|
+
"scanTime": 10,
|
|
1933
|
+
"updateInterval": 1000,
|
|
1934
1934
|
"retainTime": 120,
|
|
1935
|
+
"maximumDiscoveredDevice": 256,
|
|
1935
1936
|
"allowDuplicates": false,
|
|
1936
1937
|
"scanMode": "LowPower"
|
|
1937
1938
|
}
|
|
@@ -4388,6 +4389,7 @@ Default property:
|
|
|
4388
4389
|
| DataLink
|
|
4389
4390
|
/* Tools
|
|
4390
4391
|
Type:
|
|
4392
|
+
`static`: Return static data
|
|
4391
4393
|
`detect-data-change`: Watch data target change to return data,
|
|
4392
4394
|
please update data with ({ id: string, content: string | object }),
|
|
4393
4395
|
and ensure the id is same with request id.
|
|
@@ -4671,6 +4673,8 @@ Default property:
|
|
|
4671
4673
|
}
|
|
4672
4674
|
*/
|
|
4673
4675
|
property?: {
|
|
4676
|
+
/* Application-scoped generator key, key cannot be the same with other application-scoped generators */
|
|
4677
|
+
globalGeneratorKey?: string | DataLink
|
|
4674
4678
|
/* Initialize the MCP client on start */
|
|
4675
4679
|
init?: boolean | DataLink
|
|
4676
4680
|
/* Type of the MCP connection, e.g. sse or direct-link (generator) */
|
|
@@ -6275,6 +6279,21 @@ export type GeneratorLLMActionProcessPrompt = ActionWithParams & {
|
|
|
6275
6279
|
value?: {} | DataLink | EventProperty
|
|
6276
6280
|
mapping?: string
|
|
6277
6281
|
}
|
|
6282
|
+
| {
|
|
6283
|
+
input: 'chatTemplateKwargs'
|
|
6284
|
+
value?: {} | DataLink | EventProperty
|
|
6285
|
+
mapping?: string
|
|
6286
|
+
}
|
|
6287
|
+
| {
|
|
6288
|
+
input: 'addGenerationPrompt'
|
|
6289
|
+
value?: boolean | DataLink | EventProperty
|
|
6290
|
+
mapping?: string
|
|
6291
|
+
}
|
|
6292
|
+
| {
|
|
6293
|
+
input: 'now'
|
|
6294
|
+
value?: string | DataLink | EventProperty
|
|
6295
|
+
mapping?: string
|
|
6296
|
+
}
|
|
6278
6297
|
>
|
|
6279
6298
|
}
|
|
6280
6299
|
|
|
@@ -6317,6 +6336,11 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
|
|
|
6317
6336
|
value?: boolean | DataLink | EventProperty
|
|
6318
6337
|
mapping?: string
|
|
6319
6338
|
}
|
|
6339
|
+
| {
|
|
6340
|
+
input: 'useReasoningFormat'
|
|
6341
|
+
value?: string | DataLink | EventProperty
|
|
6342
|
+
mapping?: string
|
|
6343
|
+
}
|
|
6320
6344
|
| {
|
|
6321
6345
|
input: 'prompt'
|
|
6322
6346
|
value?: string | DataLink | EventProperty
|
|
@@ -6342,6 +6366,21 @@ export type GeneratorLLMActionCompletion = ActionWithParams & {
|
|
|
6342
6366
|
value?: {} | DataLink | EventProperty
|
|
6343
6367
|
mapping?: string
|
|
6344
6368
|
}
|
|
6369
|
+
| {
|
|
6370
|
+
input: 'chatTemplateKwargs'
|
|
6371
|
+
value?: {} | DataLink | EventProperty
|
|
6372
|
+
mapping?: string
|
|
6373
|
+
}
|
|
6374
|
+
| {
|
|
6375
|
+
input: 'addGenerationPrompt'
|
|
6376
|
+
value?: boolean | DataLink | EventProperty
|
|
6377
|
+
mapping?: string
|
|
6378
|
+
}
|
|
6379
|
+
| {
|
|
6380
|
+
input: 'now'
|
|
6381
|
+
value?: string | DataLink | EventProperty
|
|
6382
|
+
mapping?: string
|
|
6383
|
+
}
|
|
6345
6384
|
| {
|
|
6346
6385
|
input: 'grammar'
|
|
6347
6386
|
value?: string | DataLink | EventProperty
|
|
@@ -6533,6 +6572,7 @@ Default property:
|
|
|
6533
6572
|
"cacheKType": "f16",
|
|
6534
6573
|
"cacheVType": "f16",
|
|
6535
6574
|
"ctxShift": true,
|
|
6575
|
+
"cpuMoeLayers": 0,
|
|
6536
6576
|
"transformScriptEnabled": false,
|
|
6537
6577
|
"transformScriptCode": "\/\* Global variable: inputs = { prompt, messages, variables }, members = { llmUtils } \*\/\nreturn inputs.prompt",
|
|
6538
6578
|
"transformScriptVariables": {},
|
|
@@ -6541,22 +6581,14 @@ Default property:
|
|
|
6541
6581
|
"completionMode": "auto",
|
|
6542
6582
|
"completionPrompt": "",
|
|
6543
6583
|
"completionPromptTemplateType": "${}",
|
|
6544
|
-
"
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
"<|im_end|>",
|
|
6550
|
-
"<|EOT|>",
|
|
6551
|
-
"<|END_OF_TURN_TOKEN|>",
|
|
6552
|
-
"<|end_of_turn|>",
|
|
6553
|
-
"<|endoftext|>",
|
|
6554
|
-
"<eos>",
|
|
6555
|
-
"<end_of_turn>"
|
|
6556
|
-
],
|
|
6584
|
+
"completionEnableThinking": true,
|
|
6585
|
+
"completionAddGenerationPrompt": true,
|
|
6586
|
+
"completionChatTemplateKwargs": {},
|
|
6587
|
+
"completionUseReasoningFormat": "auto",
|
|
6588
|
+
"completionStopWords": [],
|
|
6557
6589
|
"completionPredict": 400,
|
|
6558
6590
|
"completionTopK": 40,
|
|
6559
|
-
"completionTopP": 0.
|
|
6591
|
+
"completionTopP": 0.95,
|
|
6560
6592
|
"completionMinP": 0.05,
|
|
6561
6593
|
"completionDryMultiplier": 0,
|
|
6562
6594
|
"completionDryBase": 1.75,
|
|
@@ -6570,7 +6602,7 @@ Default property:
|
|
|
6570
6602
|
"completionMirostat": 0,
|
|
6571
6603
|
"completionMirostatTau": 5,
|
|
6572
6604
|
"completionMirostatEta": 0.1,
|
|
6573
|
-
"completionPenaltyLastN":
|
|
6605
|
+
"completionPenaltyLastN": 64,
|
|
6574
6606
|
"completionPenaltyRepeat": 1,
|
|
6575
6607
|
"completionPenaltyFrequency": 0,
|
|
6576
6608
|
"completionPenaltyPresent": 0,
|
|
@@ -6621,15 +6653,19 @@ Default property:
|
|
|
6621
6653
|
/* Use mmap */
|
|
6622
6654
|
useMmap?: boolean | DataLink
|
|
6623
6655
|
/* Use Flash Attention for inference (Recommended with GPU enabled) */
|
|
6624
|
-
useFlashAttn?:
|
|
6625
|
-
/* Use full-size SWA cache. May improve performance for multiple sequences but uses more memory. */
|
|
6626
|
-
useSwaFull?: boolean | DataLink
|
|
6656
|
+
useFlashAttn?: 'auto' | 'on' | 'off' | DataLink
|
|
6627
6657
|
/* KV cache data type for the K (Default: f16) */
|
|
6628
6658
|
cacheKType?: 'f16' | 'f32' | 'q8_0' | 'q4_0' | 'q4_1' | 'iq4_nl' | 'q5_0' | 'q5_1' | DataLink
|
|
6629
6659
|
/* KV cache data type for the V (Default: f16) */
|
|
6630
6660
|
cacheVType?: 'f16' | 'f32' | 'q8_0' | 'q4_0' | 'q4_1' | 'iq4_nl' | 'q5_0' | 'q5_1' | DataLink
|
|
6661
|
+
/* Use a unified buffer across the input sequences when computing the attention */
|
|
6662
|
+
useKVUnified?: boolean | DataLink
|
|
6663
|
+
/* Use full-size SWA cache. May improve performance for multiple sequences but uses more memory. */
|
|
6664
|
+
useSwaFull?: boolean | DataLink
|
|
6631
6665
|
/* Enable context shift */
|
|
6632
6666
|
ctxShift?: boolean | DataLink
|
|
6667
|
+
/* Number of layers to keep MoE weights on CPU */
|
|
6668
|
+
cpuMoeLayers?: number | DataLink
|
|
6633
6669
|
/* Enable Transform Script for processing the prompt */
|
|
6634
6670
|
transformScriptEnabled?: boolean | DataLink
|
|
6635
6671
|
/* Code of Transform Script */
|
|
@@ -6690,6 +6726,16 @@ Default property:
|
|
|
6690
6726
|
}
|
|
6691
6727
|
/* Enable thinking */
|
|
6692
6728
|
completionEnableThinking?: boolean | DataLink
|
|
6729
|
+
/* Add generation prompt */
|
|
6730
|
+
completionAddGenerationPrompt?: boolean | DataLink
|
|
6731
|
+
/* Now (for fill current date in chat template if supported) */
|
|
6732
|
+
completionNow?: string | DataLink
|
|
6733
|
+
/* Additional keyword arguments for chat template (object) */
|
|
6734
|
+
completionChatTemplateKwargs?: {} | DataLink
|
|
6735
|
+
/* Use reasoning format for enhanced response structure
|
|
6736
|
+
`auto` - Auto-determine the reasoning format of the model
|
|
6737
|
+
`none` - Disable reasoning format */
|
|
6738
|
+
completionUseReasoningFormat?: 'auto' | 'none' | DataLink
|
|
6693
6739
|
/* Stop words */
|
|
6694
6740
|
completionStopWords?: Array<string | DataLink> | DataLink
|
|
6695
6741
|
/* Number of tokens to predict */
|
|
@@ -6780,6 +6826,8 @@ Default property:
|
|
|
6780
6826
|
completionLastToken?: () => Data
|
|
6781
6827
|
/* Completion result */
|
|
6782
6828
|
completionResult?: () => Data
|
|
6829
|
+
/* Reasoning content from model responses */
|
|
6830
|
+
completionReasoningContent?: () => Data
|
|
6783
6831
|
/* Full context (Prompt + Completion) */
|
|
6784
6832
|
completionFullContext?: () => Data
|
|
6785
6833
|
/* Inference result details */
|
|
@@ -6819,6 +6867,7 @@ export type GeneratorLLM = Generator &
|
|
|
6819
6867
|
| 'completionLastFormattedPrompt'
|
|
6820
6868
|
| 'completionLastToken'
|
|
6821
6869
|
| 'completionResult'
|
|
6870
|
+
| 'completionReasoningContent'
|
|
6822
6871
|
| 'completionFullContext'
|
|
6823
6872
|
| 'completionResultDetails'
|
|
6824
6873
|
value: any
|
|
@@ -6881,7 +6930,7 @@ Default property:
|
|
|
6881
6930
|
"gpuLayers": 0,
|
|
6882
6931
|
"useMlock": true,
|
|
6883
6932
|
"useMmap": true,
|
|
6884
|
-
"useFlashAttn":
|
|
6933
|
+
"useFlashAttn": "off"
|
|
6885
6934
|
}
|
|
6886
6935
|
*/
|
|
6887
6936
|
property?: {
|
|
@@ -6954,7 +7003,7 @@ Default property:
|
|
|
6954
7003
|
/* Use mmap */
|
|
6955
7004
|
useMmap?: boolean | DataLink
|
|
6956
7005
|
/* Use Flash Attention for inference (Recommended with GPU enabled) */
|
|
6957
|
-
useFlashAttn?:
|
|
7006
|
+
useFlashAttn?: 'auto' | 'on' | 'off' | DataLink
|
|
6958
7007
|
}
|
|
6959
7008
|
events?: {
|
|
6960
7009
|
/* Event triggered when state change */
|
|
@@ -7148,6 +7197,28 @@ export type GeneratorQnnLlmActionAbortModelDownload = Action & {
|
|
|
7148
7197
|
__actionName: 'GENERATOR_QNN_LLM_ABORT_MODEL_DOWNLOAD'
|
|
7149
7198
|
}
|
|
7150
7199
|
|
|
7200
|
+
/* Pre-process the prompt, to prepare KV cache */
|
|
7201
|
+
export type GeneratorQnnLlmActionProcess = ActionWithParams & {
|
|
7202
|
+
__actionName: 'GENERATOR_QNN_LLM_PROCESS'
|
|
7203
|
+
params?: Array<
|
|
7204
|
+
| {
|
|
7205
|
+
input: 'prompt'
|
|
7206
|
+
value?: string | DataLink | EventProperty
|
|
7207
|
+
mapping?: string
|
|
7208
|
+
}
|
|
7209
|
+
| {
|
|
7210
|
+
input: 'messages'
|
|
7211
|
+
value?: Array<any> | DataLink | EventProperty
|
|
7212
|
+
mapping?: string
|
|
7213
|
+
}
|
|
7214
|
+
| {
|
|
7215
|
+
input: 'tools'
|
|
7216
|
+
value?: Array<any> | DataLink | EventProperty
|
|
7217
|
+
mapping?: string
|
|
7218
|
+
}
|
|
7219
|
+
>
|
|
7220
|
+
}
|
|
7221
|
+
|
|
7151
7222
|
/* Generate text */
|
|
7152
7223
|
export type GeneratorQnnLlmActionGenerate = ActionWithParams & {
|
|
7153
7224
|
__actionName: 'GENERATOR_QNN_LLM_GENERATE'
|
|
@@ -7190,6 +7261,10 @@ Default property:
|
|
|
7190
7261
|
"toolCallParser": "llama3_json",
|
|
7191
7262
|
"toolChoice": "auto",
|
|
7192
7263
|
"parallelToolCalls": false,
|
|
7264
|
+
"temperature": 0.8,
|
|
7265
|
+
"seed": 42,
|
|
7266
|
+
"topK": 40,
|
|
7267
|
+
"topP": 0.95,
|
|
7193
7268
|
"greedy": false
|
|
7194
7269
|
}
|
|
7195
7270
|
*/
|
|
@@ -7210,10 +7285,10 @@ Default property:
|
|
|
7210
7285
|
/* SOC model */
|
|
7211
7286
|
socModel?: 'X Elite' | 'X Plus' | '8 Elite' | '8 Gen 3' | 'QCS8550' | DataLink
|
|
7212
7287
|
/* Custom model base URL
|
|
7213
|
-
The
|
|
7288
|
+
The model should be bundled, for details see https://github.com/mybigday/node-qnn-llm?tab=readme-ov-file#bundled-file */
|
|
7214
7289
|
customModelUrl?: string | DataLink
|
|
7215
|
-
/* Custom model
|
|
7216
|
-
|
|
7290
|
+
/* Custom model MD5 */
|
|
7291
|
+
customModelMd5?: string | DataLink
|
|
7217
7292
|
/* Chat format */
|
|
7218
7293
|
chatFormat?:
|
|
7219
7294
|
| 'Llama 2'
|
|
@@ -7609,6 +7684,184 @@ export type GeneratorOpenAiTTS = Generator &
|
|
|
7609
7684
|
>
|
|
7610
7685
|
}
|
|
7611
7686
|
|
|
7687
|
+
/* Run text completion */
|
|
7688
|
+
export type GeneratorAnthropicLLMActionCompletion = ActionWithParams & {
|
|
7689
|
+
__actionName: 'GENERATOR_ANTHROPIC_LLM_COMPLETION'
|
|
7690
|
+
params?: Array<
|
|
7691
|
+
| {
|
|
7692
|
+
input: 'systemMessage'
|
|
7693
|
+
value?: string | DataLink | EventProperty
|
|
7694
|
+
mapping?: string
|
|
7695
|
+
}
|
|
7696
|
+
| {
|
|
7697
|
+
input: 'messages'
|
|
7698
|
+
value?: Array<any> | DataLink | EventProperty
|
|
7699
|
+
mapping?: string
|
|
7700
|
+
}
|
|
7701
|
+
| {
|
|
7702
|
+
input: 'maxTokens'
|
|
7703
|
+
value?: number | DataLink | EventProperty
|
|
7704
|
+
mapping?: string
|
|
7705
|
+
}
|
|
7706
|
+
| {
|
|
7707
|
+
input: 'temperature'
|
|
7708
|
+
value?: number | DataLink | EventProperty
|
|
7709
|
+
mapping?: string
|
|
7710
|
+
}
|
|
7711
|
+
| {
|
|
7712
|
+
input: 'topP'
|
|
7713
|
+
value?: number | DataLink | EventProperty
|
|
7714
|
+
mapping?: string
|
|
7715
|
+
}
|
|
7716
|
+
| {
|
|
7717
|
+
input: 'topK'
|
|
7718
|
+
value?: number | DataLink | EventProperty
|
|
7719
|
+
mapping?: string
|
|
7720
|
+
}
|
|
7721
|
+
| {
|
|
7722
|
+
input: 'stopSequences'
|
|
7723
|
+
value?: Array<any> | DataLink | EventProperty
|
|
7724
|
+
mapping?: string
|
|
7725
|
+
}
|
|
7726
|
+
| {
|
|
7727
|
+
input: 'tools'
|
|
7728
|
+
value?: Array<any> | DataLink | EventProperty
|
|
7729
|
+
mapping?: string
|
|
7730
|
+
}
|
|
7731
|
+
| {
|
|
7732
|
+
input: 'toolChoice'
|
|
7733
|
+
value?: {} | DataLink | EventProperty
|
|
7734
|
+
mapping?: string
|
|
7735
|
+
}
|
|
7736
|
+
>
|
|
7737
|
+
}
|
|
7738
|
+
|
|
7739
|
+
/* Stop text completion */
|
|
7740
|
+
export type GeneratorAnthropicLLMActionStopCompletion = Action & {
|
|
7741
|
+
__actionName: 'GENERATOR_ANTHROPIC_LLM_STOP_COMPLETION'
|
|
7742
|
+
}
|
|
7743
|
+
|
|
7744
|
+
interface GeneratorAnthropicLLMDef {
|
|
7745
|
+
/*
|
|
7746
|
+
Default property:
|
|
7747
|
+
{
|
|
7748
|
+
"apiEndpoint": "https://api.anthropic.com/v1/messages",
|
|
7749
|
+
"model": "claude-3-5-sonnet-20241022",
|
|
7750
|
+
"systemMessage": "You are a helpful assistant.",
|
|
7751
|
+
"completionMessages": [],
|
|
7752
|
+
"completionMaxTokens": 1024,
|
|
7753
|
+
"completionTemperature": 1,
|
|
7754
|
+
"completionTopP": 1,
|
|
7755
|
+
"completionStopSequences": []
|
|
7756
|
+
}
|
|
7757
|
+
*/
|
|
7758
|
+
property?: {
|
|
7759
|
+
/* API endpoint URL */
|
|
7760
|
+
apiEndpoint?: string | DataLink
|
|
7761
|
+
/* API key */
|
|
7762
|
+
apiKey?: string | DataLink
|
|
7763
|
+
/* Model name (Default: claude-3-5-sonnet-20241022) */
|
|
7764
|
+
model?: string | DataLink
|
|
7765
|
+
/* System message content */
|
|
7766
|
+
systemMessage?: string | DataLink
|
|
7767
|
+
/* Chat messages (user/assistant only) */
|
|
7768
|
+
completionMessages?:
|
|
7769
|
+
| Array<
|
|
7770
|
+
| DataLink
|
|
7771
|
+
| {
|
|
7772
|
+
role?: 'user' | 'assistant' | DataLink
|
|
7773
|
+
content?:
|
|
7774
|
+
| string
|
|
7775
|
+
| DataLink
|
|
7776
|
+
| Array<
|
|
7777
|
+
| DataLink
|
|
7778
|
+
| {
|
|
7779
|
+
type?: 'text' | 'image' | DataLink
|
|
7780
|
+
text?: string | DataLink
|
|
7781
|
+
source?:
|
|
7782
|
+
| DataLink
|
|
7783
|
+
| {
|
|
7784
|
+
type?: string | DataLink
|
|
7785
|
+
media_type?: string | DataLink
|
|
7786
|
+
data?: string | DataLink
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7789
|
+
>
|
|
7790
|
+
| DataLink
|
|
7791
|
+
| DataLink
|
|
7792
|
+
}
|
|
7793
|
+
>
|
|
7794
|
+
| DataLink
|
|
7795
|
+
/* Tools for function calling following Anthropic format
|
|
7796
|
+
Format: Array of objects with {name, description, input_schema} structure
|
|
7797
|
+
See: https://docs.anthropic.com/en/docs/tool-use */
|
|
7798
|
+
completionTools?: Array<{} | DataLink> | DataLink
|
|
7799
|
+
/* Tool choice for function calling */
|
|
7800
|
+
completionToolChoice?:
|
|
7801
|
+
| DataLink
|
|
7802
|
+
| {
|
|
7803
|
+
type?: 'auto' | 'any' | 'tool' | DataLink
|
|
7804
|
+
name?: string | DataLink
|
|
7805
|
+
}
|
|
7806
|
+
/* Maximum tokens to generate */
|
|
7807
|
+
completionMaxTokens?: number | DataLink
|
|
7808
|
+
/* Temperature */
|
|
7809
|
+
completionTemperature?: number | DataLink
|
|
7810
|
+
/* Top P sampling */
|
|
7811
|
+
completionTopP?: number | DataLink
|
|
7812
|
+
/* Top K sampling */
|
|
7813
|
+
completionTopK?: number | DataLink
|
|
7814
|
+
/* Stop sequences */
|
|
7815
|
+
completionStopSequences?: Array<string | DataLink> | DataLink
|
|
7816
|
+
}
|
|
7817
|
+
events?: {
|
|
7818
|
+
/* Error event */
|
|
7819
|
+
onError?: Array<EventAction>
|
|
7820
|
+
/* Completion event */
|
|
7821
|
+
onCompletion?: Array<EventAction>
|
|
7822
|
+
/* Completion finished event */
|
|
7823
|
+
onCompletionFinished?: Array<EventAction>
|
|
7824
|
+
/* Tool use event */
|
|
7825
|
+
onToolUse?: Array<EventAction>
|
|
7826
|
+
}
|
|
7827
|
+
outlets?: {
|
|
7828
|
+
/* Evaluating outlet */
|
|
7829
|
+
isEvaluating?: () => Data
|
|
7830
|
+
/* Completion result outlet */
|
|
7831
|
+
completionResult?: () => Data
|
|
7832
|
+
/* Completion details outlet */
|
|
7833
|
+
completionDetails?: () => Data
|
|
7834
|
+
}
|
|
7835
|
+
}
|
|
7836
|
+
|
|
7837
|
+
/* LLM inference using Anthropic-compatible API endpoints
|
|
7838
|
+
|
|
7839
|
+
## Features
|
|
7840
|
+
- Compatible with Anthropic API format
|
|
7841
|
+
- Supports function calling (tools)
|
|
7842
|
+
- Streaming responses
|
|
7843
|
+
- Custom API endpoints (Default to https://api.anthropic.com/v1/messages) */
|
|
7844
|
+
export type GeneratorAnthropicLLM = Generator &
|
|
7845
|
+
GeneratorAnthropicLLMDef & {
|
|
7846
|
+
templateKey: 'GENERATOR_ANTHROPIC_LLM'
|
|
7847
|
+
switches: Array<
|
|
7848
|
+
SwitchDef &
|
|
7849
|
+
GeneratorAnthropicLLMDef & {
|
|
7850
|
+
conds?: Array<{
|
|
7851
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
7852
|
+
cond:
|
|
7853
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
7854
|
+
| SwitchCondData
|
|
7855
|
+
| {
|
|
7856
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
7857
|
+
outlet: 'isEvaluating' | 'completionResult' | 'completionDetails'
|
|
7858
|
+
value: any
|
|
7859
|
+
}
|
|
7860
|
+
}>
|
|
7861
|
+
}
|
|
7862
|
+
>
|
|
7863
|
+
}
|
|
7864
|
+
|
|
7612
7865
|
/* Add a message to the assistant */
|
|
7613
7866
|
export type GeneratorAssistantActionAddMessage = ActionWithParams & {
|
|
7614
7867
|
__actionName: 'GENERATOR_ASSISTANT_ADD_MESSAGE'
|
|
@@ -8083,6 +8336,7 @@ Default property:
|
|
|
8083
8336
|
| DataLink
|
|
8084
8337
|
| {
|
|
8085
8338
|
generatorId?: string | DataLink
|
|
8339
|
+
generatorKey?: string | DataLink
|
|
8086
8340
|
name?: string | DataLink
|
|
8087
8341
|
enabled?: boolean | DataLink
|
|
8088
8342
|
}
|
package/utils/event-props.ts
CHANGED
|
@@ -792,6 +792,12 @@ export const templateEventPropsMap = {
|
|
|
792
792
|
GENERATOR_REALTIME_TRANSCRIPTION: {
|
|
793
793
|
onTranscribe: [
|
|
794
794
|
'GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_EVENT', // type: object
|
|
795
|
+
'GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_TYPE', // type: string
|
|
796
|
+
'GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_SLICE_INDEX', // type: number
|
|
797
|
+
'GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_RESULT_TEXT', // type: string
|
|
798
|
+
'GENERATOR_REALTIME_TRANSCRIPTION_TRANSCRIBE_IS_CAPTURING', // type: bool
|
|
799
|
+
'GENERATOR_REALTIME_TRANSCRIPTION_VAD_EVENT', // type: object
|
|
800
|
+
'GENERATOR_REALTIME_TRANSCRIPTION_VAD_TYPE', // type: string
|
|
795
801
|
],
|
|
796
802
|
onVad: [
|
|
797
803
|
'GENERATOR_REALTIME_TRANSCRIPTION_VAD_EVENT', // type: object
|
|
@@ -827,12 +833,14 @@ export const templateEventPropsMap = {
|
|
|
827
833
|
onCompletion: [
|
|
828
834
|
'GENERATOR_LLM_COMPLETION_SESSION_KEY', // type: string
|
|
829
835
|
'GENERATOR_LLM_COMPLETION_RESULT', // type: string
|
|
836
|
+
'GENERATOR_LLM_COMPLETION_REASONING_CONTENT', // type: string
|
|
830
837
|
'GENERATOR_LLM_COMPLETION_FULL_CONTEXT', // type: string
|
|
831
838
|
'GENERATOR_LLM_COMPLETION_RESULT_DETAILS', // type: object
|
|
832
839
|
],
|
|
833
840
|
onCompletionFinished: [
|
|
834
841
|
'GENERATOR_LLM_COMPLETION_SESSION_KEY', // type: string
|
|
835
842
|
'GENERATOR_LLM_COMPLETION_RESULT', // type: string
|
|
843
|
+
'GENERATOR_LLM_COMPLETION_REASONING_CONTENT', // type: string
|
|
836
844
|
'GENERATOR_LLM_COMPLETION_TOOL_CALLS', // type: array
|
|
837
845
|
'GENERATOR_LLM_COMPLETION_FULL_CONTEXT', // type: string
|
|
838
846
|
'GENERATOR_LLM_COMPLETION_IS_CONTEXT_FULL', // type: bool
|
|
@@ -899,6 +907,23 @@ export const templateEventPropsMap = {
|
|
|
899
907
|
'GENERATOR_OPENAI_TTS_ERROR', // type: string
|
|
900
908
|
],
|
|
901
909
|
},
|
|
910
|
+
GENERATOR_ANTHROPIC_LLM: {
|
|
911
|
+
onError: [
|
|
912
|
+
'GENERATOR_ANTHROPIC_LLM_ERROR', // type: string
|
|
913
|
+
],
|
|
914
|
+
onCompletion: [
|
|
915
|
+
'GENERATOR_ANTHROPIC_LLM_COMPLETION_RESULT', // type: string
|
|
916
|
+
'GENERATOR_ANTHROPIC_LLM_COMPLETION_DETAILS', // type: object
|
|
917
|
+
],
|
|
918
|
+
onCompletionFinished: [
|
|
919
|
+
'GENERATOR_ANTHROPIC_LLM_COMPLETION_RESULT', // type: string
|
|
920
|
+
'GENERATOR_ANTHROPIC_LLM_TOOL_USES', // type: array
|
|
921
|
+
],
|
|
922
|
+
onToolUse: [
|
|
923
|
+
'GENERATOR_ANTHROPIC_LLM_TOOL_USE_NAME', // type: string
|
|
924
|
+
'GENERATOR_ANTHROPIC_LLM_TOOL_USE_INPUT', // type: object
|
|
925
|
+
],
|
|
926
|
+
},
|
|
902
927
|
GENERATOR_ASSISTANT: {
|
|
903
928
|
onError: [
|
|
904
929
|
'GENERATOR_ASSISTANT_ERROR', // type: string
|