@ax-llm/ax 11.0.25 → 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.cjs CHANGED
@@ -85,6 +85,7 @@ __export(index_exports, {
85
85
  AxDefaultResultReranker: () => AxDefaultResultReranker,
86
86
  AxDockerSession: () => AxDockerSession,
87
87
  AxEmbeddingAdapter: () => AxEmbeddingAdapter,
88
+ AxEvalUtil: () => AxEvalUtil,
88
89
  AxFunctionError: () => AxFunctionError,
89
90
  AxFunctionProcessor: () => AxFunctionProcessor,
90
91
  AxGen: () => AxGen,
@@ -108,7 +109,48 @@ __export(index_exports, {
108
109
  AxSimpleClassifier: () => AxSimpleClassifier,
109
110
  AxSimpleClassifierClass: () => AxSimpleClassifierClass,
110
111
  AxSpanKindValues: () => AxSpanKindValues,
111
- AxTestPrompt: () => AxTestPrompt
112
+ AxStringUtil: () => AxStringUtil,
113
+ AxTestPrompt: () => AxTestPrompt,
114
+ axAIAnthropicDefaultConfig: () => axAIAnthropicDefaultConfig,
115
+ axAIAzureOpenAIBestConfig: () => axAIAzureOpenAIBestConfig,
116
+ axAIAzureOpenAICreativeConfig: () => axAIAzureOpenAICreativeConfig,
117
+ axAIAzureOpenAIDefaultConfig: () => axAIAzureOpenAIDefaultConfig,
118
+ axAIAzureOpenAIFastConfig: () => axAIAzureOpenAIFastConfig,
119
+ axAICohereCreativeConfig: () => axAICohereCreativeConfig,
120
+ axAICohereDefaultConfig: () => axAICohereDefaultConfig,
121
+ axAIDeepSeekCodeConfig: () => axAIDeepSeekCodeConfig,
122
+ axAIDeepSeekDefaultConfig: () => axAIDeepSeekDefaultConfig,
123
+ axAIGoogleGeminiDefaultConfig: () => axAIGoogleGeminiDefaultConfig,
124
+ axAIGoogleGeminiDefaultCreativeConfig: () => axAIGoogleGeminiDefaultCreativeConfig,
125
+ axAIHuggingFaceCreativeConfig: () => axAIHuggingFaceCreativeConfig,
126
+ axAIHuggingFaceDefaultConfig: () => axAIHuggingFaceDefaultConfig,
127
+ axAIMistralBestConfig: () => axAIMistralBestConfig,
128
+ axAIMistralDefaultConfig: () => axAIMistralDefaultConfig,
129
+ axAIOllamaDefaultConfig: () => axAIOllamaDefaultConfig,
130
+ axAIOllamaDefaultCreativeConfig: () => axAIOllamaDefaultCreativeConfig,
131
+ axAIOpenAIBestConfig: () => axAIOpenAIBestConfig,
132
+ axAIOpenAICreativeConfig: () => axAIOpenAICreativeConfig,
133
+ axAIOpenAIDefaultConfig: () => axAIOpenAIDefaultConfig,
134
+ axAIOpenAIFastConfig: () => axAIOpenAIFastConfig,
135
+ axAIRekaBestConfig: () => axAIRekaBestConfig,
136
+ axAIRekaCreativeConfig: () => axAIRekaCreativeConfig,
137
+ axAIRekaDefaultConfig: () => axAIRekaDefaultConfig,
138
+ axAIRekaFastConfig: () => axAIRekaFastConfig,
139
+ axAITogetherDefaultConfig: () => axAITogetherDefaultConfig,
140
+ axBaseAIDefaultConfig: () => axBaseAIDefaultConfig,
141
+ axBaseAIDefaultCreativeConfig: () => axBaseAIDefaultCreativeConfig,
142
+ axModelInfoAnthropic: () => axModelInfoAnthropic,
143
+ axModelInfoCohere: () => axModelInfoCohere,
144
+ axModelInfoDeepSeek: () => axModelInfoDeepSeek,
145
+ axModelInfoGoogleGemini: () => axModelInfoGoogleGemini,
146
+ axModelInfoGroq: () => axModelInfoGroq,
147
+ axModelInfoHuggingFace: () => axModelInfoHuggingFace,
148
+ axModelInfoMistral: () => axModelInfoMistral,
149
+ axModelInfoOpenAI: () => axModelInfoOpenAI,
150
+ axModelInfoReka: () => axModelInfoReka,
151
+ axModelInfoTogether: () => axModelInfoTogether,
152
+ axSpanAttributes: () => axSpanAttributes,
153
+ axSpanEvents: () => axSpanEvents
112
154
  });
113
155
  module.exports = __toCommonJS(index_exports);
114
156
 
@@ -151,6 +193,9 @@ var axSpanAttributes = {
151
193
  DB_QUERY_RESULT_VECTOR: "db.query.result.vector",
152
194
  DB_QUERY_RESULT_DOCUMENT: "db.query.result.document"
153
195
  };
196
+ var axSpanEvents = {
197
+ LLM_PROMPT: "gen_ai.prompt"
198
+ };
154
199
  var AxLLMRequestTypeValues = /* @__PURE__ */ ((AxLLMRequestTypeValues2) => {
155
200
  AxLLMRequestTypeValues2["COMPLETION"] = "completion";
156
201
  AxLLMRequestTypeValues2["CHAT"] = "chat";
@@ -806,6 +851,12 @@ var axBaseAIDefaultConfig = () => structuredClone({
806
851
  topK: 40,
807
852
  topP: 0.9
808
853
  });
854
+ var axBaseAIDefaultCreativeConfig = () => structuredClone({
855
+ maxTokens: 2e3,
856
+ temperature: 0.4,
857
+ topP: 0.7,
858
+ frequencyPenalty: 0.2
859
+ });
809
860
  var AxBaseAI = class {
810
861
  constructor(aiImpl, {
811
862
  name,
@@ -1847,6 +1898,19 @@ var axAIOpenAIDefaultConfig = () => structuredClone({
1847
1898
  embedModel: "text-embedding-3-small" /* TextEmbedding3Small */,
1848
1899
  ...axBaseAIDefaultConfig()
1849
1900
  });
1901
+ var axAIOpenAIBestConfig = () => structuredClone({
1902
+ ...axAIOpenAIDefaultConfig(),
1903
+ model: "gpt-4o" /* GPT4O */
1904
+ });
1905
+ var axAIOpenAICreativeConfig = () => structuredClone({
1906
+ model: "gpt-4o" /* GPT4O */,
1907
+ embedModel: "text-embedding-3-small" /* TextEmbedding3Small */,
1908
+ ...axBaseAIDefaultCreativeConfig()
1909
+ });
1910
+ var axAIOpenAIFastConfig = () => ({
1911
+ ...axAIOpenAIDefaultConfig(),
1912
+ model: "gpt-4o-mini" /* GPT4OMini */
1913
+ });
1850
1914
  var AxAIOpenAIImpl = class {
1851
1915
  constructor(config, streamingUsage, dimensions) {
1852
1916
  this.config = config;
@@ -2152,6 +2216,9 @@ var AxAIOpenAI = class extends AxAIOpenAIBase {
2152
2216
 
2153
2217
  // ai/azure-openai/api.ts
2154
2218
  var axAIAzureOpenAIDefaultConfig = axAIOpenAIDefaultConfig;
2219
+ var axAIAzureOpenAICreativeConfig = axAIOpenAICreativeConfig;
2220
+ var axAIAzureOpenAIFastConfig = axAIOpenAIFastConfig;
2221
+ var axAIAzureOpenAIBestConfig = axAIOpenAIBestConfig;
2155
2222
  var AxAIAzureOpenAI = class extends AxAIOpenAIBase {
2156
2223
  constructor({
2157
2224
  apiKey,
@@ -2268,6 +2335,11 @@ var axAICohereDefaultConfig = () => structuredClone({
2268
2335
  embedModel: "embed-english-v3.0" /* EmbedEnglishV30 */,
2269
2336
  ...axBaseAIDefaultConfig()
2270
2337
  });
2338
+ var axAICohereCreativeConfig = () => structuredClone({
2339
+ model: "command-r" /* CommandR */,
2340
+ embedModel: "embed-english-v3.0" /* EmbedEnglishV30 */,
2341
+ ...axBaseAIDefaultCreativeConfig()
2342
+ });
2271
2343
  var AxAICohereImpl = class {
2272
2344
  constructor(config) {
2273
2345
  this.config = config;
@@ -2544,6 +2616,10 @@ var axAIDeepSeekDefaultConfig = () => structuredClone({
2544
2616
  model: "deepseek-chat" /* DeepSeekChat */,
2545
2617
  ...axBaseAIDefaultConfig()
2546
2618
  });
2619
+ var axAIDeepSeekCodeConfig = () => structuredClone({
2620
+ model: "deepseek-coder" /* DeepSeekCoder */,
2621
+ ...axBaseAIDefaultCreativeConfig()
2622
+ });
2547
2623
  var AxAIDeepSeek = class extends AxAIOpenAIBase {
2548
2624
  constructor({
2549
2625
  apiKey,
@@ -2691,6 +2767,12 @@ var axAIGoogleGeminiDefaultConfig = () => structuredClone({
2691
2767
  safetySettings,
2692
2768
  ...axBaseAIDefaultConfig()
2693
2769
  });
2770
+ var axAIGoogleGeminiDefaultCreativeConfig = () => structuredClone({
2771
+ model: "gemini-2.0-flash" /* Gemini20Flash */,
2772
+ embedModel: "text-embedding-004" /* TextEmbedding004 */,
2773
+ safetySettings,
2774
+ ...axBaseAIDefaultCreativeConfig()
2775
+ });
2694
2776
  var AxAIGoogleGeminiImpl = class {
2695
2777
  constructor(config, isVertex, endpointId, apiKey, options) {
2696
2778
  this.config = config;
@@ -3202,6 +3284,10 @@ var axAIHuggingFaceDefaultConfig = () => structuredClone({
3202
3284
  model: "meta-llama/Llama-2-70b-chat-hf" /* MetaLlama270BChatHF */,
3203
3285
  ...axBaseAIDefaultConfig()
3204
3286
  });
3287
+ var axAIHuggingFaceCreativeConfig = () => structuredClone({
3288
+ model: "meta-llama/Llama-2-70b-chat-hf" /* MetaLlama270BChatHF */,
3289
+ ...axBaseAIDefaultCreativeConfig()
3290
+ });
3205
3291
  var AxAIHuggingFaceImpl = class {
3206
3292
  constructor(config) {
3207
3293
  this.config = config;
@@ -3383,6 +3469,10 @@ var axAIMistralDefaultConfig = () => structuredClone({
3383
3469
  model: "mistral-small-latest" /* MistralSmall */,
3384
3470
  ...axBaseAIDefaultConfig()
3385
3471
  });
3472
+ var axAIMistralBestConfig = () => structuredClone({
3473
+ ...axAIMistralDefaultConfig(),
3474
+ model: "mistral-large-latest" /* MistralLarge */
3475
+ });
3386
3476
  var AxAIMistral = class extends AxAIOpenAIBase {
3387
3477
  constructor({
3388
3478
  apiKey,
@@ -3415,6 +3505,11 @@ var axAIOllamaDefaultConfig = () => structuredClone({
3415
3505
  model: "nous-hermes2",
3416
3506
  embedModel: "all-minilm"
3417
3507
  });
3508
+ var axAIOllamaDefaultCreativeConfig = () => structuredClone({
3509
+ ...axBaseAIDefaultCreativeConfig(),
3510
+ model: "nous-hermes2",
3511
+ embedModel: "all-minilm"
3512
+ });
3418
3513
  var AxAIOllama = class extends AxAIOpenAIBase {
3419
3514
  constructor({
3420
3515
  apiKey = "not-set",
@@ -3474,6 +3569,18 @@ var axAIRekaDefaultConfig = () => structuredClone({
3474
3569
  model: "reka-core" /* RekaCore */,
3475
3570
  ...axBaseAIDefaultConfig()
3476
3571
  });
3572
+ var axAIRekaBestConfig = () => structuredClone({
3573
+ ...axAIRekaDefaultConfig(),
3574
+ model: "reka-core" /* RekaCore */
3575
+ });
3576
+ var axAIRekaCreativeConfig = () => structuredClone({
3577
+ model: "reka-core" /* RekaCore */,
3578
+ ...axBaseAIDefaultCreativeConfig()
3579
+ });
3580
+ var axAIRekaFastConfig = () => ({
3581
+ ...axAIRekaDefaultConfig(),
3582
+ model: "reka-flash" /* RekaFlash */
3583
+ });
3477
3584
  var AxAIRekaImpl = class {
3478
3585
  constructor(config) {
3479
3586
  this.config = config;
@@ -8551,7 +8658,7 @@ var batchArray = (arr, size) => {
8551
8658
  }
8552
8659
  return chunkedArr;
8553
8660
  };
8554
- var axStringUtil = {
8661
+ var AxStringUtil = {
8555
8662
  trimNonAlphaNum,
8556
8663
  splitIntoTwo,
8557
8664
  dedup,
@@ -8570,7 +8677,7 @@ var AxDefaultResultReranker = class extends AxGen {
8570
8677
  forward = async (ai, input, options) => {
8571
8678
  const { rankedItems } = await super.forward(ai, input, options);
8572
8679
  const sortedIndexes = rankedItems.map((item) => {
8573
- const { id: index } = axStringUtil.extractIdAndText(item);
8680
+ const { id: index } = AxStringUtil.extractIdAndText(item);
8574
8681
  return index;
8575
8682
  });
8576
8683
  const sortedItems = input.items.map((_, index) => {
@@ -8625,6 +8732,1277 @@ var AxEmbeddingAdapter = class {
8625
8732
  }
8626
8733
  };
8627
8734
 
8735
+ // dsp/stopwords.ts
8736
+ var stopwords = /* @__PURE__ */ new Set([
8737
+ "0o",
8738
+ "0s",
8739
+ "3a",
8740
+ "3b",
8741
+ "3d",
8742
+ "6b",
8743
+ "6o",
8744
+ "a",
8745
+ "a1",
8746
+ "a2",
8747
+ "a3",
8748
+ "a4",
8749
+ "ab",
8750
+ "able",
8751
+ "about",
8752
+ "above",
8753
+ "abst",
8754
+ "ac",
8755
+ "accordance",
8756
+ "according",
8757
+ "accordingly",
8758
+ "across",
8759
+ "act",
8760
+ "actually",
8761
+ "ad",
8762
+ "added",
8763
+ "adj",
8764
+ "ae",
8765
+ "af",
8766
+ "affected",
8767
+ "affecting",
8768
+ "affects",
8769
+ "after",
8770
+ "afterwards",
8771
+ "ag",
8772
+ "again",
8773
+ "against",
8774
+ "ah",
8775
+ "ain",
8776
+ "ain't",
8777
+ "aj",
8778
+ "al",
8779
+ "all",
8780
+ "allow",
8781
+ "allows",
8782
+ "almost",
8783
+ "alone",
8784
+ "along",
8785
+ "already",
8786
+ "also",
8787
+ "although",
8788
+ "always",
8789
+ "am",
8790
+ "among",
8791
+ "amongst",
8792
+ "amoungst",
8793
+ "amount",
8794
+ "an",
8795
+ "and",
8796
+ "announce",
8797
+ "another",
8798
+ "any",
8799
+ "anybody",
8800
+ "anyhow",
8801
+ "anymore",
8802
+ "anyone",
8803
+ "anything",
8804
+ "anyway",
8805
+ "anyways",
8806
+ "anywhere",
8807
+ "ao",
8808
+ "ap",
8809
+ "apart",
8810
+ "apparently",
8811
+ "appear",
8812
+ "appreciate",
8813
+ "appropriate",
8814
+ "approximately",
8815
+ "ar",
8816
+ "are",
8817
+ "aren",
8818
+ "arent",
8819
+ "aren't",
8820
+ "arise",
8821
+ "around",
8822
+ "as",
8823
+ "a's",
8824
+ "aside",
8825
+ "ask",
8826
+ "asking",
8827
+ "associated",
8828
+ "at",
8829
+ "au",
8830
+ "auth",
8831
+ "av",
8832
+ "available",
8833
+ "aw",
8834
+ "away",
8835
+ "awfully",
8836
+ "ax",
8837
+ "ay",
8838
+ "az",
8839
+ "b",
8840
+ "b1",
8841
+ "b2",
8842
+ "b3",
8843
+ "ba",
8844
+ "back",
8845
+ "bc",
8846
+ "bd",
8847
+ "be",
8848
+ "became",
8849
+ "because",
8850
+ "become",
8851
+ "becomes",
8852
+ "becoming",
8853
+ "been",
8854
+ "before",
8855
+ "beforehand",
8856
+ "begin",
8857
+ "beginning",
8858
+ "beginnings",
8859
+ "begins",
8860
+ "behind",
8861
+ "being",
8862
+ "believe",
8863
+ "below",
8864
+ "beside",
8865
+ "besides",
8866
+ "best",
8867
+ "better",
8868
+ "between",
8869
+ "beyond",
8870
+ "bi",
8871
+ "bill",
8872
+ "biol",
8873
+ "bj",
8874
+ "bk",
8875
+ "bl",
8876
+ "bn",
8877
+ "both",
8878
+ "bottom",
8879
+ "bp",
8880
+ "br",
8881
+ "brief",
8882
+ "briefly",
8883
+ "bs",
8884
+ "bt",
8885
+ "bu",
8886
+ "but",
8887
+ "bx",
8888
+ "by",
8889
+ "c",
8890
+ "c1",
8891
+ "c2",
8892
+ "c3",
8893
+ "ca",
8894
+ "call",
8895
+ "came",
8896
+ "can",
8897
+ "cannot",
8898
+ "cant",
8899
+ "can't",
8900
+ "cause",
8901
+ "causes",
8902
+ "cc",
8903
+ "cd",
8904
+ "ce",
8905
+ "certain",
8906
+ "certainly",
8907
+ "cf",
8908
+ "cg",
8909
+ "ch",
8910
+ "changes",
8911
+ "ci",
8912
+ "cit",
8913
+ "cj",
8914
+ "cl",
8915
+ "clearly",
8916
+ "cm",
8917
+ "c'mon",
8918
+ "cn",
8919
+ "co",
8920
+ "com",
8921
+ "come",
8922
+ "comes",
8923
+ "con",
8924
+ "concerning",
8925
+ "consequently",
8926
+ "consider",
8927
+ "considering",
8928
+ "contain",
8929
+ "containing",
8930
+ "contains",
8931
+ "corresponding",
8932
+ "could",
8933
+ "couldn",
8934
+ "couldnt",
8935
+ "couldn't",
8936
+ "course",
8937
+ "cp",
8938
+ "cq",
8939
+ "cr",
8940
+ "cry",
8941
+ "cs",
8942
+ "c's",
8943
+ "ct",
8944
+ "cu",
8945
+ "currently",
8946
+ "cv",
8947
+ "cx",
8948
+ "cy",
8949
+ "cz",
8950
+ "d",
8951
+ "d2",
8952
+ "da",
8953
+ "date",
8954
+ "dc",
8955
+ "dd",
8956
+ "de",
8957
+ "definitely",
8958
+ "describe",
8959
+ "described",
8960
+ "despite",
8961
+ "detail",
8962
+ "df",
8963
+ "di",
8964
+ "did",
8965
+ "didn",
8966
+ "didn't",
8967
+ "different",
8968
+ "dj",
8969
+ "dk",
8970
+ "dl",
8971
+ "do",
8972
+ "does",
8973
+ "doesn",
8974
+ "doesn't",
8975
+ "doing",
8976
+ "don",
8977
+ "done",
8978
+ "don't",
8979
+ "down",
8980
+ "downwards",
8981
+ "dp",
8982
+ "dr",
8983
+ "ds",
8984
+ "dt",
8985
+ "du",
8986
+ "due",
8987
+ "during",
8988
+ "dx",
8989
+ "dy",
8990
+ "e",
8991
+ "e2",
8992
+ "e3",
8993
+ "ea",
8994
+ "each",
8995
+ "ec",
8996
+ "ed",
8997
+ "edu",
8998
+ "ee",
8999
+ "ef",
9000
+ "effect",
9001
+ "eg",
9002
+ "ei",
9003
+ "eight",
9004
+ "eighty",
9005
+ "either",
9006
+ "ej",
9007
+ "el",
9008
+ "eleven",
9009
+ "else",
9010
+ "elsewhere",
9011
+ "em",
9012
+ "empty",
9013
+ "en",
9014
+ "end",
9015
+ "ending",
9016
+ "enough",
9017
+ "entirely",
9018
+ "eo",
9019
+ "ep",
9020
+ "eq",
9021
+ "er",
9022
+ "es",
9023
+ "especially",
9024
+ "est",
9025
+ "et",
9026
+ "et-al",
9027
+ "etc",
9028
+ "eu",
9029
+ "ev",
9030
+ "even",
9031
+ "ever",
9032
+ "every",
9033
+ "everybody",
9034
+ "everyone",
9035
+ "everything",
9036
+ "everywhere",
9037
+ "ex",
9038
+ "exactly",
9039
+ "example",
9040
+ "except",
9041
+ "ey",
9042
+ "f",
9043
+ "f2",
9044
+ "fa",
9045
+ "far",
9046
+ "fc",
9047
+ "few",
9048
+ "ff",
9049
+ "fi",
9050
+ "fifteen",
9051
+ "fifth",
9052
+ "fify",
9053
+ "fill",
9054
+ "find",
9055
+ "fire",
9056
+ "first",
9057
+ "five",
9058
+ "fix",
9059
+ "fj",
9060
+ "fl",
9061
+ "fn",
9062
+ "fo",
9063
+ "followed",
9064
+ "following",
9065
+ "follows",
9066
+ "for",
9067
+ "former",
9068
+ "formerly",
9069
+ "forth",
9070
+ "forty",
9071
+ "found",
9072
+ "four",
9073
+ "fr",
9074
+ "from",
9075
+ "front",
9076
+ "node:fs",
9077
+ "ft",
9078
+ "fu",
9079
+ "full",
9080
+ "further",
9081
+ "furthermore",
9082
+ "fy",
9083
+ "g",
9084
+ "ga",
9085
+ "gave",
9086
+ "ge",
9087
+ "get",
9088
+ "gets",
9089
+ "getting",
9090
+ "gi",
9091
+ "give",
9092
+ "given",
9093
+ "gives",
9094
+ "giving",
9095
+ "gj",
9096
+ "gl",
9097
+ "go",
9098
+ "goes",
9099
+ "going",
9100
+ "gone",
9101
+ "got",
9102
+ "gotten",
9103
+ "gr",
9104
+ "greetings",
9105
+ "gs",
9106
+ "gy",
9107
+ "h",
9108
+ "h2",
9109
+ "h3",
9110
+ "had",
9111
+ "hadn",
9112
+ "hadn't",
9113
+ "happens",
9114
+ "hardly",
9115
+ "has",
9116
+ "hasn",
9117
+ "hasnt",
9118
+ "hasn't",
9119
+ "have",
9120
+ "haven",
9121
+ "haven't",
9122
+ "having",
9123
+ "he",
9124
+ "hed",
9125
+ "he'd",
9126
+ "he'll",
9127
+ "hello",
9128
+ "help",
9129
+ "hence",
9130
+ "her",
9131
+ "here",
9132
+ "hereafter",
9133
+ "hereby",
9134
+ "herein",
9135
+ "heres",
9136
+ "here's",
9137
+ "hereupon",
9138
+ "hers",
9139
+ "herself",
9140
+ "hes",
9141
+ "he's",
9142
+ "hh",
9143
+ "hi",
9144
+ "hid",
9145
+ "him",
9146
+ "himself",
9147
+ "his",
9148
+ "hither",
9149
+ "hj",
9150
+ "ho",
9151
+ "home",
9152
+ "hopefully",
9153
+ "how",
9154
+ "howbeit",
9155
+ "however",
9156
+ "how's",
9157
+ "hr",
9158
+ "hs",
9159
+ "http",
9160
+ "hu",
9161
+ "hundred",
9162
+ "hy",
9163
+ "i",
9164
+ "i2",
9165
+ "i3",
9166
+ "i4",
9167
+ "i6",
9168
+ "i7",
9169
+ "i8",
9170
+ "ia",
9171
+ "ib",
9172
+ "ibid",
9173
+ "ic",
9174
+ "id",
9175
+ "i'd",
9176
+ "ie",
9177
+ "if",
9178
+ "ig",
9179
+ "ignored",
9180
+ "ih",
9181
+ "ii",
9182
+ "ij",
9183
+ "il",
9184
+ "i'll",
9185
+ "im",
9186
+ "i'm",
9187
+ "immediate",
9188
+ "immediately",
9189
+ "importance",
9190
+ "important",
9191
+ "in",
9192
+ "inasmuch",
9193
+ "inc",
9194
+ "indeed",
9195
+ "index",
9196
+ "indicate",
9197
+ "indicated",
9198
+ "indicates",
9199
+ "information",
9200
+ "inner",
9201
+ "insofar",
9202
+ "instead",
9203
+ "interest",
9204
+ "into",
9205
+ "invention",
9206
+ "inward",
9207
+ "io",
9208
+ "ip",
9209
+ "iq",
9210
+ "ir",
9211
+ "is",
9212
+ "isn",
9213
+ "isn't",
9214
+ "it",
9215
+ "itd",
9216
+ "it'd",
9217
+ "it'll",
9218
+ "its",
9219
+ "it's",
9220
+ "itself",
9221
+ "iv",
9222
+ "i've",
9223
+ "ix",
9224
+ "iy",
9225
+ "iz",
9226
+ "j",
9227
+ "jj",
9228
+ "jr",
9229
+ "js",
9230
+ "jt",
9231
+ "ju",
9232
+ "just",
9233
+ "k",
9234
+ "ke",
9235
+ "keep",
9236
+ "keeps",
9237
+ "kept",
9238
+ "kg",
9239
+ "kj",
9240
+ "km",
9241
+ "know",
9242
+ "known",
9243
+ "knows",
9244
+ "ko",
9245
+ "l",
9246
+ "l2",
9247
+ "la",
9248
+ "largely",
9249
+ "last",
9250
+ "lately",
9251
+ "later",
9252
+ "latter",
9253
+ "latterly",
9254
+ "lb",
9255
+ "lc",
9256
+ "le",
9257
+ "least",
9258
+ "les",
9259
+ "less",
9260
+ "lest",
9261
+ "let",
9262
+ "lets",
9263
+ "let's",
9264
+ "lf",
9265
+ "like",
9266
+ "liked",
9267
+ "likely",
9268
+ "line",
9269
+ "little",
9270
+ "lj",
9271
+ "ll",
9272
+ "ll",
9273
+ "ln",
9274
+ "lo",
9275
+ "look",
9276
+ "looking",
9277
+ "looks",
9278
+ "los",
9279
+ "lr",
9280
+ "ls",
9281
+ "lt",
9282
+ "ltd",
9283
+ "m",
9284
+ "m2",
9285
+ "ma",
9286
+ "made",
9287
+ "mainly",
9288
+ "make",
9289
+ "makes",
9290
+ "many",
9291
+ "may",
9292
+ "maybe",
9293
+ "me",
9294
+ "mean",
9295
+ "means",
9296
+ "meantime",
9297
+ "meanwhile",
9298
+ "merely",
9299
+ "mg",
9300
+ "might",
9301
+ "mightn",
9302
+ "mightn't",
9303
+ "mill",
9304
+ "million",
9305
+ "mine",
9306
+ "miss",
9307
+ "ml",
9308
+ "mn",
9309
+ "mo",
9310
+ "more",
9311
+ "moreover",
9312
+ "most",
9313
+ "mostly",
9314
+ "move",
9315
+ "mr",
9316
+ "mrs",
9317
+ "ms",
9318
+ "mt",
9319
+ "mu",
9320
+ "much",
9321
+ "mug",
9322
+ "must",
9323
+ "mustn",
9324
+ "mustn't",
9325
+ "my",
9326
+ "myself",
9327
+ "model",
9328
+ "n",
9329
+ "n2",
9330
+ "na",
9331
+ "name",
9332
+ "namely",
9333
+ "nay",
9334
+ "nc",
9335
+ "nd",
9336
+ "ne",
9337
+ "near",
9338
+ "nearly",
9339
+ "necessarily",
9340
+ "necessary",
9341
+ "need",
9342
+ "needn",
9343
+ "needn't",
9344
+ "needs",
9345
+ "neither",
9346
+ "never",
9347
+ "nevertheless",
9348
+ "new",
9349
+ "next",
9350
+ "ng",
9351
+ "ni",
9352
+ "nine",
9353
+ "ninety",
9354
+ "nj",
9355
+ "nl",
9356
+ "nn",
9357
+ "no",
9358
+ "nobody",
9359
+ "non",
9360
+ "none",
9361
+ "nonetheless",
9362
+ "noone",
9363
+ "nor",
9364
+ "normally",
9365
+ "nos",
9366
+ "not",
9367
+ "noted",
9368
+ "nothing",
9369
+ "novel",
9370
+ "now",
9371
+ "nowhere",
9372
+ "nr",
9373
+ "ns",
9374
+ "nt",
9375
+ "ny",
9376
+ "o",
9377
+ "oa",
9378
+ "ob",
9379
+ "obtain",
9380
+ "obtained",
9381
+ "obviously",
9382
+ "oc",
9383
+ "od",
9384
+ "of",
9385
+ "off",
9386
+ "often",
9387
+ "og",
9388
+ "oh",
9389
+ "oi",
9390
+ "oj",
9391
+ "ok",
9392
+ "okay",
9393
+ "ol",
9394
+ "old",
9395
+ "om",
9396
+ "omitted",
9397
+ "on",
9398
+ "once",
9399
+ "one",
9400
+ "ones",
9401
+ "only",
9402
+ "onto",
9403
+ "oo",
9404
+ "op",
9405
+ "oq",
9406
+ "or",
9407
+ "ord",
9408
+ "os",
9409
+ "ot",
9410
+ "other",
9411
+ "others",
9412
+ "otherwise",
9413
+ "ou",
9414
+ "ought",
9415
+ "our",
9416
+ "ours",
9417
+ "ourselves",
9418
+ "out",
9419
+ "outside",
9420
+ "over",
9421
+ "overall",
9422
+ "ow",
9423
+ "owing",
9424
+ "own",
9425
+ "ox",
9426
+ "oz",
9427
+ "p",
9428
+ "p1",
9429
+ "p2",
9430
+ "p3",
9431
+ "page",
9432
+ "pagecount",
9433
+ "pages",
9434
+ "par",
9435
+ "part",
9436
+ "particular",
9437
+ "particularly",
9438
+ "pas",
9439
+ "past",
9440
+ "pc",
9441
+ "pd",
9442
+ "pe",
9443
+ "per",
9444
+ "perhaps",
9445
+ "pf",
9446
+ "ph",
9447
+ "pi",
9448
+ "pj",
9449
+ "pk",
9450
+ "pl",
9451
+ "placed",
9452
+ "please",
9453
+ "plus",
9454
+ "pm",
9455
+ "pn",
9456
+ "po",
9457
+ "poorly",
9458
+ "possible",
9459
+ "possibly",
9460
+ "potentially",
9461
+ "pp",
9462
+ "pq",
9463
+ "pr",
9464
+ "predominantly",
9465
+ "present",
9466
+ "presumably",
9467
+ "previously",
9468
+ "primarily",
9469
+ "probably",
9470
+ "promptly",
9471
+ "proud",
9472
+ "provides",
9473
+ "ps",
9474
+ "pt",
9475
+ "pu",
9476
+ "put",
9477
+ "py",
9478
+ "q",
9479
+ "qj",
9480
+ "qu",
9481
+ "que",
9482
+ "quickly",
9483
+ "quite",
9484
+ "qv",
9485
+ "r",
9486
+ "r2",
9487
+ "ra",
9488
+ "ran",
9489
+ "rather",
9490
+ "rc",
9491
+ "rd",
9492
+ "re",
9493
+ "readily",
9494
+ "really",
9495
+ "reasonably",
9496
+ "recent",
9497
+ "recently",
9498
+ "ref",
9499
+ "refs",
9500
+ "regarding",
9501
+ "regardless",
9502
+ "regards",
9503
+ "related",
9504
+ "relatively",
9505
+ "research",
9506
+ "research-articl",
9507
+ "respectively",
9508
+ "resulted",
9509
+ "resulting",
9510
+ "results",
9511
+ "rf",
9512
+ "rh",
9513
+ "ri",
9514
+ "right",
9515
+ "rj",
9516
+ "rl",
9517
+ "rm",
9518
+ "rn",
9519
+ "ro",
9520
+ "rq",
9521
+ "rr",
9522
+ "rs",
9523
+ "rt",
9524
+ "ru",
9525
+ "run",
9526
+ "rv",
9527
+ "ry",
9528
+ "s",
9529
+ "s2",
9530
+ "sa",
9531
+ "said",
9532
+ "same",
9533
+ "saw",
9534
+ "say",
9535
+ "saying",
9536
+ "says",
9537
+ "sc",
9538
+ "sd",
9539
+ "se",
9540
+ "sec",
9541
+ "second",
9542
+ "secondly",
9543
+ "section",
9544
+ "see",
9545
+ "seeing",
9546
+ "seem",
9547
+ "seemed",
9548
+ "seeming",
9549
+ "seems",
9550
+ "seen",
9551
+ "self",
9552
+ "selves",
9553
+ "sensible",
9554
+ "sent",
9555
+ "serious",
9556
+ "seriously",
9557
+ "seven",
9558
+ "several",
9559
+ "sf",
9560
+ "shall",
9561
+ "shan",
9562
+ "shan't",
9563
+ "she",
9564
+ "shed",
9565
+ "she'd",
9566
+ "she'll",
9567
+ "shes",
9568
+ "she's",
9569
+ "should",
9570
+ "shouldn",
9571
+ "shouldn't",
9572
+ "should've",
9573
+ "show",
9574
+ "showed",
9575
+ "shown",
9576
+ "showns",
9577
+ "shows",
9578
+ "si",
9579
+ "side",
9580
+ "significant",
9581
+ "significantly",
9582
+ "similar",
9583
+ "similarly",
9584
+ "since",
9585
+ "sincere",
9586
+ "six",
9587
+ "sixty",
9588
+ "sj",
9589
+ "sl",
9590
+ "slightly",
9591
+ "sm",
9592
+ "sn",
9593
+ "so",
9594
+ "some",
9595
+ "somebody",
9596
+ "somehow",
9597
+ "someone",
9598
+ "somethan",
9599
+ "something",
9600
+ "sometime",
9601
+ "sometimes",
9602
+ "somewhat",
9603
+ "somewhere",
9604
+ "soon",
9605
+ "sorry",
9606
+ "sp",
9607
+ "specifically",
9608
+ "specified",
9609
+ "specify",
9610
+ "specifying",
9611
+ "sq",
9612
+ "sr",
9613
+ "ss",
9614
+ "st",
9615
+ "still",
9616
+ "stop",
9617
+ "strongly",
9618
+ "sub",
9619
+ "substantially",
9620
+ "successfully",
9621
+ "such",
9622
+ "sufficiently",
9623
+ "suggest",
9624
+ "sup",
9625
+ "sure",
9626
+ "sy",
9627
+ "system",
9628
+ "sz",
9629
+ "t",
9630
+ "t1",
9631
+ "t2",
9632
+ "t3",
9633
+ "take",
9634
+ "taken",
9635
+ "taking",
9636
+ "tb",
9637
+ "tc",
9638
+ "td",
9639
+ "te",
9640
+ "tell",
9641
+ "ten",
9642
+ "tends",
9643
+ "tf",
9644
+ "th",
9645
+ "than",
9646
+ "thank",
9647
+ "thanks",
9648
+ "thanx",
9649
+ "that",
9650
+ "that'll",
9651
+ "thats",
9652
+ "that's",
9653
+ "that've",
9654
+ "the",
9655
+ "their",
9656
+ "theirs",
9657
+ "them",
9658
+ "themselves",
9659
+ "then",
9660
+ "thence",
9661
+ "there",
9662
+ "thereafter",
9663
+ "thereby",
9664
+ "thered",
9665
+ "therefore",
9666
+ "therein",
9667
+ "there'll",
9668
+ "thereof",
9669
+ "therere",
9670
+ "theres",
9671
+ "there's",
9672
+ "thereto",
9673
+ "thereupon",
9674
+ "there've",
9675
+ "these",
9676
+ "they",
9677
+ "theyd",
9678
+ "they'd",
9679
+ "they'll",
9680
+ "theyre",
9681
+ "they're",
9682
+ "they've",
9683
+ "thickv",
9684
+ "thin",
9685
+ "think",
9686
+ "third",
9687
+ "this",
9688
+ "thorough",
9689
+ "thoroughly",
9690
+ "those",
9691
+ "thou",
9692
+ "though",
9693
+ "thoughh",
9694
+ "thousand",
9695
+ "three",
9696
+ "throug",
9697
+ "through",
9698
+ "throughout",
9699
+ "thru",
9700
+ "thus",
9701
+ "ti",
9702
+ "til",
9703
+ "tip",
9704
+ "tj",
9705
+ "tl",
9706
+ "tm",
9707
+ "tn",
9708
+ "to",
9709
+ "together",
9710
+ "too",
9711
+ "took",
9712
+ "top",
9713
+ "toward",
9714
+ "towards",
9715
+ "tp",
9716
+ "tq",
9717
+ "tr",
9718
+ "tried",
9719
+ "tries",
9720
+ "truly",
9721
+ "try",
9722
+ "trying",
9723
+ "ts",
9724
+ "t's",
9725
+ "tt",
9726
+ "tv",
9727
+ "twelve",
9728
+ "twenty",
9729
+ "twice",
9730
+ "two",
9731
+ "tx",
9732
+ "u",
9733
+ "u201d",
9734
+ "ue",
9735
+ "ui",
9736
+ "uj",
9737
+ "uk",
9738
+ "um",
9739
+ "un",
9740
+ "under",
9741
+ "unfortunately",
9742
+ "unless",
9743
+ "unlike",
9744
+ "unlikely",
9745
+ "until",
9746
+ "unto",
9747
+ "uo",
9748
+ "up",
9749
+ "upon",
9750
+ "ups",
9751
+ "ur",
9752
+ "us",
9753
+ "use",
9754
+ "used",
9755
+ "useful",
9756
+ "usefully",
9757
+ "usefulness",
9758
+ "uses",
9759
+ "using",
9760
+ "usually",
9761
+ "ut",
9762
+ "v",
9763
+ "va",
9764
+ "value",
9765
+ "various",
9766
+ "vd",
9767
+ "ve",
9768
+ "ve",
9769
+ "very",
9770
+ "via",
9771
+ "viz",
9772
+ "vj",
9773
+ "vo",
9774
+ "vol",
9775
+ "vols",
9776
+ "volumtype",
9777
+ "vq",
9778
+ "vs",
9779
+ "vt",
9780
+ "vu",
9781
+ "w",
9782
+ "wa",
9783
+ "want",
9784
+ "wants",
9785
+ "was",
9786
+ "wasn",
9787
+ "wasnt",
9788
+ "wasn't",
9789
+ "way",
9790
+ "we",
9791
+ "wed",
9792
+ "we'd",
9793
+ "welcome",
9794
+ "well",
9795
+ "we'll",
9796
+ "well-b",
9797
+ "went",
9798
+ "were",
9799
+ "we're",
9800
+ "weren",
9801
+ "werent",
9802
+ "weren't",
9803
+ "we've",
9804
+ "what",
9805
+ "whatever",
9806
+ "what'll",
9807
+ "whats",
9808
+ "what's",
9809
+ "when",
9810
+ "whence",
9811
+ "whenever",
9812
+ "when's",
9813
+ "where",
9814
+ "whereafter",
9815
+ "whereas",
9816
+ "whereby",
9817
+ "wherein",
9818
+ "wheres",
9819
+ "where's",
9820
+ "whereupon",
9821
+ "wherever",
9822
+ "whether",
9823
+ "which",
9824
+ "while",
9825
+ "whim",
9826
+ "whither",
9827
+ "who",
9828
+ "whod",
9829
+ "whoever",
9830
+ "whole",
9831
+ "who'll",
9832
+ "whom",
9833
+ "whomever",
9834
+ "whos",
9835
+ "who's",
9836
+ "whose",
9837
+ "why",
9838
+ "why's",
9839
+ "wi",
9840
+ "widely",
9841
+ "will",
9842
+ "willing",
9843
+ "wish",
9844
+ "with",
9845
+ "within",
9846
+ "without",
9847
+ "wo",
9848
+ "won",
9849
+ "wonder",
9850
+ "wont",
9851
+ "won't",
9852
+ "words",
9853
+ "world",
9854
+ "would",
9855
+ "wouldn",
9856
+ "wouldnt",
9857
+ "wouldn't",
9858
+ "www",
9859
+ "x",
9860
+ "x1",
9861
+ "x2",
9862
+ "x3",
9863
+ "xf",
9864
+ "xi",
9865
+ "xj",
9866
+ "xk",
9867
+ "xl",
9868
+ "xn",
9869
+ "xo",
9870
+ "xs",
9871
+ "xt",
9872
+ "xv",
9873
+ "xx",
9874
+ "y",
9875
+ "y2",
9876
+ "yes",
9877
+ "yet",
9878
+ "yj",
9879
+ "yl",
9880
+ "you",
9881
+ "youd",
9882
+ "you'd",
9883
+ "you'll",
9884
+ "your",
9885
+ "youre",
9886
+ "you're",
9887
+ "yours",
9888
+ "yourself",
9889
+ "yourselves",
9890
+ "you've",
9891
+ "yr",
9892
+ "ys",
9893
+ "yt",
9894
+ "z",
9895
+ "zero",
9896
+ "zi",
9897
+ "zz",
9898
+ "task"
9899
+ ]);
9900
+
9901
+ // dsp/eval.ts
9902
+ function filterTokens(tokens, exclusions) {
9903
+ return tokens.filter((token) => !exclusions.has(token));
9904
+ }
9905
+ function countTokens(tokens) {
9906
+ const counter = {};
9907
+ for (const token of tokens) {
9908
+ counter[token] = (counter[token] || 0) + 1;
9909
+ }
9910
+ return counter;
9911
+ }
9912
+ function normalizeText(s) {
9913
+ s = s.normalize("NFD");
9914
+ s = s.replace(/\b(a|an|the)\b/g, " ");
9915
+ s = s.split(/\s+/).join(" ");
9916
+ s = s.replace(/[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/g, "");
9917
+ return s.toLowerCase();
9918
+ }
9919
+ function emScore(prediction, groundTruth) {
9920
+ return normalizeText(prediction) === normalizeText(groundTruth);
9921
+ }
9922
+ function f1Score(prediction, groundTruth) {
9923
+ const predictionTokens = normalizeText(prediction).split(" ");
9924
+ const groundTruthTokens = normalizeText(groundTruth).split(" ");
9925
+ const predictionCounts = countTokens(predictionTokens);
9926
+ const groundTruthCounts = countTokens(groundTruthTokens);
9927
+ let numSame = 0;
9928
+ for (const token in predictionCounts) {
9929
+ const v1 = predictionCounts[token] ?? 0;
9930
+ const v2 = groundTruthCounts[token] ?? 0;
9931
+ numSame += Math.min(v1, v2);
9932
+ }
9933
+ if (numSame === 0) {
9934
+ return 0;
9935
+ }
9936
+ const precision = numSame / predictionTokens.length;
9937
+ const recall = numSame / groundTruthTokens.length;
9938
+ return 2 * precision * recall / (precision + recall);
9939
+ }
9940
+ function novelF1ScoreOptimized(history, prediction, groundTruth, returnRecall = false) {
9941
+ const historyTokens = normalizeText(history).split(" ");
9942
+ let predictionTokens = normalizeText(prediction).split(" ");
9943
+ let groundTruthTokens = normalizeText(groundTruth).split(" ");
9944
+ const exclusions = /* @__PURE__ */ new Set([...stopwords, ...historyTokens]);
9945
+ predictionTokens = filterTokens(predictionTokens, exclusions);
9946
+ groundTruthTokens = filterTokens(groundTruthTokens, exclusions);
9947
+ const numSame = 0;
9948
+ const precision = numSame / predictionTokens.length;
9949
+ const recall = numSame / groundTruthTokens.length;
9950
+ const f1 = 2 * precision * recall / (precision + recall);
9951
+ return returnRecall ? recall : f1;
9952
+ }
9953
+ var AxEvalUtil = {
9954
+ emScore,
9955
+ f1Score,
9956
+ novelF1ScoreOptimized
9957
+ };
9958
+
9959
+ // ../../node_modules/uuid/dist/esm-node/rng.js
9960
+ var import_crypto2 = __toESM(require("crypto"));
9961
+ var rnds8Pool = new Uint8Array(256);
9962
+ var poolPtr = rnds8Pool.length;
9963
+ function rng() {
9964
+ if (poolPtr > rnds8Pool.length - 16) {
9965
+ import_crypto2.default.randomFillSync(rnds8Pool);
9966
+ poolPtr = 0;
9967
+ }
9968
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
9969
+ }
9970
+
9971
+ // ../../node_modules/uuid/dist/esm-node/stringify.js
9972
+ var byteToHex = [];
9973
+ for (let i = 0; i < 256; ++i) {
9974
+ byteToHex.push((i + 256).toString(16).slice(1));
9975
+ }
9976
+ function unsafeStringify(arr, offset = 0) {
9977
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
9978
+ }
9979
+
9980
+ // ../../node_modules/uuid/dist/esm-node/native.js
9981
+ var import_crypto3 = __toESM(require("crypto"));
9982
+ var native_default = {
9983
+ randomUUID: import_crypto3.default.randomUUID
9984
+ };
9985
+
9986
+ // ../../node_modules/uuid/dist/esm-node/v4.js
9987
+ function v4(options, buf, offset) {
9988
+ if (native_default.randomUUID && !buf && !options) {
9989
+ return native_default.randomUUID();
9990
+ }
9991
+ options = options || {};
9992
+ const rnds = options.random || (options.rng || rng)();
9993
+ rnds[6] = rnds[6] & 15 | 64;
9994
+ rnds[8] = rnds[8] & 63 | 128;
9995
+ if (buf) {
9996
+ offset = offset || 0;
9997
+ for (let i = 0; i < 16; ++i) {
9998
+ buf[offset + i] = rnds[i];
9999
+ }
10000
+ return buf;
10001
+ }
10002
+ return unsafeStringify(rnds);
10003
+ }
10004
+ var v4_default = v4;
10005
+
8628
10006
  // mcp/client.ts
8629
10007
  var colorLog7 = new ColorLog();
8630
10008
  var AxMCPClient = class {
@@ -8633,13 +10011,13 @@ var AxMCPClient = class {
8633
10011
  this.options = options;
8634
10012
  }
8635
10013
  functions = [];
8636
- requestId = 0;
10014
+ activeRequests = /* @__PURE__ */ new Map();
8637
10015
  capabilities = {};
8638
10016
  async init() {
8639
10017
  if ("connect" in this.transport) {
8640
10018
  await this.transport.connect?.();
8641
10019
  }
8642
- const res = await this.sendRequest("initialize", {
10020
+ const { result: res } = await this.sendRequest("initialize", {
8643
10021
  protocolVersion: "2024-11-05",
8644
10022
  capabilities: {
8645
10023
  roots: { listChanged: true },
@@ -8650,6 +10028,12 @@ var AxMCPClient = class {
8650
10028
  version: "1.0.0"
8651
10029
  }
8652
10030
  });
10031
+ const expectedProtocolVersion = "2024-11-05";
10032
+ if (res.protocolVersion !== expectedProtocolVersion) {
10033
+ throw new Error(
10034
+ `Protocol version mismatch. Expected ${expectedProtocolVersion} but got ${res.protocolVersion}`
10035
+ );
10036
+ }
8653
10037
  if (res.capabilities.tools) {
8654
10038
  this.capabilities.tools = true;
8655
10039
  }
@@ -8659,67 +10043,121 @@ var AxMCPClient = class {
8659
10043
  if (res.capabilities.prompts) {
8660
10044
  this.capabilities.prompts = true;
8661
10045
  }
8662
- await this.sendNotification("initialized");
10046
+ await this.sendNotification("notifications/initialized");
8663
10047
  await this.discoverFunctions();
8664
10048
  }
8665
10049
  async discoverFunctions() {
8666
10050
  if (!this.capabilities.tools) {
8667
10051
  throw new Error("Tools are not supported");
8668
10052
  }
8669
- const res = await this.sendRequest(
8670
- "tools/list"
8671
- );
8672
- this.functions = res.tools.map(
8673
- (fn) => ({
8674
- name: fn.name,
8675
- description: fn.description,
8676
- parameters: fn.inputSchema,
10053
+ const { result: res } = await this.sendRequest("tools/list");
10054
+ this.functions = res.tools.map((fn) => {
10055
+ const override = this.options.functionOverrides?.find(
10056
+ (o) => o.name === fn.name
10057
+ );
10058
+ const parameters = fn.inputSchema.properties ? {
10059
+ properties: fn.inputSchema.properties,
10060
+ required: fn.inputSchema.required ?? [],
10061
+ type: fn.inputSchema.type
10062
+ } : void 0;
10063
+ return {
10064
+ name: override?.updates.name ?? fn.name,
10065
+ description: override?.updates.description ?? fn.description,
10066
+ parameters,
8677
10067
  func: async (args) => {
8678
- const result = await this.sendRequest("tools/call", { name: fn.name, arguments: args });
10068
+ const { result } = await this.sendRequest("tools/call", { name: fn.name, arguments: args });
8679
10069
  return result;
8680
10070
  }
8681
- })
8682
- );
10071
+ };
10072
+ });
10073
+ if (this.options.debug) {
10074
+ console.log(
10075
+ colorLog7.yellow(`> Discovered ${this.functions.length} functions:`)
10076
+ );
10077
+ for (const fn of this.functions) {
10078
+ console.log(colorLog7.yellow(` - ${fn.name}: ${fn.description}`));
10079
+ }
10080
+ }
8683
10081
  }
8684
- async ping() {
8685
- await this.sendRequest("ping");
10082
+ async ping(timeout = 3e3) {
10083
+ const pingPromise = this.sendRequest("ping");
10084
+ const timeoutPromise = new Promise(
10085
+ (_, reject) => setTimeout(
10086
+ () => reject(new Error("Ping response timeout exceeded")),
10087
+ timeout
10088
+ )
10089
+ );
10090
+ const response = await Promise.race([pingPromise, timeoutPromise]);
10091
+ const { result } = response;
10092
+ if (typeof result !== "object" || result === null || Object.keys(result).length !== 0) {
10093
+ throw new Error(`Unexpected ping response: ${JSON.stringify(result)}`);
10094
+ }
8686
10095
  }
8687
10096
  toFunction() {
8688
10097
  return this.functions;
8689
10098
  }
8690
- async sendRequest(method, params) {
10099
+ cancelRequest(id) {
10100
+ if (this.activeRequests.has(id)) {
10101
+ this.sendNotification("notifications/cancelled", {
10102
+ requestId: id,
10103
+ reason: "Client cancelled request"
10104
+ });
10105
+ const entry = this.activeRequests.get(id);
10106
+ if (entry) {
10107
+ entry.reject(new Error(`Request ${id} cancelled`));
10108
+ }
10109
+ this.activeRequests.delete(id);
10110
+ }
10111
+ }
10112
+ async sendRequest(method, params = {}) {
10113
+ const requestId = v4_default();
8691
10114
  const request = {
8692
10115
  jsonrpc: "2.0",
8693
- id: ++this.requestId,
10116
+ id: requestId,
8694
10117
  method,
8695
10118
  params
8696
10119
  };
8697
10120
  if (this.options.debug) {
8698
10121
  console.log(
8699
10122
  colorLog7.blueBright(
8700
- `> Sending request:
10123
+ `> Sending request ${requestId}:
8701
10124
  ${JSON.stringify(request, null, 2)}`
8702
10125
  )
8703
10126
  );
8704
10127
  }
8705
- const res = await this.transport.send(request);
8706
- if (this.options.debug) {
8707
- console.log(
8708
- colorLog7.greenBright(
8709
- `> Received response:
10128
+ const responsePromise = new Promise((resolve, reject) => {
10129
+ this.activeRequests.set(requestId, { reject });
10130
+ this.transport.send(request).then((res) => {
10131
+ this.activeRequests.delete(requestId);
10132
+ if (this.options.debug) {
10133
+ console.log(
10134
+ colorLog7.greenBright(
10135
+ `> Received response for request ${requestId}:
8710
10136
  ${JSON.stringify(res, null, 2)}`
8711
- )
8712
- );
8713
- }
8714
- if ("error" in res) {
8715
- throw new Error(`RPC Error ${res.error.code}: ${res.error.message}`);
8716
- }
8717
- if ("result" in res) {
8718
- return res.result;
8719
- }
8720
- throw new Error("Invalid response no result or error");
10137
+ )
10138
+ );
10139
+ }
10140
+ if (res !== null && typeof res === "object" && "error" in res) {
10141
+ const errorObj = res;
10142
+ reject(
10143
+ new Error(
10144
+ `RPC Error ${errorObj.error.code}: ${errorObj.error.message}`
10145
+ )
10146
+ );
10147
+ } else if (res !== null && typeof res === "object" && "result" in res) {
10148
+ resolve({ result: res.result });
10149
+ } else {
10150
+ reject(new Error("Invalid response no result or error"));
10151
+ }
10152
+ }).catch((err) => {
10153
+ this.activeRequests.delete(requestId);
10154
+ reject(err);
10155
+ });
10156
+ });
10157
+ const { result } = await responsePromise;
10158
+ return { id: requestId, result };
8721
10159
  }
8722
- async sendNotification(method, params) {
10160
+ async sendNotification(method, params = {}) {
8723
10161
  const notification = {
8724
10162
  jsonrpc: "2.0",
8725
10163
  method,
@@ -9014,7 +10452,7 @@ var AxRAG = class extends AxChainOfThought {
9014
10452
  options
9015
10453
  );
9016
10454
  const val = await this.queryFn(query);
9017
- context = axStringUtil.dedup([...context, val]);
10455
+ context = AxStringUtil.dedup([...context, val]);
9018
10456
  }
9019
10457
  return super.forward(ai, { context, question }, options);
9020
10458
  }
@@ -9076,6 +10514,7 @@ var AxRAG = class extends AxChainOfThought {
9076
10514
  AxDefaultResultReranker,
9077
10515
  AxDockerSession,
9078
10516
  AxEmbeddingAdapter,
10517
+ AxEvalUtil,
9079
10518
  AxFunctionError,
9080
10519
  AxFunctionProcessor,
9081
10520
  AxGen,
@@ -9099,6 +10538,47 @@ var AxRAG = class extends AxChainOfThought {
9099
10538
  AxSimpleClassifier,
9100
10539
  AxSimpleClassifierClass,
9101
10540
  AxSpanKindValues,
9102
- AxTestPrompt
10541
+ AxStringUtil,
10542
+ AxTestPrompt,
10543
+ axAIAnthropicDefaultConfig,
10544
+ axAIAzureOpenAIBestConfig,
10545
+ axAIAzureOpenAICreativeConfig,
10546
+ axAIAzureOpenAIDefaultConfig,
10547
+ axAIAzureOpenAIFastConfig,
10548
+ axAICohereCreativeConfig,
10549
+ axAICohereDefaultConfig,
10550
+ axAIDeepSeekCodeConfig,
10551
+ axAIDeepSeekDefaultConfig,
10552
+ axAIGoogleGeminiDefaultConfig,
10553
+ axAIGoogleGeminiDefaultCreativeConfig,
10554
+ axAIHuggingFaceCreativeConfig,
10555
+ axAIHuggingFaceDefaultConfig,
10556
+ axAIMistralBestConfig,
10557
+ axAIMistralDefaultConfig,
10558
+ axAIOllamaDefaultConfig,
10559
+ axAIOllamaDefaultCreativeConfig,
10560
+ axAIOpenAIBestConfig,
10561
+ axAIOpenAICreativeConfig,
10562
+ axAIOpenAIDefaultConfig,
10563
+ axAIOpenAIFastConfig,
10564
+ axAIRekaBestConfig,
10565
+ axAIRekaCreativeConfig,
10566
+ axAIRekaDefaultConfig,
10567
+ axAIRekaFastConfig,
10568
+ axAITogetherDefaultConfig,
10569
+ axBaseAIDefaultConfig,
10570
+ axBaseAIDefaultCreativeConfig,
10571
+ axModelInfoAnthropic,
10572
+ axModelInfoCohere,
10573
+ axModelInfoDeepSeek,
10574
+ axModelInfoGoogleGemini,
10575
+ axModelInfoGroq,
10576
+ axModelInfoHuggingFace,
10577
+ axModelInfoMistral,
10578
+ axModelInfoOpenAI,
10579
+ axModelInfoReka,
10580
+ axModelInfoTogether,
10581
+ axSpanAttributes,
10582
+ axSpanEvents
9103
10583
  });
9104
10584
  //# sourceMappingURL=index.cjs.map