@ax-llm/ax 11.0.48 → 11.0.49
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 +158 -78
- package/index.cjs.map +1 -1
- package/index.d.cts +18 -12
- package/index.d.ts +18 -12
- package/index.js +158 -78
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1817,6 +1817,22 @@ function mapFinishReason(stopReason) {
|
|
|
1817
1817
|
}
|
|
1818
1818
|
}
|
|
1819
1819
|
|
|
1820
|
+
// dsp/modelinfo.ts
|
|
1821
|
+
function getModelInfo({
|
|
1822
|
+
model,
|
|
1823
|
+
modelInfo,
|
|
1824
|
+
models
|
|
1825
|
+
}) {
|
|
1826
|
+
const modelEntry = models?.find((v) => v.key === model);
|
|
1827
|
+
const mappedModel = modelEntry && "model" in modelEntry ? modelEntry.model : model;
|
|
1828
|
+
const exactMatch = modelInfo.find((v) => v.name === model);
|
|
1829
|
+
if (exactMatch) return exactMatch;
|
|
1830
|
+
const normalizedName = mappedModel.replace(/^(anthropic\.|openai\.)/, "").replace(/-latest$/, "").replace(/-\d{8}$/, "").replace(/-v\d+:\d+$/, "").replace(/@\d{8}$/, "").replace(/-\d{2,}(-[a-zA-Z0-9-]+)?$/, "").replace(/-v\d+@\d{8}$/, "").replace(/-v\d+$/, "");
|
|
1831
|
+
const normalizedMatch = modelInfo.find((v) => v.name === normalizedName);
|
|
1832
|
+
if (normalizedMatch) return normalizedMatch;
|
|
1833
|
+
return null;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1820
1836
|
// ai/openai/types.ts
|
|
1821
1837
|
var AxAIOpenAIModel = /* @__PURE__ */ ((AxAIOpenAIModel2) => {
|
|
1822
1838
|
AxAIOpenAIModel2["O1"] = "o1";
|
|
@@ -2286,15 +2302,7 @@ var AxAIOpenAIBase = class extends AxBaseAI {
|
|
|
2286
2302
|
embedModel: config.embedModel
|
|
2287
2303
|
},
|
|
2288
2304
|
options,
|
|
2289
|
-
supportFor
|
|
2290
|
-
const modelInf = modelInfo.find((m) => m.name === model);
|
|
2291
|
-
return {
|
|
2292
|
-
functions: true,
|
|
2293
|
-
streaming: true,
|
|
2294
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
2295
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false
|
|
2296
|
-
};
|
|
2297
|
-
}),
|
|
2305
|
+
supportFor,
|
|
2298
2306
|
models
|
|
2299
2307
|
});
|
|
2300
2308
|
}
|
|
@@ -2304,18 +2312,24 @@ var AxAIOpenAI = class extends AxAIOpenAIBase {
|
|
|
2304
2312
|
apiKey,
|
|
2305
2313
|
config,
|
|
2306
2314
|
options,
|
|
2307
|
-
models
|
|
2315
|
+
models,
|
|
2316
|
+
modelInfo
|
|
2308
2317
|
}) {
|
|
2309
2318
|
if (!apiKey || apiKey === "") {
|
|
2310
2319
|
throw new Error("OpenAI API key not set");
|
|
2311
2320
|
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2321
|
+
modelInfo = [...axModelInfoOpenAI, ...modelInfo ?? []];
|
|
2322
|
+
const supportFor = (model) => {
|
|
2323
|
+
const mi = getModelInfo({
|
|
2324
|
+
model,
|
|
2325
|
+
modelInfo,
|
|
2326
|
+
models
|
|
2327
|
+
});
|
|
2314
2328
|
return {
|
|
2315
2329
|
functions: true,
|
|
2316
2330
|
streaming: true,
|
|
2317
|
-
hasThinkingBudget:
|
|
2318
|
-
hasShowThoughts:
|
|
2331
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
2332
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false
|
|
2319
2333
|
};
|
|
2320
2334
|
};
|
|
2321
2335
|
super({
|
|
@@ -2325,9 +2339,9 @@ var AxAIOpenAI = class extends AxAIOpenAIBase {
|
|
|
2325
2339
|
...config
|
|
2326
2340
|
},
|
|
2327
2341
|
options,
|
|
2328
|
-
modelInfo
|
|
2342
|
+
modelInfo,
|
|
2329
2343
|
models,
|
|
2330
|
-
supportFor
|
|
2344
|
+
supportFor
|
|
2331
2345
|
});
|
|
2332
2346
|
super.setName("OpenAI");
|
|
2333
2347
|
}
|
|
@@ -2346,7 +2360,8 @@ var AxAIAzureOpenAI = class extends AxAIOpenAIBase {
|
|
|
2346
2360
|
version = "api-version=2024-02-15-preview",
|
|
2347
2361
|
config,
|
|
2348
2362
|
options,
|
|
2349
|
-
models
|
|
2363
|
+
models,
|
|
2364
|
+
modelInfo
|
|
2350
2365
|
}) {
|
|
2351
2366
|
if (!apiKey || apiKey === "") {
|
|
2352
2367
|
throw new Error("Azure OpenAPI API key not set");
|
|
@@ -2361,21 +2376,27 @@ var AxAIAzureOpenAI = class extends AxAIOpenAIBase {
|
|
|
2361
2376
|
...axAIAzureOpenAIDefaultConfig(),
|
|
2362
2377
|
...config
|
|
2363
2378
|
};
|
|
2379
|
+
modelInfo = [...axModelInfoOpenAI, ...modelInfo ?? []];
|
|
2380
|
+
const supportFor = (model) => {
|
|
2381
|
+
const mi = getModelInfo({
|
|
2382
|
+
model,
|
|
2383
|
+
modelInfo,
|
|
2384
|
+
models
|
|
2385
|
+
});
|
|
2386
|
+
return {
|
|
2387
|
+
functions: true,
|
|
2388
|
+
streaming: true,
|
|
2389
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
2390
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false
|
|
2391
|
+
};
|
|
2392
|
+
};
|
|
2364
2393
|
super({
|
|
2365
2394
|
apiKey,
|
|
2366
2395
|
config: _config,
|
|
2367
2396
|
options,
|
|
2368
2397
|
models,
|
|
2369
|
-
modelInfo
|
|
2370
|
-
supportFor
|
|
2371
|
-
const modelInf = axModelInfoOpenAI.find((m) => m.name === model);
|
|
2372
|
-
return {
|
|
2373
|
-
functions: true,
|
|
2374
|
-
streaming: true,
|
|
2375
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
2376
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2398
|
+
modelInfo,
|
|
2399
|
+
supportFor
|
|
2379
2400
|
});
|
|
2380
2401
|
const host = resourceName.includes("://") ? resourceName : `https://${resourceName}.openai.azure.com/`;
|
|
2381
2402
|
super.setName("Azure OpenAI");
|
|
@@ -2725,6 +2746,7 @@ function createToolCall(functionCalls) {
|
|
|
2725
2746
|
var AxAIDeepSeekModel = /* @__PURE__ */ ((AxAIDeepSeekModel2) => {
|
|
2726
2747
|
AxAIDeepSeekModel2["DeepSeekChat"] = "deepseek-chat";
|
|
2727
2748
|
AxAIDeepSeekModel2["DeepSeekCoder"] = "deepseek-coder";
|
|
2749
|
+
AxAIDeepSeekModel2["DeepSeekReasoner"] = "deepseek-reasoner";
|
|
2728
2750
|
return AxAIDeepSeekModel2;
|
|
2729
2751
|
})(AxAIDeepSeekModel || {});
|
|
2730
2752
|
|
|
@@ -2733,14 +2755,14 @@ var axModelInfoDeepSeek = [
|
|
|
2733
2755
|
{
|
|
2734
2756
|
name: "deepseek-chat" /* DeepSeekChat */,
|
|
2735
2757
|
currency: "USD",
|
|
2736
|
-
promptTokenCostPer1M: 0.
|
|
2737
|
-
completionTokenCostPer1M:
|
|
2758
|
+
promptTokenCostPer1M: 0.27,
|
|
2759
|
+
completionTokenCostPer1M: 1.1
|
|
2738
2760
|
},
|
|
2739
2761
|
{
|
|
2740
|
-
name: "deepseek-
|
|
2762
|
+
name: "deepseek-reasoner" /* DeepSeekReasoner */,
|
|
2741
2763
|
currency: "USD",
|
|
2742
|
-
promptTokenCostPer1M: 0.
|
|
2743
|
-
completionTokenCostPer1M:
|
|
2764
|
+
promptTokenCostPer1M: 0.55,
|
|
2765
|
+
completionTokenCostPer1M: 2.19
|
|
2744
2766
|
}
|
|
2745
2767
|
];
|
|
2746
2768
|
|
|
@@ -2758,7 +2780,8 @@ var AxAIDeepSeek = class extends AxAIOpenAIBase {
|
|
|
2758
2780
|
apiKey,
|
|
2759
2781
|
config,
|
|
2760
2782
|
options,
|
|
2761
|
-
models
|
|
2783
|
+
models,
|
|
2784
|
+
modelInfo
|
|
2762
2785
|
}) {
|
|
2763
2786
|
if (!apiKey || apiKey === "") {
|
|
2764
2787
|
throw new Error("DeepSeek API key not set");
|
|
@@ -2767,12 +2790,19 @@ var AxAIDeepSeek = class extends AxAIOpenAIBase {
|
|
|
2767
2790
|
...axAIDeepSeekDefaultConfig(),
|
|
2768
2791
|
...config
|
|
2769
2792
|
};
|
|
2793
|
+
modelInfo = [...axModelInfoDeepSeek, ...modelInfo ?? []];
|
|
2770
2794
|
super({
|
|
2771
2795
|
apiKey,
|
|
2772
2796
|
config: _config,
|
|
2773
2797
|
options,
|
|
2774
2798
|
apiURL: "https://api.deepseek.com",
|
|
2775
|
-
modelInfo
|
|
2799
|
+
modelInfo,
|
|
2800
|
+
supportFor: {
|
|
2801
|
+
functions: true,
|
|
2802
|
+
streaming: true,
|
|
2803
|
+
hasThinkingBudget: false,
|
|
2804
|
+
hasShowThoughts: false
|
|
2805
|
+
},
|
|
2776
2806
|
models
|
|
2777
2807
|
});
|
|
2778
2808
|
super.setName("DeepSeek");
|
|
@@ -2785,7 +2815,6 @@ var AxAIGoogleGeminiModel = /* @__PURE__ */ ((AxAIGoogleGeminiModel2) => {
|
|
|
2785
2815
|
AxAIGoogleGeminiModel2["Gemini25Flash"] = "gemini-2.5-flash-preview-04-17";
|
|
2786
2816
|
AxAIGoogleGeminiModel2["Gemini20Flash"] = "gemini-2.0-flash";
|
|
2787
2817
|
AxAIGoogleGeminiModel2["Gemini20FlashLite"] = "gemini-2.0-flash-lite-preview-02-05";
|
|
2788
|
-
AxAIGoogleGeminiModel2["Gemini20FlashThinking"] = "gemini-2.0-flash-thinking-exp-01-21";
|
|
2789
2818
|
AxAIGoogleGeminiModel2["Gemini1Pro"] = "gemini-1.0-pro";
|
|
2790
2819
|
AxAIGoogleGeminiModel2["Gemini15Flash"] = "gemini-1.5-flash";
|
|
2791
2820
|
AxAIGoogleGeminiModel2["Gemini15Flash002"] = "gemini-1.5-flash-002";
|
|
@@ -2861,13 +2890,6 @@ var axModelInfoGoogleGemini = [
|
|
|
2861
2890
|
promptTokenCostPer1M: 0,
|
|
2862
2891
|
completionTokenCostPer1M: 0
|
|
2863
2892
|
},
|
|
2864
|
-
{
|
|
2865
|
-
name: "gemini-2.0-flash-thinking-exp-01-21" /* Gemini20FlashThinking */,
|
|
2866
|
-
currency: "usd",
|
|
2867
|
-
characterIsToken: false,
|
|
2868
|
-
promptTokenCostPer1M: 0,
|
|
2869
|
-
completionTokenCostPer1M: 0
|
|
2870
|
-
},
|
|
2871
2893
|
{
|
|
2872
2894
|
name: "gemini-1.5-flash" /* Gemini15Flash */,
|
|
2873
2895
|
currency: "usd",
|
|
@@ -3070,6 +3092,9 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
3070
3092
|
}
|
|
3071
3093
|
});
|
|
3072
3094
|
}
|
|
3095
|
+
if (this.options?.googleSearch) {
|
|
3096
|
+
tools.push({ google_search: {} });
|
|
3097
|
+
}
|
|
3073
3098
|
if (this.options?.urlContext) {
|
|
3074
3099
|
tools.push({ url_context: {} });
|
|
3075
3100
|
}
|
|
@@ -3274,7 +3299,8 @@ var AxAIGoogleGemini = class extends AxBaseAI {
|
|
|
3274
3299
|
endpointId,
|
|
3275
3300
|
config,
|
|
3276
3301
|
options,
|
|
3277
|
-
models
|
|
3302
|
+
models,
|
|
3303
|
+
modelInfo
|
|
3278
3304
|
}) {
|
|
3279
3305
|
const isVertex = projectId !== void 0 && region !== void 0;
|
|
3280
3306
|
let apiURL;
|
|
@@ -3313,26 +3339,32 @@ var AxAIGoogleGemini = class extends AxBaseAI {
|
|
|
3313
3339
|
apiKey,
|
|
3314
3340
|
options
|
|
3315
3341
|
);
|
|
3342
|
+
modelInfo = [...axModelInfoGoogleGemini, ...modelInfo ?? []];
|
|
3343
|
+
const supportFor = (model) => {
|
|
3344
|
+
const mi = getModelInfo({
|
|
3345
|
+
model,
|
|
3346
|
+
modelInfo,
|
|
3347
|
+
models
|
|
3348
|
+
});
|
|
3349
|
+
return {
|
|
3350
|
+
functions: true,
|
|
3351
|
+
streaming: true,
|
|
3352
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
3353
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false,
|
|
3354
|
+
functionCot: false
|
|
3355
|
+
};
|
|
3356
|
+
};
|
|
3316
3357
|
super(aiImpl, {
|
|
3317
3358
|
name: "GoogleGeminiAI",
|
|
3318
3359
|
apiURL,
|
|
3319
3360
|
headers,
|
|
3320
|
-
modelInfo
|
|
3361
|
+
modelInfo,
|
|
3321
3362
|
defaults: {
|
|
3322
3363
|
model: _config.model,
|
|
3323
3364
|
embedModel: _config.embedModel
|
|
3324
3365
|
},
|
|
3325
3366
|
options,
|
|
3326
|
-
supportFor
|
|
3327
|
-
const modelInf = axModelInfoGoogleGemini.find((m) => m.name === model);
|
|
3328
|
-
return {
|
|
3329
|
-
functions: true,
|
|
3330
|
-
streaming: true,
|
|
3331
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
3332
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false,
|
|
3333
|
-
functionCot: false
|
|
3334
|
-
};
|
|
3335
|
-
},
|
|
3367
|
+
supportFor,
|
|
3336
3368
|
models
|
|
3337
3369
|
});
|
|
3338
3370
|
}
|
|
@@ -3435,7 +3467,8 @@ var AxAIGroq = class extends AxAIOpenAIBase {
|
|
|
3435
3467
|
apiKey,
|
|
3436
3468
|
config,
|
|
3437
3469
|
options,
|
|
3438
|
-
models
|
|
3470
|
+
models,
|
|
3471
|
+
modelInfo
|
|
3439
3472
|
}) {
|
|
3440
3473
|
if (!apiKey || apiKey === "") {
|
|
3441
3474
|
throw new Error("Groq API key not set");
|
|
@@ -3448,13 +3481,21 @@ var AxAIGroq = class extends AxAIOpenAIBase {
|
|
|
3448
3481
|
...options,
|
|
3449
3482
|
streamingUsage: false
|
|
3450
3483
|
};
|
|
3484
|
+
modelInfo = [...axModelInfoGroq, ...modelInfo ?? []];
|
|
3485
|
+
const supportFor = {
|
|
3486
|
+
functions: true,
|
|
3487
|
+
streaming: true,
|
|
3488
|
+
hasThinkingBudget: false,
|
|
3489
|
+
hasShowThoughts: false
|
|
3490
|
+
};
|
|
3451
3491
|
super({
|
|
3452
3492
|
apiKey,
|
|
3453
3493
|
config: _config,
|
|
3454
3494
|
options: _options,
|
|
3455
|
-
modelInfo
|
|
3495
|
+
modelInfo,
|
|
3456
3496
|
apiURL: "https://api.groq.com/openai/v1",
|
|
3457
|
-
models
|
|
3497
|
+
models,
|
|
3498
|
+
supportFor
|
|
3458
3499
|
});
|
|
3459
3500
|
super.setName("Groq");
|
|
3460
3501
|
this.setOptions(_options);
|
|
@@ -3692,7 +3733,8 @@ var AxAIMistral = class extends AxAIOpenAIBase {
|
|
|
3692
3733
|
apiKey,
|
|
3693
3734
|
config,
|
|
3694
3735
|
options,
|
|
3695
|
-
models
|
|
3736
|
+
models,
|
|
3737
|
+
modelInfo
|
|
3696
3738
|
}) {
|
|
3697
3739
|
if (!apiKey || apiKey === "") {
|
|
3698
3740
|
throw new Error("Mistral API key not set");
|
|
@@ -3701,13 +3743,21 @@ var AxAIMistral = class extends AxAIOpenAIBase {
|
|
|
3701
3743
|
...axAIMistralDefaultConfig(),
|
|
3702
3744
|
...config
|
|
3703
3745
|
};
|
|
3746
|
+
modelInfo = [...axModelInfoMistral, ...modelInfo ?? []];
|
|
3747
|
+
const supportFor = {
|
|
3748
|
+
functions: true,
|
|
3749
|
+
streaming: true,
|
|
3750
|
+
hasThinkingBudget: false,
|
|
3751
|
+
hasShowThoughts: false
|
|
3752
|
+
};
|
|
3704
3753
|
super({
|
|
3705
3754
|
apiKey,
|
|
3706
3755
|
config: _config,
|
|
3707
3756
|
options,
|
|
3708
3757
|
apiURL: "https://api.mistral.ai/v1",
|
|
3709
|
-
modelInfo
|
|
3710
|
-
models
|
|
3758
|
+
modelInfo,
|
|
3759
|
+
models,
|
|
3760
|
+
supportFor
|
|
3711
3761
|
});
|
|
3712
3762
|
super.setName("Mistral");
|
|
3713
3763
|
}
|
|
@@ -3742,7 +3792,13 @@ var AxAIOllama = class extends AxAIOpenAIBase {
|
|
|
3742
3792
|
config: _config,
|
|
3743
3793
|
apiURL: url,
|
|
3744
3794
|
models,
|
|
3745
|
-
modelInfo: []
|
|
3795
|
+
modelInfo: [],
|
|
3796
|
+
supportFor: {
|
|
3797
|
+
functions: true,
|
|
3798
|
+
streaming: true,
|
|
3799
|
+
hasThinkingBudget: false,
|
|
3800
|
+
hasShowThoughts: false
|
|
3801
|
+
}
|
|
3746
3802
|
});
|
|
3747
3803
|
super.setName("Ollama");
|
|
3748
3804
|
}
|
|
@@ -3993,7 +4049,8 @@ var AxAITogether = class extends AxAIOpenAIBase {
|
|
|
3993
4049
|
apiKey,
|
|
3994
4050
|
config,
|
|
3995
4051
|
options,
|
|
3996
|
-
models
|
|
4052
|
+
models,
|
|
4053
|
+
modelInfo
|
|
3997
4054
|
}) {
|
|
3998
4055
|
if (!apiKey || apiKey === "") {
|
|
3999
4056
|
throw new Error("Together API key not set");
|
|
@@ -4002,13 +4059,21 @@ var AxAITogether = class extends AxAIOpenAIBase {
|
|
|
4002
4059
|
...axAITogetherDefaultConfig(),
|
|
4003
4060
|
...config
|
|
4004
4061
|
};
|
|
4062
|
+
modelInfo = [...axModelInfoTogether, ...modelInfo ?? []];
|
|
4063
|
+
const supportFor = {
|
|
4064
|
+
functions: true,
|
|
4065
|
+
streaming: true,
|
|
4066
|
+
hasThinkingBudget: false,
|
|
4067
|
+
hasShowThoughts: false
|
|
4068
|
+
};
|
|
4005
4069
|
super({
|
|
4006
4070
|
apiKey,
|
|
4007
4071
|
config: _config,
|
|
4008
4072
|
options,
|
|
4009
4073
|
apiURL: "https://api.together.xyz/v1",
|
|
4010
|
-
modelInfo
|
|
4011
|
-
models
|
|
4074
|
+
modelInfo,
|
|
4075
|
+
models,
|
|
4076
|
+
supportFor
|
|
4012
4077
|
});
|
|
4013
4078
|
super.setName("Together");
|
|
4014
4079
|
}
|
|
@@ -4154,7 +4219,8 @@ var AxAIGrok = class extends AxAIOpenAIBase {
|
|
|
4154
4219
|
apiKey,
|
|
4155
4220
|
config,
|
|
4156
4221
|
options,
|
|
4157
|
-
models
|
|
4222
|
+
models,
|
|
4223
|
+
modelInfo
|
|
4158
4224
|
}) {
|
|
4159
4225
|
if (!apiKey || apiKey === "") {
|
|
4160
4226
|
throw new Error("Grok API key not set");
|
|
@@ -4163,22 +4229,28 @@ var AxAIGrok = class extends AxAIOpenAIBase {
|
|
|
4163
4229
|
...axAIGrokDefaultConfig(),
|
|
4164
4230
|
...config
|
|
4165
4231
|
};
|
|
4232
|
+
modelInfo = [...axModelInfoGrok, ...modelInfo ?? []];
|
|
4233
|
+
const supportFor = (model) => {
|
|
4234
|
+
const mi = getModelInfo({
|
|
4235
|
+
model,
|
|
4236
|
+
modelInfo,
|
|
4237
|
+
models
|
|
4238
|
+
});
|
|
4239
|
+
return {
|
|
4240
|
+
functions: true,
|
|
4241
|
+
streaming: true,
|
|
4242
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
4243
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false
|
|
4244
|
+
};
|
|
4245
|
+
};
|
|
4166
4246
|
super({
|
|
4167
4247
|
apiKey,
|
|
4168
4248
|
config: _config,
|
|
4169
4249
|
options,
|
|
4170
4250
|
apiURL: "https://api.x.ai/v1",
|
|
4171
|
-
modelInfo
|
|
4251
|
+
modelInfo,
|
|
4172
4252
|
models,
|
|
4173
|
-
supportFor
|
|
4174
|
-
const modelInf = axModelInfoGrok.find((m) => m.name === model);
|
|
4175
|
-
return {
|
|
4176
|
-
functions: true,
|
|
4177
|
-
streaming: true,
|
|
4178
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
4179
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false
|
|
4180
|
-
};
|
|
4181
|
-
}
|
|
4253
|
+
supportFor
|
|
4182
4254
|
});
|
|
4183
4255
|
super.setName("Grok");
|
|
4184
4256
|
}
|
|
@@ -6627,7 +6699,8 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6627
6699
|
ai,
|
|
6628
6700
|
mem,
|
|
6629
6701
|
options,
|
|
6630
|
-
traceContext
|
|
6702
|
+
traceContext,
|
|
6703
|
+
firstStep
|
|
6631
6704
|
}) {
|
|
6632
6705
|
const {
|
|
6633
6706
|
sessionId,
|
|
@@ -6645,7 +6718,10 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6645
6718
|
throw new Error("No chat prompt found");
|
|
6646
6719
|
}
|
|
6647
6720
|
const functions = _functions?.map((f) => "toFunction" in f ? f.toFunction() : f)?.flat();
|
|
6648
|
-
|
|
6721
|
+
let functionCall = _functionCall ?? this.options?.functionCall;
|
|
6722
|
+
if (!firstStep && (functionCall === "required" || typeof functionCall === "function")) {
|
|
6723
|
+
functionCall = void 0;
|
|
6724
|
+
}
|
|
6649
6725
|
const res = await ai.chat(
|
|
6650
6726
|
{
|
|
6651
6727
|
chatPrompt,
|
|
@@ -6670,6 +6746,7 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6670
6746
|
ai,
|
|
6671
6747
|
mem,
|
|
6672
6748
|
options,
|
|
6749
|
+
firstStep,
|
|
6673
6750
|
span,
|
|
6674
6751
|
traceContext
|
|
6675
6752
|
}) {
|
|
@@ -6681,7 +6758,8 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6681
6758
|
ai,
|
|
6682
6759
|
mem,
|
|
6683
6760
|
options,
|
|
6684
|
-
traceContext
|
|
6761
|
+
traceContext,
|
|
6762
|
+
firstStep
|
|
6685
6763
|
});
|
|
6686
6764
|
if (res instanceof ReadableStream3) {
|
|
6687
6765
|
yield* this.processStreamingResponse({
|
|
@@ -6941,12 +7019,14 @@ Content: ${result.content}`
|
|
|
6941
7019
|
});
|
|
6942
7020
|
mem.add(prompt, options?.sessionId);
|
|
6943
7021
|
multiStepLoop: for (let n = 0; n < maxSteps; n++) {
|
|
7022
|
+
const firstStep = n === 0;
|
|
6944
7023
|
for (let errCount = 0; errCount < maxRetries; errCount++) {
|
|
6945
7024
|
try {
|
|
6946
7025
|
const generator = this.forwardCore({
|
|
6947
7026
|
options,
|
|
6948
7027
|
ai,
|
|
6949
7028
|
mem,
|
|
7029
|
+
firstStep,
|
|
6950
7030
|
span,
|
|
6951
7031
|
traceContext
|
|
6952
7032
|
});
|