@fugood/bricks-project 2.21.11 → 2.21.13

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.
@@ -713,6 +713,11 @@ export const templateActionNameMap = {
713
713
  },
714
714
  },
715
715
  GENERATOR_QNN_LLM: {
716
+ GENERATOR_QNN_LLM_PROCESS: {
717
+ prompt: 'GENERATOR_QNN_LLM_PROMPT',
718
+ messages: 'GENERATOR_QNN_LLM_MESSAGES',
719
+ tools: 'GENERATOR_QNN_LLM_TOOLS',
720
+ },
716
721
  GENERATOR_QNN_LLM_GENERATE: {
717
722
  prompt: 'GENERATOR_QNN_LLM_PROMPT',
718
723
  messages: 'GENERATOR_QNN_LLM_MESSAGES',
@@ -739,6 +744,19 @@ export const templateActionNameMap = {
739
744
  text: 'GENERATOR_OPENAI_TTS_TEXT',
740
745
  },
741
746
  },
747
+ GENERATOR_ANTHROPIC_LLM: {
748
+ GENERATOR_ANTHROPIC_LLM_COMPLETION: {
749
+ systemMessage: 'GENERATOR_ANTHROPIC_LLM_SYSTEM_MESSAGE',
750
+ messages: 'GENERATOR_ANTHROPIC_LLM_MESSAGES',
751
+ maxTokens: 'GENERATOR_ANTHROPIC_LLM_MAX_TOKENS',
752
+ temperature: 'GENERATOR_ANTHROPIC_LLM_TEMPERATURE',
753
+ topP: 'GENERATOR_ANTHROPIC_LLM_TOP_P',
754
+ topK: 'GENERATOR_ANTHROPIC_LLM_TOP_K',
755
+ stopSequences: 'GENERATOR_ANTHROPIC_LLM_STOP_SEQUENCES',
756
+ tools: 'GENERATOR_ANTHROPIC_LLM_TOOLS',
757
+ toolChoice: 'GENERATOR_ANTHROPIC_LLM_TOOL_CHOICE',
758
+ },
759
+ },
742
760
  GENERATOR_ASSISTANT: {
743
761
  GENERATOR_ASSISTANT_ADD_MESSAGE: {
744
762
  role: 'GENERATOR_ASSISTANT_ROLE',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fugood/bricks-project",
3
- "version": "2.21.11",
3
+ "version": "2.21.13",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "build": "node scripts/build.js"
@@ -1929,9 +1929,10 @@ interface GeneratorBleCentralDef {
1929
1929
  Default property:
1930
1930
  {
1931
1931
  "init": false,
1932
- "scanTime": 0,
1933
- "updateInterval": 100,
1932
+ "scanTime": 10,
1933
+ "updateInterval": 1000,
1934
1934
  "retainTime": 120,
1935
+ "maximumDiscoveredDevice": 256,
1935
1936
  "allowDuplicates": false,
1936
1937
  "scanMode": "LowPower"
1937
1938
  }
@@ -4671,6 +4672,8 @@ Default property:
4671
4672
  }
4672
4673
  */
4673
4674
  property?: {
4675
+ /* Application-scoped generator key, key cannot be the same with other application-scoped generators */
4676
+ globalGeneratorKey?: string | DataLink
4674
4677
  /* Initialize the MCP client on start */
4675
4678
  init?: boolean | DataLink
4676
4679
  /* Type of the MCP connection, e.g. sse or direct-link (generator) */
@@ -6626,6 +6629,10 @@ Default property:
6626
6629
  cacheKType?: 'f16' | 'f32' | 'q8_0' | 'q4_0' | 'q4_1' | 'iq4_nl' | 'q5_0' | 'q5_1' | DataLink
6627
6630
  /* KV cache data type for the V (Default: f16) */
6628
6631
  cacheVType?: 'f16' | 'f32' | 'q8_0' | 'q4_0' | 'q4_1' | 'iq4_nl' | 'q5_0' | 'q5_1' | DataLink
6632
+ /* Use a unified buffer across the input sequences when computing the attention */
6633
+ useKVUnified?: boolean | DataLink
6634
+ /* Use full-size SWA cache. May improve performance for multiple sequences but uses more memory. */
6635
+ useSwaFull?: boolean | DataLink
6629
6636
  /* Enable context shift */
6630
6637
  ctxShift?: boolean | DataLink
6631
6638
  /* Enable Transform Script for processing the prompt */
@@ -6869,7 +6876,7 @@ Default property:
6869
6876
  "completionTopK": 40,
6870
6877
  "completionTopP": 0.9,
6871
6878
  "completionMinP": 0.05,
6872
- "useGuideToken": false,
6879
+ "useGuideToken": true,
6873
6880
  "contextSize": 8192,
6874
6881
  "batchSize": 8192,
6875
6882
  "microBatchSize": 512,
@@ -7146,6 +7153,28 @@ export type GeneratorQnnLlmActionAbortModelDownload = Action & {
7146
7153
  __actionName: 'GENERATOR_QNN_LLM_ABORT_MODEL_DOWNLOAD'
7147
7154
  }
7148
7155
 
7156
+ /* Pre-process the prompt, to prepare KV cache */
7157
+ export type GeneratorQnnLlmActionProcess = ActionWithParams & {
7158
+ __actionName: 'GENERATOR_QNN_LLM_PROCESS'
7159
+ params?: Array<
7160
+ | {
7161
+ input: 'prompt'
7162
+ value?: string | DataLink | EventProperty
7163
+ mapping?: string
7164
+ }
7165
+ | {
7166
+ input: 'messages'
7167
+ value?: Array<any> | DataLink | EventProperty
7168
+ mapping?: string
7169
+ }
7170
+ | {
7171
+ input: 'tools'
7172
+ value?: Array<any> | DataLink | EventProperty
7173
+ mapping?: string
7174
+ }
7175
+ >
7176
+ }
7177
+
7149
7178
  /* Generate text */
7150
7179
  export type GeneratorQnnLlmActionGenerate = ActionWithParams & {
7151
7180
  __actionName: 'GENERATOR_QNN_LLM_GENERATE'
@@ -7188,6 +7217,10 @@ Default property:
7188
7217
  "toolCallParser": "llama3_json",
7189
7218
  "toolChoice": "auto",
7190
7219
  "parallelToolCalls": false,
7220
+ "temperature": 0.8,
7221
+ "seed": 42,
7222
+ "topK": 40,
7223
+ "topP": 0.95,
7191
7224
  "greedy": false
7192
7225
  }
7193
7226
  */
@@ -7208,10 +7241,10 @@ Default property:
7208
7241
  /* SOC model */
7209
7242
  socModel?: 'X Elite' | 'X Plus' | '8 Elite' | '8 Gen 3' | 'QCS8550' | DataLink
7210
7243
  /* Custom model base URL
7211
- The URL directory should contain `config.json` (model config) file, `model_part_*_of_*.bin` (model split files) files and `tokenizer.json` (tokenizer config) file. */
7244
+ The model should be bundled, for details see https://github.com/mybigday/node-qnn-llm?tab=readme-ov-file#bundled-file */
7212
7245
  customModelUrl?: string | DataLink
7213
- /* Custom model split parts */
7214
- customModelSplitParts?: number | DataLink
7246
+ /* Custom model MD5 */
7247
+ customModelMd5?: string | DataLink
7215
7248
  /* Chat format */
7216
7249
  chatFormat?:
7217
7250
  | 'Llama 2'
@@ -7607,6 +7640,184 @@ export type GeneratorOpenAiTTS = Generator &
7607
7640
  >
7608
7641
  }
7609
7642
 
7643
+ /* Run text completion */
7644
+ export type GeneratorAnthropicLLMActionCompletion = ActionWithParams & {
7645
+ __actionName: 'GENERATOR_ANTHROPIC_LLM_COMPLETION'
7646
+ params?: Array<
7647
+ | {
7648
+ input: 'systemMessage'
7649
+ value?: string | DataLink | EventProperty
7650
+ mapping?: string
7651
+ }
7652
+ | {
7653
+ input: 'messages'
7654
+ value?: Array<any> | DataLink | EventProperty
7655
+ mapping?: string
7656
+ }
7657
+ | {
7658
+ input: 'maxTokens'
7659
+ value?: number | DataLink | EventProperty
7660
+ mapping?: string
7661
+ }
7662
+ | {
7663
+ input: 'temperature'
7664
+ value?: number | DataLink | EventProperty
7665
+ mapping?: string
7666
+ }
7667
+ | {
7668
+ input: 'topP'
7669
+ value?: number | DataLink | EventProperty
7670
+ mapping?: string
7671
+ }
7672
+ | {
7673
+ input: 'topK'
7674
+ value?: number | DataLink | EventProperty
7675
+ mapping?: string
7676
+ }
7677
+ | {
7678
+ input: 'stopSequences'
7679
+ value?: Array<any> | DataLink | EventProperty
7680
+ mapping?: string
7681
+ }
7682
+ | {
7683
+ input: 'tools'
7684
+ value?: Array<any> | DataLink | EventProperty
7685
+ mapping?: string
7686
+ }
7687
+ | {
7688
+ input: 'toolChoice'
7689
+ value?: {} | DataLink | EventProperty
7690
+ mapping?: string
7691
+ }
7692
+ >
7693
+ }
7694
+
7695
+ /* Stop text completion */
7696
+ export type GeneratorAnthropicLLMActionStopCompletion = Action & {
7697
+ __actionName: 'GENERATOR_ANTHROPIC_LLM_STOP_COMPLETION'
7698
+ }
7699
+
7700
+ interface GeneratorAnthropicLLMDef {
7701
+ /*
7702
+ Default property:
7703
+ {
7704
+ "apiEndpoint": "https://api.anthropic.com/v1/messages",
7705
+ "model": "claude-3-5-sonnet-20241022",
7706
+ "systemMessage": "You are a helpful assistant.",
7707
+ "completionMessages": [],
7708
+ "completionMaxTokens": 1024,
7709
+ "completionTemperature": 1,
7710
+ "completionTopP": 1,
7711
+ "completionStopSequences": []
7712
+ }
7713
+ */
7714
+ property?: {
7715
+ /* API endpoint URL */
7716
+ apiEndpoint?: string | DataLink
7717
+ /* API key */
7718
+ apiKey?: string | DataLink
7719
+ /* Model name (Default: claude-3-5-sonnet-20241022) */
7720
+ model?: string | DataLink
7721
+ /* System message content */
7722
+ systemMessage?: string | DataLink
7723
+ /* Chat messages (user/assistant only) */
7724
+ completionMessages?:
7725
+ | Array<
7726
+ | DataLink
7727
+ | {
7728
+ role?: 'user' | 'assistant' | DataLink
7729
+ content?:
7730
+ | string
7731
+ | DataLink
7732
+ | Array<
7733
+ | DataLink
7734
+ | {
7735
+ type?: 'text' | 'image' | DataLink
7736
+ text?: string | DataLink
7737
+ source?:
7738
+ | DataLink
7739
+ | {
7740
+ type?: string | DataLink
7741
+ media_type?: string | DataLink
7742
+ data?: string | DataLink
7743
+ }
7744
+ }
7745
+ >
7746
+ | DataLink
7747
+ | DataLink
7748
+ }
7749
+ >
7750
+ | DataLink
7751
+ /* Tools for function calling following Anthropic format
7752
+ Format: Array of objects with {name, description, input_schema} structure
7753
+ See: https://docs.anthropic.com/en/docs/tool-use */
7754
+ completionTools?: Array<{} | DataLink> | DataLink
7755
+ /* Tool choice for function calling */
7756
+ completionToolChoice?:
7757
+ | DataLink
7758
+ | {
7759
+ type?: 'auto' | 'any' | 'tool' | DataLink
7760
+ name?: string | DataLink
7761
+ }
7762
+ /* Maximum tokens to generate */
7763
+ completionMaxTokens?: number | DataLink
7764
+ /* Temperature */
7765
+ completionTemperature?: number | DataLink
7766
+ /* Top P sampling */
7767
+ completionTopP?: number | DataLink
7768
+ /* Top K sampling */
7769
+ completionTopK?: number | DataLink
7770
+ /* Stop sequences */
7771
+ completionStopSequences?: Array<string | DataLink> | DataLink
7772
+ }
7773
+ events?: {
7774
+ /* Error event */
7775
+ onError?: Array<EventAction>
7776
+ /* Completion event */
7777
+ onCompletion?: Array<EventAction>
7778
+ /* Completion finished event */
7779
+ onCompletionFinished?: Array<EventAction>
7780
+ /* Tool use event */
7781
+ onToolUse?: Array<EventAction>
7782
+ }
7783
+ outlets?: {
7784
+ /* Evaluating outlet */
7785
+ isEvaluating?: () => Data
7786
+ /* Completion result outlet */
7787
+ completionResult?: () => Data
7788
+ /* Completion details outlet */
7789
+ completionDetails?: () => Data
7790
+ }
7791
+ }
7792
+
7793
+ /* LLM inference using Anthropic-compatible API endpoints
7794
+
7795
+ ## Features
7796
+ - Compatible with Anthropic API format
7797
+ - Supports function calling (tools)
7798
+ - Streaming responses
7799
+ - Custom API endpoints (Default to https://api.anthropic.com/v1/messages) */
7800
+ export type GeneratorAnthropicLLM = Generator &
7801
+ GeneratorAnthropicLLMDef & {
7802
+ templateKey: 'GENERATOR_ANTHROPIC_LLM'
7803
+ switches: Array<
7804
+ SwitchDef &
7805
+ GeneratorAnthropicLLMDef & {
7806
+ conds?: Array<{
7807
+ method: '==' | '!=' | '>' | '<' | '>=' | '<='
7808
+ cond:
7809
+ | SwitchCondInnerStateCurrentCanvas
7810
+ | SwitchCondData
7811
+ | {
7812
+ __typename: 'SwitchCondInnerStateOutlet'
7813
+ outlet: 'isEvaluating' | 'completionResult' | 'completionDetails'
7814
+ value: any
7815
+ }
7816
+ }>
7817
+ }
7818
+ >
7819
+ }
7820
+
7610
7821
  /* Add a message to the assistant */
7611
7822
  export type GeneratorAssistantActionAddMessage = ActionWithParams & {
7612
7823
  __actionName: 'GENERATOR_ASSISTANT_ADD_MESSAGE'
@@ -8081,6 +8292,7 @@ Default property:
8081
8292
  | DataLink
8082
8293
  | {
8083
8294
  generatorId?: string | DataLink
8295
+ generatorKey?: string | DataLink
8084
8296
  name?: string | DataLink
8085
8297
  enabled?: boolean | DataLink
8086
8298
  }
@@ -899,6 +899,23 @@ export const templateEventPropsMap = {
899
899
  'GENERATOR_OPENAI_TTS_ERROR', // type: string
900
900
  ],
901
901
  },
902
+ GENERATOR_ANTHROPIC_LLM: {
903
+ onError: [
904
+ 'GENERATOR_ANTHROPIC_LLM_ERROR', // type: string
905
+ ],
906
+ onCompletion: [
907
+ 'GENERATOR_ANTHROPIC_LLM_COMPLETION_RESULT', // type: string
908
+ 'GENERATOR_ANTHROPIC_LLM_COMPLETION_DETAILS', // type: object
909
+ ],
910
+ onCompletionFinished: [
911
+ 'GENERATOR_ANTHROPIC_LLM_COMPLETION_RESULT', // type: string
912
+ 'GENERATOR_ANTHROPIC_LLM_TOOL_USES', // type: array
913
+ ],
914
+ onToolUse: [
915
+ 'GENERATOR_ANTHROPIC_LLM_TOOL_USE_NAME', // type: string
916
+ 'GENERATOR_ANTHROPIC_LLM_TOOL_USE_INPUT', // type: object
917
+ ],
918
+ },
902
919
  GENERATOR_ASSISTANT: {
903
920
  onError: [
904
921
  'GENERATOR_ASSISTANT_ERROR', // type: string