@ax-llm/ax 11.0.26 → 11.0.27

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/index.js CHANGED
@@ -37,6 +37,9 @@ var axSpanAttributes = {
37
37
  DB_QUERY_RESULT_VECTOR: "db.query.result.vector",
38
38
  DB_QUERY_RESULT_DOCUMENT: "db.query.result.document"
39
39
  };
40
+ var axSpanEvents = {
41
+ LLM_PROMPT: "gen_ai.prompt"
42
+ };
40
43
  var AxLLMRequestTypeValues = /* @__PURE__ */ ((AxLLMRequestTypeValues2) => {
41
44
  AxLLMRequestTypeValues2["COMPLETION"] = "completion";
42
45
  AxLLMRequestTypeValues2["CHAT"] = "chat";
@@ -700,6 +703,12 @@ var axBaseAIDefaultConfig = () => structuredClone({
700
703
  topK: 40,
701
704
  topP: 0.9
702
705
  });
706
+ var axBaseAIDefaultCreativeConfig = () => structuredClone({
707
+ maxTokens: 2e3,
708
+ temperature: 0.4,
709
+ topP: 0.7,
710
+ frequencyPenalty: 0.2
711
+ });
703
712
  var AxBaseAI = class {
704
713
  constructor(aiImpl, {
705
714
  name,
@@ -1741,6 +1750,19 @@ var axAIOpenAIDefaultConfig = () => structuredClone({
1741
1750
  embedModel: "text-embedding-3-small" /* TextEmbedding3Small */,
1742
1751
  ...axBaseAIDefaultConfig()
1743
1752
  });
1753
+ var axAIOpenAIBestConfig = () => structuredClone({
1754
+ ...axAIOpenAIDefaultConfig(),
1755
+ model: "gpt-4o" /* GPT4O */
1756
+ });
1757
+ var axAIOpenAICreativeConfig = () => structuredClone({
1758
+ model: "gpt-4o" /* GPT4O */,
1759
+ embedModel: "text-embedding-3-small" /* TextEmbedding3Small */,
1760
+ ...axBaseAIDefaultCreativeConfig()
1761
+ });
1762
+ var axAIOpenAIFastConfig = () => ({
1763
+ ...axAIOpenAIDefaultConfig(),
1764
+ model: "gpt-4o-mini" /* GPT4OMini */
1765
+ });
1744
1766
  var AxAIOpenAIImpl = class {
1745
1767
  constructor(config, streamingUsage, dimensions) {
1746
1768
  this.config = config;
@@ -2046,6 +2068,9 @@ var AxAIOpenAI = class extends AxAIOpenAIBase {
2046
2068
 
2047
2069
  // ai/azure-openai/api.ts
2048
2070
  var axAIAzureOpenAIDefaultConfig = axAIOpenAIDefaultConfig;
2071
+ var axAIAzureOpenAICreativeConfig = axAIOpenAICreativeConfig;
2072
+ var axAIAzureOpenAIFastConfig = axAIOpenAIFastConfig;
2073
+ var axAIAzureOpenAIBestConfig = axAIOpenAIBestConfig;
2049
2074
  var AxAIAzureOpenAI = class extends AxAIOpenAIBase {
2050
2075
  constructor({
2051
2076
  apiKey,
@@ -2162,6 +2187,11 @@ var axAICohereDefaultConfig = () => structuredClone({
2162
2187
  embedModel: "embed-english-v3.0" /* EmbedEnglishV30 */,
2163
2188
  ...axBaseAIDefaultConfig()
2164
2189
  });
2190
+ var axAICohereCreativeConfig = () => structuredClone({
2191
+ model: "command-r" /* CommandR */,
2192
+ embedModel: "embed-english-v3.0" /* EmbedEnglishV30 */,
2193
+ ...axBaseAIDefaultCreativeConfig()
2194
+ });
2165
2195
  var AxAICohereImpl = class {
2166
2196
  constructor(config) {
2167
2197
  this.config = config;
@@ -2438,6 +2468,10 @@ var axAIDeepSeekDefaultConfig = () => structuredClone({
2438
2468
  model: "deepseek-chat" /* DeepSeekChat */,
2439
2469
  ...axBaseAIDefaultConfig()
2440
2470
  });
2471
+ var axAIDeepSeekCodeConfig = () => structuredClone({
2472
+ model: "deepseek-coder" /* DeepSeekCoder */,
2473
+ ...axBaseAIDefaultCreativeConfig()
2474
+ });
2441
2475
  var AxAIDeepSeek = class extends AxAIOpenAIBase {
2442
2476
  constructor({
2443
2477
  apiKey,
@@ -2585,6 +2619,12 @@ var axAIGoogleGeminiDefaultConfig = () => structuredClone({
2585
2619
  safetySettings,
2586
2620
  ...axBaseAIDefaultConfig()
2587
2621
  });
2622
+ var axAIGoogleGeminiDefaultCreativeConfig = () => structuredClone({
2623
+ model: "gemini-2.0-flash" /* Gemini20Flash */,
2624
+ embedModel: "text-embedding-004" /* TextEmbedding004 */,
2625
+ safetySettings,
2626
+ ...axBaseAIDefaultCreativeConfig()
2627
+ });
2588
2628
  var AxAIGoogleGeminiImpl = class {
2589
2629
  constructor(config, isVertex, endpointId, apiKey, options) {
2590
2630
  this.config = config;
@@ -3096,6 +3136,10 @@ var axAIHuggingFaceDefaultConfig = () => structuredClone({
3096
3136
  model: "meta-llama/Llama-2-70b-chat-hf" /* MetaLlama270BChatHF */,
3097
3137
  ...axBaseAIDefaultConfig()
3098
3138
  });
3139
+ var axAIHuggingFaceCreativeConfig = () => structuredClone({
3140
+ model: "meta-llama/Llama-2-70b-chat-hf" /* MetaLlama270BChatHF */,
3141
+ ...axBaseAIDefaultCreativeConfig()
3142
+ });
3099
3143
  var AxAIHuggingFaceImpl = class {
3100
3144
  constructor(config) {
3101
3145
  this.config = config;
@@ -3277,6 +3321,10 @@ var axAIMistralDefaultConfig = () => structuredClone({
3277
3321
  model: "mistral-small-latest" /* MistralSmall */,
3278
3322
  ...axBaseAIDefaultConfig()
3279
3323
  });
3324
+ var axAIMistralBestConfig = () => structuredClone({
3325
+ ...axAIMistralDefaultConfig(),
3326
+ model: "mistral-large-latest" /* MistralLarge */
3327
+ });
3280
3328
  var AxAIMistral = class extends AxAIOpenAIBase {
3281
3329
  constructor({
3282
3330
  apiKey,
@@ -3309,6 +3357,11 @@ var axAIOllamaDefaultConfig = () => structuredClone({
3309
3357
  model: "nous-hermes2",
3310
3358
  embedModel: "all-minilm"
3311
3359
  });
3360
+ var axAIOllamaDefaultCreativeConfig = () => structuredClone({
3361
+ ...axBaseAIDefaultCreativeConfig(),
3362
+ model: "nous-hermes2",
3363
+ embedModel: "all-minilm"
3364
+ });
3312
3365
  var AxAIOllama = class extends AxAIOpenAIBase {
3313
3366
  constructor({
3314
3367
  apiKey = "not-set",
@@ -3368,6 +3421,18 @@ var axAIRekaDefaultConfig = () => structuredClone({
3368
3421
  model: "reka-core" /* RekaCore */,
3369
3422
  ...axBaseAIDefaultConfig()
3370
3423
  });
3424
+ var axAIRekaBestConfig = () => structuredClone({
3425
+ ...axAIRekaDefaultConfig(),
3426
+ model: "reka-core" /* RekaCore */
3427
+ });
3428
+ var axAIRekaCreativeConfig = () => structuredClone({
3429
+ model: "reka-core" /* RekaCore */,
3430
+ ...axBaseAIDefaultCreativeConfig()
3431
+ });
3432
+ var axAIRekaFastConfig = () => ({
3433
+ ...axAIRekaDefaultConfig(),
3434
+ model: "reka-flash" /* RekaFlash */
3435
+ });
3371
3436
  var AxAIRekaImpl = class {
3372
3437
  constructor(config) {
3373
3438
  this.config = config;
@@ -8445,7 +8510,7 @@ var batchArray = (arr, size) => {
8445
8510
  }
8446
8511
  return chunkedArr;
8447
8512
  };
8448
- var axStringUtil = {
8513
+ var AxStringUtil = {
8449
8514
  trimNonAlphaNum,
8450
8515
  splitIntoTwo,
8451
8516
  dedup,
@@ -8464,7 +8529,7 @@ var AxDefaultResultReranker = class extends AxGen {
8464
8529
  forward = async (ai, input, options) => {
8465
8530
  const { rankedItems } = await super.forward(ai, input, options);
8466
8531
  const sortedIndexes = rankedItems.map((item) => {
8467
- const { id: index } = axStringUtil.extractIdAndText(item);
8532
+ const { id: index } = AxStringUtil.extractIdAndText(item);
8468
8533
  return index;
8469
8534
  });
8470
8535
  const sortedItems = input.items.map((_, index) => {
@@ -8519,6 +8584,1230 @@ var AxEmbeddingAdapter = class {
8519
8584
  }
8520
8585
  };
8521
8586
 
8587
+ // dsp/stopwords.ts
8588
+ var stopwords = /* @__PURE__ */ new Set([
8589
+ "0o",
8590
+ "0s",
8591
+ "3a",
8592
+ "3b",
8593
+ "3d",
8594
+ "6b",
8595
+ "6o",
8596
+ "a",
8597
+ "a1",
8598
+ "a2",
8599
+ "a3",
8600
+ "a4",
8601
+ "ab",
8602
+ "able",
8603
+ "about",
8604
+ "above",
8605
+ "abst",
8606
+ "ac",
8607
+ "accordance",
8608
+ "according",
8609
+ "accordingly",
8610
+ "across",
8611
+ "act",
8612
+ "actually",
8613
+ "ad",
8614
+ "added",
8615
+ "adj",
8616
+ "ae",
8617
+ "af",
8618
+ "affected",
8619
+ "affecting",
8620
+ "affects",
8621
+ "after",
8622
+ "afterwards",
8623
+ "ag",
8624
+ "again",
8625
+ "against",
8626
+ "ah",
8627
+ "ain",
8628
+ "ain't",
8629
+ "aj",
8630
+ "al",
8631
+ "all",
8632
+ "allow",
8633
+ "allows",
8634
+ "almost",
8635
+ "alone",
8636
+ "along",
8637
+ "already",
8638
+ "also",
8639
+ "although",
8640
+ "always",
8641
+ "am",
8642
+ "among",
8643
+ "amongst",
8644
+ "amoungst",
8645
+ "amount",
8646
+ "an",
8647
+ "and",
8648
+ "announce",
8649
+ "another",
8650
+ "any",
8651
+ "anybody",
8652
+ "anyhow",
8653
+ "anymore",
8654
+ "anyone",
8655
+ "anything",
8656
+ "anyway",
8657
+ "anyways",
8658
+ "anywhere",
8659
+ "ao",
8660
+ "ap",
8661
+ "apart",
8662
+ "apparently",
8663
+ "appear",
8664
+ "appreciate",
8665
+ "appropriate",
8666
+ "approximately",
8667
+ "ar",
8668
+ "are",
8669
+ "aren",
8670
+ "arent",
8671
+ "aren't",
8672
+ "arise",
8673
+ "around",
8674
+ "as",
8675
+ "a's",
8676
+ "aside",
8677
+ "ask",
8678
+ "asking",
8679
+ "associated",
8680
+ "at",
8681
+ "au",
8682
+ "auth",
8683
+ "av",
8684
+ "available",
8685
+ "aw",
8686
+ "away",
8687
+ "awfully",
8688
+ "ax",
8689
+ "ay",
8690
+ "az",
8691
+ "b",
8692
+ "b1",
8693
+ "b2",
8694
+ "b3",
8695
+ "ba",
8696
+ "back",
8697
+ "bc",
8698
+ "bd",
8699
+ "be",
8700
+ "became",
8701
+ "because",
8702
+ "become",
8703
+ "becomes",
8704
+ "becoming",
8705
+ "been",
8706
+ "before",
8707
+ "beforehand",
8708
+ "begin",
8709
+ "beginning",
8710
+ "beginnings",
8711
+ "begins",
8712
+ "behind",
8713
+ "being",
8714
+ "believe",
8715
+ "below",
8716
+ "beside",
8717
+ "besides",
8718
+ "best",
8719
+ "better",
8720
+ "between",
8721
+ "beyond",
8722
+ "bi",
8723
+ "bill",
8724
+ "biol",
8725
+ "bj",
8726
+ "bk",
8727
+ "bl",
8728
+ "bn",
8729
+ "both",
8730
+ "bottom",
8731
+ "bp",
8732
+ "br",
8733
+ "brief",
8734
+ "briefly",
8735
+ "bs",
8736
+ "bt",
8737
+ "bu",
8738
+ "but",
8739
+ "bx",
8740
+ "by",
8741
+ "c",
8742
+ "c1",
8743
+ "c2",
8744
+ "c3",
8745
+ "ca",
8746
+ "call",
8747
+ "came",
8748
+ "can",
8749
+ "cannot",
8750
+ "cant",
8751
+ "can't",
8752
+ "cause",
8753
+ "causes",
8754
+ "cc",
8755
+ "cd",
8756
+ "ce",
8757
+ "certain",
8758
+ "certainly",
8759
+ "cf",
8760
+ "cg",
8761
+ "ch",
8762
+ "changes",
8763
+ "ci",
8764
+ "cit",
8765
+ "cj",
8766
+ "cl",
8767
+ "clearly",
8768
+ "cm",
8769
+ "c'mon",
8770
+ "cn",
8771
+ "co",
8772
+ "com",
8773
+ "come",
8774
+ "comes",
8775
+ "con",
8776
+ "concerning",
8777
+ "consequently",
8778
+ "consider",
8779
+ "considering",
8780
+ "contain",
8781
+ "containing",
8782
+ "contains",
8783
+ "corresponding",
8784
+ "could",
8785
+ "couldn",
8786
+ "couldnt",
8787
+ "couldn't",
8788
+ "course",
8789
+ "cp",
8790
+ "cq",
8791
+ "cr",
8792
+ "cry",
8793
+ "cs",
8794
+ "c's",
8795
+ "ct",
8796
+ "cu",
8797
+ "currently",
8798
+ "cv",
8799
+ "cx",
8800
+ "cy",
8801
+ "cz",
8802
+ "d",
8803
+ "d2",
8804
+ "da",
8805
+ "date",
8806
+ "dc",
8807
+ "dd",
8808
+ "de",
8809
+ "definitely",
8810
+ "describe",
8811
+ "described",
8812
+ "despite",
8813
+ "detail",
8814
+ "df",
8815
+ "di",
8816
+ "did",
8817
+ "didn",
8818
+ "didn't",
8819
+ "different",
8820
+ "dj",
8821
+ "dk",
8822
+ "dl",
8823
+ "do",
8824
+ "does",
8825
+ "doesn",
8826
+ "doesn't",
8827
+ "doing",
8828
+ "don",
8829
+ "done",
8830
+ "don't",
8831
+ "down",
8832
+ "downwards",
8833
+ "dp",
8834
+ "dr",
8835
+ "ds",
8836
+ "dt",
8837
+ "du",
8838
+ "due",
8839
+ "during",
8840
+ "dx",
8841
+ "dy",
8842
+ "e",
8843
+ "e2",
8844
+ "e3",
8845
+ "ea",
8846
+ "each",
8847
+ "ec",
8848
+ "ed",
8849
+ "edu",
8850
+ "ee",
8851
+ "ef",
8852
+ "effect",
8853
+ "eg",
8854
+ "ei",
8855
+ "eight",
8856
+ "eighty",
8857
+ "either",
8858
+ "ej",
8859
+ "el",
8860
+ "eleven",
8861
+ "else",
8862
+ "elsewhere",
8863
+ "em",
8864
+ "empty",
8865
+ "en",
8866
+ "end",
8867
+ "ending",
8868
+ "enough",
8869
+ "entirely",
8870
+ "eo",
8871
+ "ep",
8872
+ "eq",
8873
+ "er",
8874
+ "es",
8875
+ "especially",
8876
+ "est",
8877
+ "et",
8878
+ "et-al",
8879
+ "etc",
8880
+ "eu",
8881
+ "ev",
8882
+ "even",
8883
+ "ever",
8884
+ "every",
8885
+ "everybody",
8886
+ "everyone",
8887
+ "everything",
8888
+ "everywhere",
8889
+ "ex",
8890
+ "exactly",
8891
+ "example",
8892
+ "except",
8893
+ "ey",
8894
+ "f",
8895
+ "f2",
8896
+ "fa",
8897
+ "far",
8898
+ "fc",
8899
+ "few",
8900
+ "ff",
8901
+ "fi",
8902
+ "fifteen",
8903
+ "fifth",
8904
+ "fify",
8905
+ "fill",
8906
+ "find",
8907
+ "fire",
8908
+ "first",
8909
+ "five",
8910
+ "fix",
8911
+ "fj",
8912
+ "fl",
8913
+ "fn",
8914
+ "fo",
8915
+ "followed",
8916
+ "following",
8917
+ "follows",
8918
+ "for",
8919
+ "former",
8920
+ "formerly",
8921
+ "forth",
8922
+ "forty",
8923
+ "found",
8924
+ "four",
8925
+ "fr",
8926
+ "from",
8927
+ "front",
8928
+ "node:fs",
8929
+ "ft",
8930
+ "fu",
8931
+ "full",
8932
+ "further",
8933
+ "furthermore",
8934
+ "fy",
8935
+ "g",
8936
+ "ga",
8937
+ "gave",
8938
+ "ge",
8939
+ "get",
8940
+ "gets",
8941
+ "getting",
8942
+ "gi",
8943
+ "give",
8944
+ "given",
8945
+ "gives",
8946
+ "giving",
8947
+ "gj",
8948
+ "gl",
8949
+ "go",
8950
+ "goes",
8951
+ "going",
8952
+ "gone",
8953
+ "got",
8954
+ "gotten",
8955
+ "gr",
8956
+ "greetings",
8957
+ "gs",
8958
+ "gy",
8959
+ "h",
8960
+ "h2",
8961
+ "h3",
8962
+ "had",
8963
+ "hadn",
8964
+ "hadn't",
8965
+ "happens",
8966
+ "hardly",
8967
+ "has",
8968
+ "hasn",
8969
+ "hasnt",
8970
+ "hasn't",
8971
+ "have",
8972
+ "haven",
8973
+ "haven't",
8974
+ "having",
8975
+ "he",
8976
+ "hed",
8977
+ "he'd",
8978
+ "he'll",
8979
+ "hello",
8980
+ "help",
8981
+ "hence",
8982
+ "her",
8983
+ "here",
8984
+ "hereafter",
8985
+ "hereby",
8986
+ "herein",
8987
+ "heres",
8988
+ "here's",
8989
+ "hereupon",
8990
+ "hers",
8991
+ "herself",
8992
+ "hes",
8993
+ "he's",
8994
+ "hh",
8995
+ "hi",
8996
+ "hid",
8997
+ "him",
8998
+ "himself",
8999
+ "his",
9000
+ "hither",
9001
+ "hj",
9002
+ "ho",
9003
+ "home",
9004
+ "hopefully",
9005
+ "how",
9006
+ "howbeit",
9007
+ "however",
9008
+ "how's",
9009
+ "hr",
9010
+ "hs",
9011
+ "http",
9012
+ "hu",
9013
+ "hundred",
9014
+ "hy",
9015
+ "i",
9016
+ "i2",
9017
+ "i3",
9018
+ "i4",
9019
+ "i6",
9020
+ "i7",
9021
+ "i8",
9022
+ "ia",
9023
+ "ib",
9024
+ "ibid",
9025
+ "ic",
9026
+ "id",
9027
+ "i'd",
9028
+ "ie",
9029
+ "if",
9030
+ "ig",
9031
+ "ignored",
9032
+ "ih",
9033
+ "ii",
9034
+ "ij",
9035
+ "il",
9036
+ "i'll",
9037
+ "im",
9038
+ "i'm",
9039
+ "immediate",
9040
+ "immediately",
9041
+ "importance",
9042
+ "important",
9043
+ "in",
9044
+ "inasmuch",
9045
+ "inc",
9046
+ "indeed",
9047
+ "index",
9048
+ "indicate",
9049
+ "indicated",
9050
+ "indicates",
9051
+ "information",
9052
+ "inner",
9053
+ "insofar",
9054
+ "instead",
9055
+ "interest",
9056
+ "into",
9057
+ "invention",
9058
+ "inward",
9059
+ "io",
9060
+ "ip",
9061
+ "iq",
9062
+ "ir",
9063
+ "is",
9064
+ "isn",
9065
+ "isn't",
9066
+ "it",
9067
+ "itd",
9068
+ "it'd",
9069
+ "it'll",
9070
+ "its",
9071
+ "it's",
9072
+ "itself",
9073
+ "iv",
9074
+ "i've",
9075
+ "ix",
9076
+ "iy",
9077
+ "iz",
9078
+ "j",
9079
+ "jj",
9080
+ "jr",
9081
+ "js",
9082
+ "jt",
9083
+ "ju",
9084
+ "just",
9085
+ "k",
9086
+ "ke",
9087
+ "keep",
9088
+ "keeps",
9089
+ "kept",
9090
+ "kg",
9091
+ "kj",
9092
+ "km",
9093
+ "know",
9094
+ "known",
9095
+ "knows",
9096
+ "ko",
9097
+ "l",
9098
+ "l2",
9099
+ "la",
9100
+ "largely",
9101
+ "last",
9102
+ "lately",
9103
+ "later",
9104
+ "latter",
9105
+ "latterly",
9106
+ "lb",
9107
+ "lc",
9108
+ "le",
9109
+ "least",
9110
+ "les",
9111
+ "less",
9112
+ "lest",
9113
+ "let",
9114
+ "lets",
9115
+ "let's",
9116
+ "lf",
9117
+ "like",
9118
+ "liked",
9119
+ "likely",
9120
+ "line",
9121
+ "little",
9122
+ "lj",
9123
+ "ll",
9124
+ "ll",
9125
+ "ln",
9126
+ "lo",
9127
+ "look",
9128
+ "looking",
9129
+ "looks",
9130
+ "los",
9131
+ "lr",
9132
+ "ls",
9133
+ "lt",
9134
+ "ltd",
9135
+ "m",
9136
+ "m2",
9137
+ "ma",
9138
+ "made",
9139
+ "mainly",
9140
+ "make",
9141
+ "makes",
9142
+ "many",
9143
+ "may",
9144
+ "maybe",
9145
+ "me",
9146
+ "mean",
9147
+ "means",
9148
+ "meantime",
9149
+ "meanwhile",
9150
+ "merely",
9151
+ "mg",
9152
+ "might",
9153
+ "mightn",
9154
+ "mightn't",
9155
+ "mill",
9156
+ "million",
9157
+ "mine",
9158
+ "miss",
9159
+ "ml",
9160
+ "mn",
9161
+ "mo",
9162
+ "more",
9163
+ "moreover",
9164
+ "most",
9165
+ "mostly",
9166
+ "move",
9167
+ "mr",
9168
+ "mrs",
9169
+ "ms",
9170
+ "mt",
9171
+ "mu",
9172
+ "much",
9173
+ "mug",
9174
+ "must",
9175
+ "mustn",
9176
+ "mustn't",
9177
+ "my",
9178
+ "myself",
9179
+ "model",
9180
+ "n",
9181
+ "n2",
9182
+ "na",
9183
+ "name",
9184
+ "namely",
9185
+ "nay",
9186
+ "nc",
9187
+ "nd",
9188
+ "ne",
9189
+ "near",
9190
+ "nearly",
9191
+ "necessarily",
9192
+ "necessary",
9193
+ "need",
9194
+ "needn",
9195
+ "needn't",
9196
+ "needs",
9197
+ "neither",
9198
+ "never",
9199
+ "nevertheless",
9200
+ "new",
9201
+ "next",
9202
+ "ng",
9203
+ "ni",
9204
+ "nine",
9205
+ "ninety",
9206
+ "nj",
9207
+ "nl",
9208
+ "nn",
9209
+ "no",
9210
+ "nobody",
9211
+ "non",
9212
+ "none",
9213
+ "nonetheless",
9214
+ "noone",
9215
+ "nor",
9216
+ "normally",
9217
+ "nos",
9218
+ "not",
9219
+ "noted",
9220
+ "nothing",
9221
+ "novel",
9222
+ "now",
9223
+ "nowhere",
9224
+ "nr",
9225
+ "ns",
9226
+ "nt",
9227
+ "ny",
9228
+ "o",
9229
+ "oa",
9230
+ "ob",
9231
+ "obtain",
9232
+ "obtained",
9233
+ "obviously",
9234
+ "oc",
9235
+ "od",
9236
+ "of",
9237
+ "off",
9238
+ "often",
9239
+ "og",
9240
+ "oh",
9241
+ "oi",
9242
+ "oj",
9243
+ "ok",
9244
+ "okay",
9245
+ "ol",
9246
+ "old",
9247
+ "om",
9248
+ "omitted",
9249
+ "on",
9250
+ "once",
9251
+ "one",
9252
+ "ones",
9253
+ "only",
9254
+ "onto",
9255
+ "oo",
9256
+ "op",
9257
+ "oq",
9258
+ "or",
9259
+ "ord",
9260
+ "os",
9261
+ "ot",
9262
+ "other",
9263
+ "others",
9264
+ "otherwise",
9265
+ "ou",
9266
+ "ought",
9267
+ "our",
9268
+ "ours",
9269
+ "ourselves",
9270
+ "out",
9271
+ "outside",
9272
+ "over",
9273
+ "overall",
9274
+ "ow",
9275
+ "owing",
9276
+ "own",
9277
+ "ox",
9278
+ "oz",
9279
+ "p",
9280
+ "p1",
9281
+ "p2",
9282
+ "p3",
9283
+ "page",
9284
+ "pagecount",
9285
+ "pages",
9286
+ "par",
9287
+ "part",
9288
+ "particular",
9289
+ "particularly",
9290
+ "pas",
9291
+ "past",
9292
+ "pc",
9293
+ "pd",
9294
+ "pe",
9295
+ "per",
9296
+ "perhaps",
9297
+ "pf",
9298
+ "ph",
9299
+ "pi",
9300
+ "pj",
9301
+ "pk",
9302
+ "pl",
9303
+ "placed",
9304
+ "please",
9305
+ "plus",
9306
+ "pm",
9307
+ "pn",
9308
+ "po",
9309
+ "poorly",
9310
+ "possible",
9311
+ "possibly",
9312
+ "potentially",
9313
+ "pp",
9314
+ "pq",
9315
+ "pr",
9316
+ "predominantly",
9317
+ "present",
9318
+ "presumably",
9319
+ "previously",
9320
+ "primarily",
9321
+ "probably",
9322
+ "promptly",
9323
+ "proud",
9324
+ "provides",
9325
+ "ps",
9326
+ "pt",
9327
+ "pu",
9328
+ "put",
9329
+ "py",
9330
+ "q",
9331
+ "qj",
9332
+ "qu",
9333
+ "que",
9334
+ "quickly",
9335
+ "quite",
9336
+ "qv",
9337
+ "r",
9338
+ "r2",
9339
+ "ra",
9340
+ "ran",
9341
+ "rather",
9342
+ "rc",
9343
+ "rd",
9344
+ "re",
9345
+ "readily",
9346
+ "really",
9347
+ "reasonably",
9348
+ "recent",
9349
+ "recently",
9350
+ "ref",
9351
+ "refs",
9352
+ "regarding",
9353
+ "regardless",
9354
+ "regards",
9355
+ "related",
9356
+ "relatively",
9357
+ "research",
9358
+ "research-articl",
9359
+ "respectively",
9360
+ "resulted",
9361
+ "resulting",
9362
+ "results",
9363
+ "rf",
9364
+ "rh",
9365
+ "ri",
9366
+ "right",
9367
+ "rj",
9368
+ "rl",
9369
+ "rm",
9370
+ "rn",
9371
+ "ro",
9372
+ "rq",
9373
+ "rr",
9374
+ "rs",
9375
+ "rt",
9376
+ "ru",
9377
+ "run",
9378
+ "rv",
9379
+ "ry",
9380
+ "s",
9381
+ "s2",
9382
+ "sa",
9383
+ "said",
9384
+ "same",
9385
+ "saw",
9386
+ "say",
9387
+ "saying",
9388
+ "says",
9389
+ "sc",
9390
+ "sd",
9391
+ "se",
9392
+ "sec",
9393
+ "second",
9394
+ "secondly",
9395
+ "section",
9396
+ "see",
9397
+ "seeing",
9398
+ "seem",
9399
+ "seemed",
9400
+ "seeming",
9401
+ "seems",
9402
+ "seen",
9403
+ "self",
9404
+ "selves",
9405
+ "sensible",
9406
+ "sent",
9407
+ "serious",
9408
+ "seriously",
9409
+ "seven",
9410
+ "several",
9411
+ "sf",
9412
+ "shall",
9413
+ "shan",
9414
+ "shan't",
9415
+ "she",
9416
+ "shed",
9417
+ "she'd",
9418
+ "she'll",
9419
+ "shes",
9420
+ "she's",
9421
+ "should",
9422
+ "shouldn",
9423
+ "shouldn't",
9424
+ "should've",
9425
+ "show",
9426
+ "showed",
9427
+ "shown",
9428
+ "showns",
9429
+ "shows",
9430
+ "si",
9431
+ "side",
9432
+ "significant",
9433
+ "significantly",
9434
+ "similar",
9435
+ "similarly",
9436
+ "since",
9437
+ "sincere",
9438
+ "six",
9439
+ "sixty",
9440
+ "sj",
9441
+ "sl",
9442
+ "slightly",
9443
+ "sm",
9444
+ "sn",
9445
+ "so",
9446
+ "some",
9447
+ "somebody",
9448
+ "somehow",
9449
+ "someone",
9450
+ "somethan",
9451
+ "something",
9452
+ "sometime",
9453
+ "sometimes",
9454
+ "somewhat",
9455
+ "somewhere",
9456
+ "soon",
9457
+ "sorry",
9458
+ "sp",
9459
+ "specifically",
9460
+ "specified",
9461
+ "specify",
9462
+ "specifying",
9463
+ "sq",
9464
+ "sr",
9465
+ "ss",
9466
+ "st",
9467
+ "still",
9468
+ "stop",
9469
+ "strongly",
9470
+ "sub",
9471
+ "substantially",
9472
+ "successfully",
9473
+ "such",
9474
+ "sufficiently",
9475
+ "suggest",
9476
+ "sup",
9477
+ "sure",
9478
+ "sy",
9479
+ "system",
9480
+ "sz",
9481
+ "t",
9482
+ "t1",
9483
+ "t2",
9484
+ "t3",
9485
+ "take",
9486
+ "taken",
9487
+ "taking",
9488
+ "tb",
9489
+ "tc",
9490
+ "td",
9491
+ "te",
9492
+ "tell",
9493
+ "ten",
9494
+ "tends",
9495
+ "tf",
9496
+ "th",
9497
+ "than",
9498
+ "thank",
9499
+ "thanks",
9500
+ "thanx",
9501
+ "that",
9502
+ "that'll",
9503
+ "thats",
9504
+ "that's",
9505
+ "that've",
9506
+ "the",
9507
+ "their",
9508
+ "theirs",
9509
+ "them",
9510
+ "themselves",
9511
+ "then",
9512
+ "thence",
9513
+ "there",
9514
+ "thereafter",
9515
+ "thereby",
9516
+ "thered",
9517
+ "therefore",
9518
+ "therein",
9519
+ "there'll",
9520
+ "thereof",
9521
+ "therere",
9522
+ "theres",
9523
+ "there's",
9524
+ "thereto",
9525
+ "thereupon",
9526
+ "there've",
9527
+ "these",
9528
+ "they",
9529
+ "theyd",
9530
+ "they'd",
9531
+ "they'll",
9532
+ "theyre",
9533
+ "they're",
9534
+ "they've",
9535
+ "thickv",
9536
+ "thin",
9537
+ "think",
9538
+ "third",
9539
+ "this",
9540
+ "thorough",
9541
+ "thoroughly",
9542
+ "those",
9543
+ "thou",
9544
+ "though",
9545
+ "thoughh",
9546
+ "thousand",
9547
+ "three",
9548
+ "throug",
9549
+ "through",
9550
+ "throughout",
9551
+ "thru",
9552
+ "thus",
9553
+ "ti",
9554
+ "til",
9555
+ "tip",
9556
+ "tj",
9557
+ "tl",
9558
+ "tm",
9559
+ "tn",
9560
+ "to",
9561
+ "together",
9562
+ "too",
9563
+ "took",
9564
+ "top",
9565
+ "toward",
9566
+ "towards",
9567
+ "tp",
9568
+ "tq",
9569
+ "tr",
9570
+ "tried",
9571
+ "tries",
9572
+ "truly",
9573
+ "try",
9574
+ "trying",
9575
+ "ts",
9576
+ "t's",
9577
+ "tt",
9578
+ "tv",
9579
+ "twelve",
9580
+ "twenty",
9581
+ "twice",
9582
+ "two",
9583
+ "tx",
9584
+ "u",
9585
+ "u201d",
9586
+ "ue",
9587
+ "ui",
9588
+ "uj",
9589
+ "uk",
9590
+ "um",
9591
+ "un",
9592
+ "under",
9593
+ "unfortunately",
9594
+ "unless",
9595
+ "unlike",
9596
+ "unlikely",
9597
+ "until",
9598
+ "unto",
9599
+ "uo",
9600
+ "up",
9601
+ "upon",
9602
+ "ups",
9603
+ "ur",
9604
+ "us",
9605
+ "use",
9606
+ "used",
9607
+ "useful",
9608
+ "usefully",
9609
+ "usefulness",
9610
+ "uses",
9611
+ "using",
9612
+ "usually",
9613
+ "ut",
9614
+ "v",
9615
+ "va",
9616
+ "value",
9617
+ "various",
9618
+ "vd",
9619
+ "ve",
9620
+ "ve",
9621
+ "very",
9622
+ "via",
9623
+ "viz",
9624
+ "vj",
9625
+ "vo",
9626
+ "vol",
9627
+ "vols",
9628
+ "volumtype",
9629
+ "vq",
9630
+ "vs",
9631
+ "vt",
9632
+ "vu",
9633
+ "w",
9634
+ "wa",
9635
+ "want",
9636
+ "wants",
9637
+ "was",
9638
+ "wasn",
9639
+ "wasnt",
9640
+ "wasn't",
9641
+ "way",
9642
+ "we",
9643
+ "wed",
9644
+ "we'd",
9645
+ "welcome",
9646
+ "well",
9647
+ "we'll",
9648
+ "well-b",
9649
+ "went",
9650
+ "were",
9651
+ "we're",
9652
+ "weren",
9653
+ "werent",
9654
+ "weren't",
9655
+ "we've",
9656
+ "what",
9657
+ "whatever",
9658
+ "what'll",
9659
+ "whats",
9660
+ "what's",
9661
+ "when",
9662
+ "whence",
9663
+ "whenever",
9664
+ "when's",
9665
+ "where",
9666
+ "whereafter",
9667
+ "whereas",
9668
+ "whereby",
9669
+ "wherein",
9670
+ "wheres",
9671
+ "where's",
9672
+ "whereupon",
9673
+ "wherever",
9674
+ "whether",
9675
+ "which",
9676
+ "while",
9677
+ "whim",
9678
+ "whither",
9679
+ "who",
9680
+ "whod",
9681
+ "whoever",
9682
+ "whole",
9683
+ "who'll",
9684
+ "whom",
9685
+ "whomever",
9686
+ "whos",
9687
+ "who's",
9688
+ "whose",
9689
+ "why",
9690
+ "why's",
9691
+ "wi",
9692
+ "widely",
9693
+ "will",
9694
+ "willing",
9695
+ "wish",
9696
+ "with",
9697
+ "within",
9698
+ "without",
9699
+ "wo",
9700
+ "won",
9701
+ "wonder",
9702
+ "wont",
9703
+ "won't",
9704
+ "words",
9705
+ "world",
9706
+ "would",
9707
+ "wouldn",
9708
+ "wouldnt",
9709
+ "wouldn't",
9710
+ "www",
9711
+ "x",
9712
+ "x1",
9713
+ "x2",
9714
+ "x3",
9715
+ "xf",
9716
+ "xi",
9717
+ "xj",
9718
+ "xk",
9719
+ "xl",
9720
+ "xn",
9721
+ "xo",
9722
+ "xs",
9723
+ "xt",
9724
+ "xv",
9725
+ "xx",
9726
+ "y",
9727
+ "y2",
9728
+ "yes",
9729
+ "yet",
9730
+ "yj",
9731
+ "yl",
9732
+ "you",
9733
+ "youd",
9734
+ "you'd",
9735
+ "you'll",
9736
+ "your",
9737
+ "youre",
9738
+ "you're",
9739
+ "yours",
9740
+ "yourself",
9741
+ "yourselves",
9742
+ "you've",
9743
+ "yr",
9744
+ "ys",
9745
+ "yt",
9746
+ "z",
9747
+ "zero",
9748
+ "zi",
9749
+ "zz",
9750
+ "task"
9751
+ ]);
9752
+
9753
+ // dsp/eval.ts
9754
+ function filterTokens(tokens, exclusions) {
9755
+ return tokens.filter((token) => !exclusions.has(token));
9756
+ }
9757
+ function countTokens(tokens) {
9758
+ const counter = {};
9759
+ for (const token of tokens) {
9760
+ counter[token] = (counter[token] || 0) + 1;
9761
+ }
9762
+ return counter;
9763
+ }
9764
+ function normalizeText(s) {
9765
+ s = s.normalize("NFD");
9766
+ s = s.replace(/\b(a|an|the)\b/g, " ");
9767
+ s = s.split(/\s+/).join(" ");
9768
+ s = s.replace(/[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/g, "");
9769
+ return s.toLowerCase();
9770
+ }
9771
+ function emScore(prediction, groundTruth) {
9772
+ return normalizeText(prediction) === normalizeText(groundTruth);
9773
+ }
9774
+ function f1Score(prediction, groundTruth) {
9775
+ const predictionTokens = normalizeText(prediction).split(" ");
9776
+ const groundTruthTokens = normalizeText(groundTruth).split(" ");
9777
+ const predictionCounts = countTokens(predictionTokens);
9778
+ const groundTruthCounts = countTokens(groundTruthTokens);
9779
+ let numSame = 0;
9780
+ for (const token in predictionCounts) {
9781
+ const v1 = predictionCounts[token] ?? 0;
9782
+ const v2 = groundTruthCounts[token] ?? 0;
9783
+ numSame += Math.min(v1, v2);
9784
+ }
9785
+ if (numSame === 0) {
9786
+ return 0;
9787
+ }
9788
+ const precision = numSame / predictionTokens.length;
9789
+ const recall = numSame / groundTruthTokens.length;
9790
+ return 2 * precision * recall / (precision + recall);
9791
+ }
9792
+ function novelF1ScoreOptimized(history, prediction, groundTruth, returnRecall = false) {
9793
+ const historyTokens = normalizeText(history).split(" ");
9794
+ let predictionTokens = normalizeText(prediction).split(" ");
9795
+ let groundTruthTokens = normalizeText(groundTruth).split(" ");
9796
+ const exclusions = /* @__PURE__ */ new Set([...stopwords, ...historyTokens]);
9797
+ predictionTokens = filterTokens(predictionTokens, exclusions);
9798
+ groundTruthTokens = filterTokens(groundTruthTokens, exclusions);
9799
+ const numSame = 0;
9800
+ const precision = numSame / predictionTokens.length;
9801
+ const recall = numSame / groundTruthTokens.length;
9802
+ const f1 = 2 * precision * recall / (precision + recall);
9803
+ return returnRecall ? recall : f1;
9804
+ }
9805
+ var AxEvalUtil = {
9806
+ emScore,
9807
+ f1Score,
9808
+ novelF1ScoreOptimized
9809
+ };
9810
+
8522
9811
  // ../../node_modules/uuid/dist/esm-node/rng.js
8523
9812
  import crypto2 from "crypto";
8524
9813
  var rnds8Pool = new Uint8Array(256);
@@ -9015,7 +10304,7 @@ var AxRAG = class extends AxChainOfThought {
9015
10304
  options
9016
10305
  );
9017
10306
  const val = await this.queryFn(query);
9018
- context = axStringUtil.dedup([...context, val]);
10307
+ context = AxStringUtil.dedup([...context, val]);
9019
10308
  }
9020
10309
  return super.forward(ai, { context, question }, options);
9021
10310
  }
@@ -9076,6 +10365,7 @@ export {
9076
10365
  AxDefaultResultReranker,
9077
10366
  AxDockerSession,
9078
10367
  AxEmbeddingAdapter,
10368
+ AxEvalUtil,
9079
10369
  AxFunctionError,
9080
10370
  AxFunctionProcessor,
9081
10371
  AxGen,
@@ -9099,6 +10389,47 @@ export {
9099
10389
  AxSimpleClassifier,
9100
10390
  AxSimpleClassifierClass,
9101
10391
  AxSpanKindValues,
9102
- AxTestPrompt
10392
+ AxStringUtil,
10393
+ AxTestPrompt,
10394
+ axAIAnthropicDefaultConfig,
10395
+ axAIAzureOpenAIBestConfig,
10396
+ axAIAzureOpenAICreativeConfig,
10397
+ axAIAzureOpenAIDefaultConfig,
10398
+ axAIAzureOpenAIFastConfig,
10399
+ axAICohereCreativeConfig,
10400
+ axAICohereDefaultConfig,
10401
+ axAIDeepSeekCodeConfig,
10402
+ axAIDeepSeekDefaultConfig,
10403
+ axAIGoogleGeminiDefaultConfig,
10404
+ axAIGoogleGeminiDefaultCreativeConfig,
10405
+ axAIHuggingFaceCreativeConfig,
10406
+ axAIHuggingFaceDefaultConfig,
10407
+ axAIMistralBestConfig,
10408
+ axAIMistralDefaultConfig,
10409
+ axAIOllamaDefaultConfig,
10410
+ axAIOllamaDefaultCreativeConfig,
10411
+ axAIOpenAIBestConfig,
10412
+ axAIOpenAICreativeConfig,
10413
+ axAIOpenAIDefaultConfig,
10414
+ axAIOpenAIFastConfig,
10415
+ axAIRekaBestConfig,
10416
+ axAIRekaCreativeConfig,
10417
+ axAIRekaDefaultConfig,
10418
+ axAIRekaFastConfig,
10419
+ axAITogetherDefaultConfig,
10420
+ axBaseAIDefaultConfig,
10421
+ axBaseAIDefaultCreativeConfig,
10422
+ axModelInfoAnthropic,
10423
+ axModelInfoCohere,
10424
+ axModelInfoDeepSeek,
10425
+ axModelInfoGoogleGemini,
10426
+ axModelInfoGroq,
10427
+ axModelInfoHuggingFace,
10428
+ axModelInfoMistral,
10429
+ axModelInfoOpenAI,
10430
+ axModelInfoReka,
10431
+ axModelInfoTogether,
10432
+ axSpanAttributes,
10433
+ axSpanEvents
9103
10434
  };
9104
10435
  //# sourceMappingURL=index.js.map