@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.cjs
CHANGED
|
@@ -1975,6 +1975,22 @@ function mapFinishReason(stopReason) {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
}
|
|
1977
1977
|
|
|
1978
|
+
// dsp/modelinfo.ts
|
|
1979
|
+
function getModelInfo({
|
|
1980
|
+
model,
|
|
1981
|
+
modelInfo,
|
|
1982
|
+
models
|
|
1983
|
+
}) {
|
|
1984
|
+
const modelEntry = models?.find((v) => v.key === model);
|
|
1985
|
+
const mappedModel = modelEntry && "model" in modelEntry ? modelEntry.model : model;
|
|
1986
|
+
const exactMatch = modelInfo.find((v) => v.name === model);
|
|
1987
|
+
if (exactMatch) return exactMatch;
|
|
1988
|
+
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+$/, "");
|
|
1989
|
+
const normalizedMatch = modelInfo.find((v) => v.name === normalizedName);
|
|
1990
|
+
if (normalizedMatch) return normalizedMatch;
|
|
1991
|
+
return null;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1978
1994
|
// ai/openai/types.ts
|
|
1979
1995
|
var AxAIOpenAIModel = /* @__PURE__ */ ((AxAIOpenAIModel2) => {
|
|
1980
1996
|
AxAIOpenAIModel2["O1"] = "o1";
|
|
@@ -2444,15 +2460,7 @@ var AxAIOpenAIBase = class extends AxBaseAI {
|
|
|
2444
2460
|
embedModel: config.embedModel
|
|
2445
2461
|
},
|
|
2446
2462
|
options,
|
|
2447
|
-
supportFor
|
|
2448
|
-
const modelInf = modelInfo.find((m) => m.name === model);
|
|
2449
|
-
return {
|
|
2450
|
-
functions: true,
|
|
2451
|
-
streaming: true,
|
|
2452
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
2453
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false
|
|
2454
|
-
};
|
|
2455
|
-
}),
|
|
2463
|
+
supportFor,
|
|
2456
2464
|
models
|
|
2457
2465
|
});
|
|
2458
2466
|
}
|
|
@@ -2462,18 +2470,24 @@ var AxAIOpenAI = class extends AxAIOpenAIBase {
|
|
|
2462
2470
|
apiKey,
|
|
2463
2471
|
config,
|
|
2464
2472
|
options,
|
|
2465
|
-
models
|
|
2473
|
+
models,
|
|
2474
|
+
modelInfo
|
|
2466
2475
|
}) {
|
|
2467
2476
|
if (!apiKey || apiKey === "") {
|
|
2468
2477
|
throw new Error("OpenAI API key not set");
|
|
2469
2478
|
}
|
|
2470
|
-
|
|
2471
|
-
|
|
2479
|
+
modelInfo = [...axModelInfoOpenAI, ...modelInfo ?? []];
|
|
2480
|
+
const supportFor = (model) => {
|
|
2481
|
+
const mi = getModelInfo({
|
|
2482
|
+
model,
|
|
2483
|
+
modelInfo,
|
|
2484
|
+
models
|
|
2485
|
+
});
|
|
2472
2486
|
return {
|
|
2473
2487
|
functions: true,
|
|
2474
2488
|
streaming: true,
|
|
2475
|
-
hasThinkingBudget:
|
|
2476
|
-
hasShowThoughts:
|
|
2489
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
2490
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false
|
|
2477
2491
|
};
|
|
2478
2492
|
};
|
|
2479
2493
|
super({
|
|
@@ -2483,9 +2497,9 @@ var AxAIOpenAI = class extends AxAIOpenAIBase {
|
|
|
2483
2497
|
...config
|
|
2484
2498
|
},
|
|
2485
2499
|
options,
|
|
2486
|
-
modelInfo
|
|
2500
|
+
modelInfo,
|
|
2487
2501
|
models,
|
|
2488
|
-
supportFor
|
|
2502
|
+
supportFor
|
|
2489
2503
|
});
|
|
2490
2504
|
super.setName("OpenAI");
|
|
2491
2505
|
}
|
|
@@ -2504,7 +2518,8 @@ var AxAIAzureOpenAI = class extends AxAIOpenAIBase {
|
|
|
2504
2518
|
version = "api-version=2024-02-15-preview",
|
|
2505
2519
|
config,
|
|
2506
2520
|
options,
|
|
2507
|
-
models
|
|
2521
|
+
models,
|
|
2522
|
+
modelInfo
|
|
2508
2523
|
}) {
|
|
2509
2524
|
if (!apiKey || apiKey === "") {
|
|
2510
2525
|
throw new Error("Azure OpenAPI API key not set");
|
|
@@ -2519,21 +2534,27 @@ var AxAIAzureOpenAI = class extends AxAIOpenAIBase {
|
|
|
2519
2534
|
...axAIAzureOpenAIDefaultConfig(),
|
|
2520
2535
|
...config
|
|
2521
2536
|
};
|
|
2537
|
+
modelInfo = [...axModelInfoOpenAI, ...modelInfo ?? []];
|
|
2538
|
+
const supportFor = (model) => {
|
|
2539
|
+
const mi = getModelInfo({
|
|
2540
|
+
model,
|
|
2541
|
+
modelInfo,
|
|
2542
|
+
models
|
|
2543
|
+
});
|
|
2544
|
+
return {
|
|
2545
|
+
functions: true,
|
|
2546
|
+
streaming: true,
|
|
2547
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
2548
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false
|
|
2549
|
+
};
|
|
2550
|
+
};
|
|
2522
2551
|
super({
|
|
2523
2552
|
apiKey,
|
|
2524
2553
|
config: _config,
|
|
2525
2554
|
options,
|
|
2526
2555
|
models,
|
|
2527
|
-
modelInfo
|
|
2528
|
-
supportFor
|
|
2529
|
-
const modelInf = axModelInfoOpenAI.find((m) => m.name === model);
|
|
2530
|
-
return {
|
|
2531
|
-
functions: true,
|
|
2532
|
-
streaming: true,
|
|
2533
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
2534
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false
|
|
2535
|
-
};
|
|
2536
|
-
}
|
|
2556
|
+
modelInfo,
|
|
2557
|
+
supportFor
|
|
2537
2558
|
});
|
|
2538
2559
|
const host = resourceName.includes("://") ? resourceName : `https://${resourceName}.openai.azure.com/`;
|
|
2539
2560
|
super.setName("Azure OpenAI");
|
|
@@ -2883,6 +2904,7 @@ function createToolCall(functionCalls) {
|
|
|
2883
2904
|
var AxAIDeepSeekModel = /* @__PURE__ */ ((AxAIDeepSeekModel2) => {
|
|
2884
2905
|
AxAIDeepSeekModel2["DeepSeekChat"] = "deepseek-chat";
|
|
2885
2906
|
AxAIDeepSeekModel2["DeepSeekCoder"] = "deepseek-coder";
|
|
2907
|
+
AxAIDeepSeekModel2["DeepSeekReasoner"] = "deepseek-reasoner";
|
|
2886
2908
|
return AxAIDeepSeekModel2;
|
|
2887
2909
|
})(AxAIDeepSeekModel || {});
|
|
2888
2910
|
|
|
@@ -2891,14 +2913,14 @@ var axModelInfoDeepSeek = [
|
|
|
2891
2913
|
{
|
|
2892
2914
|
name: "deepseek-chat" /* DeepSeekChat */,
|
|
2893
2915
|
currency: "USD",
|
|
2894
|
-
promptTokenCostPer1M: 0.
|
|
2895
|
-
completionTokenCostPer1M:
|
|
2916
|
+
promptTokenCostPer1M: 0.27,
|
|
2917
|
+
completionTokenCostPer1M: 1.1
|
|
2896
2918
|
},
|
|
2897
2919
|
{
|
|
2898
|
-
name: "deepseek-
|
|
2920
|
+
name: "deepseek-reasoner" /* DeepSeekReasoner */,
|
|
2899
2921
|
currency: "USD",
|
|
2900
|
-
promptTokenCostPer1M: 0.
|
|
2901
|
-
completionTokenCostPer1M:
|
|
2922
|
+
promptTokenCostPer1M: 0.55,
|
|
2923
|
+
completionTokenCostPer1M: 2.19
|
|
2902
2924
|
}
|
|
2903
2925
|
];
|
|
2904
2926
|
|
|
@@ -2916,7 +2938,8 @@ var AxAIDeepSeek = class extends AxAIOpenAIBase {
|
|
|
2916
2938
|
apiKey,
|
|
2917
2939
|
config,
|
|
2918
2940
|
options,
|
|
2919
|
-
models
|
|
2941
|
+
models,
|
|
2942
|
+
modelInfo
|
|
2920
2943
|
}) {
|
|
2921
2944
|
if (!apiKey || apiKey === "") {
|
|
2922
2945
|
throw new Error("DeepSeek API key not set");
|
|
@@ -2925,12 +2948,19 @@ var AxAIDeepSeek = class extends AxAIOpenAIBase {
|
|
|
2925
2948
|
...axAIDeepSeekDefaultConfig(),
|
|
2926
2949
|
...config
|
|
2927
2950
|
};
|
|
2951
|
+
modelInfo = [...axModelInfoDeepSeek, ...modelInfo ?? []];
|
|
2928
2952
|
super({
|
|
2929
2953
|
apiKey,
|
|
2930
2954
|
config: _config,
|
|
2931
2955
|
options,
|
|
2932
2956
|
apiURL: "https://api.deepseek.com",
|
|
2933
|
-
modelInfo
|
|
2957
|
+
modelInfo,
|
|
2958
|
+
supportFor: {
|
|
2959
|
+
functions: true,
|
|
2960
|
+
streaming: true,
|
|
2961
|
+
hasThinkingBudget: false,
|
|
2962
|
+
hasShowThoughts: false
|
|
2963
|
+
},
|
|
2934
2964
|
models
|
|
2935
2965
|
});
|
|
2936
2966
|
super.setName("DeepSeek");
|
|
@@ -2943,7 +2973,6 @@ var AxAIGoogleGeminiModel = /* @__PURE__ */ ((AxAIGoogleGeminiModel2) => {
|
|
|
2943
2973
|
AxAIGoogleGeminiModel2["Gemini25Flash"] = "gemini-2.5-flash-preview-04-17";
|
|
2944
2974
|
AxAIGoogleGeminiModel2["Gemini20Flash"] = "gemini-2.0-flash";
|
|
2945
2975
|
AxAIGoogleGeminiModel2["Gemini20FlashLite"] = "gemini-2.0-flash-lite-preview-02-05";
|
|
2946
|
-
AxAIGoogleGeminiModel2["Gemini20FlashThinking"] = "gemini-2.0-flash-thinking-exp-01-21";
|
|
2947
2976
|
AxAIGoogleGeminiModel2["Gemini1Pro"] = "gemini-1.0-pro";
|
|
2948
2977
|
AxAIGoogleGeminiModel2["Gemini15Flash"] = "gemini-1.5-flash";
|
|
2949
2978
|
AxAIGoogleGeminiModel2["Gemini15Flash002"] = "gemini-1.5-flash-002";
|
|
@@ -3019,13 +3048,6 @@ var axModelInfoGoogleGemini = [
|
|
|
3019
3048
|
promptTokenCostPer1M: 0,
|
|
3020
3049
|
completionTokenCostPer1M: 0
|
|
3021
3050
|
},
|
|
3022
|
-
{
|
|
3023
|
-
name: "gemini-2.0-flash-thinking-exp-01-21" /* Gemini20FlashThinking */,
|
|
3024
|
-
currency: "usd",
|
|
3025
|
-
characterIsToken: false,
|
|
3026
|
-
promptTokenCostPer1M: 0,
|
|
3027
|
-
completionTokenCostPer1M: 0
|
|
3028
|
-
},
|
|
3029
3051
|
{
|
|
3030
3052
|
name: "gemini-1.5-flash" /* Gemini15Flash */,
|
|
3031
3053
|
currency: "usd",
|
|
@@ -3228,6 +3250,9 @@ var AxAIGoogleGeminiImpl = class {
|
|
|
3228
3250
|
}
|
|
3229
3251
|
});
|
|
3230
3252
|
}
|
|
3253
|
+
if (this.options?.googleSearch) {
|
|
3254
|
+
tools.push({ google_search: {} });
|
|
3255
|
+
}
|
|
3231
3256
|
if (this.options?.urlContext) {
|
|
3232
3257
|
tools.push({ url_context: {} });
|
|
3233
3258
|
}
|
|
@@ -3432,7 +3457,8 @@ var AxAIGoogleGemini = class extends AxBaseAI {
|
|
|
3432
3457
|
endpointId,
|
|
3433
3458
|
config,
|
|
3434
3459
|
options,
|
|
3435
|
-
models
|
|
3460
|
+
models,
|
|
3461
|
+
modelInfo
|
|
3436
3462
|
}) {
|
|
3437
3463
|
const isVertex = projectId !== void 0 && region !== void 0;
|
|
3438
3464
|
let apiURL;
|
|
@@ -3471,26 +3497,32 @@ var AxAIGoogleGemini = class extends AxBaseAI {
|
|
|
3471
3497
|
apiKey,
|
|
3472
3498
|
options
|
|
3473
3499
|
);
|
|
3500
|
+
modelInfo = [...axModelInfoGoogleGemini, ...modelInfo ?? []];
|
|
3501
|
+
const supportFor = (model) => {
|
|
3502
|
+
const mi = getModelInfo({
|
|
3503
|
+
model,
|
|
3504
|
+
modelInfo,
|
|
3505
|
+
models
|
|
3506
|
+
});
|
|
3507
|
+
return {
|
|
3508
|
+
functions: true,
|
|
3509
|
+
streaming: true,
|
|
3510
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
3511
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false,
|
|
3512
|
+
functionCot: false
|
|
3513
|
+
};
|
|
3514
|
+
};
|
|
3474
3515
|
super(aiImpl, {
|
|
3475
3516
|
name: "GoogleGeminiAI",
|
|
3476
3517
|
apiURL,
|
|
3477
3518
|
headers,
|
|
3478
|
-
modelInfo
|
|
3519
|
+
modelInfo,
|
|
3479
3520
|
defaults: {
|
|
3480
3521
|
model: _config.model,
|
|
3481
3522
|
embedModel: _config.embedModel
|
|
3482
3523
|
},
|
|
3483
3524
|
options,
|
|
3484
|
-
supportFor
|
|
3485
|
-
const modelInf = axModelInfoGoogleGemini.find((m) => m.name === model);
|
|
3486
|
-
return {
|
|
3487
|
-
functions: true,
|
|
3488
|
-
streaming: true,
|
|
3489
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
3490
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false,
|
|
3491
|
-
functionCot: false
|
|
3492
|
-
};
|
|
3493
|
-
},
|
|
3525
|
+
supportFor,
|
|
3494
3526
|
models
|
|
3495
3527
|
});
|
|
3496
3528
|
}
|
|
@@ -3593,7 +3625,8 @@ var AxAIGroq = class extends AxAIOpenAIBase {
|
|
|
3593
3625
|
apiKey,
|
|
3594
3626
|
config,
|
|
3595
3627
|
options,
|
|
3596
|
-
models
|
|
3628
|
+
models,
|
|
3629
|
+
modelInfo
|
|
3597
3630
|
}) {
|
|
3598
3631
|
if (!apiKey || apiKey === "") {
|
|
3599
3632
|
throw new Error("Groq API key not set");
|
|
@@ -3606,13 +3639,21 @@ var AxAIGroq = class extends AxAIOpenAIBase {
|
|
|
3606
3639
|
...options,
|
|
3607
3640
|
streamingUsage: false
|
|
3608
3641
|
};
|
|
3642
|
+
modelInfo = [...axModelInfoGroq, ...modelInfo ?? []];
|
|
3643
|
+
const supportFor = {
|
|
3644
|
+
functions: true,
|
|
3645
|
+
streaming: true,
|
|
3646
|
+
hasThinkingBudget: false,
|
|
3647
|
+
hasShowThoughts: false
|
|
3648
|
+
};
|
|
3609
3649
|
super({
|
|
3610
3650
|
apiKey,
|
|
3611
3651
|
config: _config,
|
|
3612
3652
|
options: _options,
|
|
3613
|
-
modelInfo
|
|
3653
|
+
modelInfo,
|
|
3614
3654
|
apiURL: "https://api.groq.com/openai/v1",
|
|
3615
|
-
models
|
|
3655
|
+
models,
|
|
3656
|
+
supportFor
|
|
3616
3657
|
});
|
|
3617
3658
|
super.setName("Groq");
|
|
3618
3659
|
this.setOptions(_options);
|
|
@@ -3850,7 +3891,8 @@ var AxAIMistral = class extends AxAIOpenAIBase {
|
|
|
3850
3891
|
apiKey,
|
|
3851
3892
|
config,
|
|
3852
3893
|
options,
|
|
3853
|
-
models
|
|
3894
|
+
models,
|
|
3895
|
+
modelInfo
|
|
3854
3896
|
}) {
|
|
3855
3897
|
if (!apiKey || apiKey === "") {
|
|
3856
3898
|
throw new Error("Mistral API key not set");
|
|
@@ -3859,13 +3901,21 @@ var AxAIMistral = class extends AxAIOpenAIBase {
|
|
|
3859
3901
|
...axAIMistralDefaultConfig(),
|
|
3860
3902
|
...config
|
|
3861
3903
|
};
|
|
3904
|
+
modelInfo = [...axModelInfoMistral, ...modelInfo ?? []];
|
|
3905
|
+
const supportFor = {
|
|
3906
|
+
functions: true,
|
|
3907
|
+
streaming: true,
|
|
3908
|
+
hasThinkingBudget: false,
|
|
3909
|
+
hasShowThoughts: false
|
|
3910
|
+
};
|
|
3862
3911
|
super({
|
|
3863
3912
|
apiKey,
|
|
3864
3913
|
config: _config,
|
|
3865
3914
|
options,
|
|
3866
3915
|
apiURL: "https://api.mistral.ai/v1",
|
|
3867
|
-
modelInfo
|
|
3868
|
-
models
|
|
3916
|
+
modelInfo,
|
|
3917
|
+
models,
|
|
3918
|
+
supportFor
|
|
3869
3919
|
});
|
|
3870
3920
|
super.setName("Mistral");
|
|
3871
3921
|
}
|
|
@@ -3900,7 +3950,13 @@ var AxAIOllama = class extends AxAIOpenAIBase {
|
|
|
3900
3950
|
config: _config,
|
|
3901
3951
|
apiURL: url,
|
|
3902
3952
|
models,
|
|
3903
|
-
modelInfo: []
|
|
3953
|
+
modelInfo: [],
|
|
3954
|
+
supportFor: {
|
|
3955
|
+
functions: true,
|
|
3956
|
+
streaming: true,
|
|
3957
|
+
hasThinkingBudget: false,
|
|
3958
|
+
hasShowThoughts: false
|
|
3959
|
+
}
|
|
3904
3960
|
});
|
|
3905
3961
|
super.setName("Ollama");
|
|
3906
3962
|
}
|
|
@@ -4151,7 +4207,8 @@ var AxAITogether = class extends AxAIOpenAIBase {
|
|
|
4151
4207
|
apiKey,
|
|
4152
4208
|
config,
|
|
4153
4209
|
options,
|
|
4154
|
-
models
|
|
4210
|
+
models,
|
|
4211
|
+
modelInfo
|
|
4155
4212
|
}) {
|
|
4156
4213
|
if (!apiKey || apiKey === "") {
|
|
4157
4214
|
throw new Error("Together API key not set");
|
|
@@ -4160,13 +4217,21 @@ var AxAITogether = class extends AxAIOpenAIBase {
|
|
|
4160
4217
|
...axAITogetherDefaultConfig(),
|
|
4161
4218
|
...config
|
|
4162
4219
|
};
|
|
4220
|
+
modelInfo = [...axModelInfoTogether, ...modelInfo ?? []];
|
|
4221
|
+
const supportFor = {
|
|
4222
|
+
functions: true,
|
|
4223
|
+
streaming: true,
|
|
4224
|
+
hasThinkingBudget: false,
|
|
4225
|
+
hasShowThoughts: false
|
|
4226
|
+
};
|
|
4163
4227
|
super({
|
|
4164
4228
|
apiKey,
|
|
4165
4229
|
config: _config,
|
|
4166
4230
|
options,
|
|
4167
4231
|
apiURL: "https://api.together.xyz/v1",
|
|
4168
|
-
modelInfo
|
|
4169
|
-
models
|
|
4232
|
+
modelInfo,
|
|
4233
|
+
models,
|
|
4234
|
+
supportFor
|
|
4170
4235
|
});
|
|
4171
4236
|
super.setName("Together");
|
|
4172
4237
|
}
|
|
@@ -4312,7 +4377,8 @@ var AxAIGrok = class extends AxAIOpenAIBase {
|
|
|
4312
4377
|
apiKey,
|
|
4313
4378
|
config,
|
|
4314
4379
|
options,
|
|
4315
|
-
models
|
|
4380
|
+
models,
|
|
4381
|
+
modelInfo
|
|
4316
4382
|
}) {
|
|
4317
4383
|
if (!apiKey || apiKey === "") {
|
|
4318
4384
|
throw new Error("Grok API key not set");
|
|
@@ -4321,22 +4387,28 @@ var AxAIGrok = class extends AxAIOpenAIBase {
|
|
|
4321
4387
|
...axAIGrokDefaultConfig(),
|
|
4322
4388
|
...config
|
|
4323
4389
|
};
|
|
4390
|
+
modelInfo = [...axModelInfoGrok, ...modelInfo ?? []];
|
|
4391
|
+
const supportFor = (model) => {
|
|
4392
|
+
const mi = getModelInfo({
|
|
4393
|
+
model,
|
|
4394
|
+
modelInfo,
|
|
4395
|
+
models
|
|
4396
|
+
});
|
|
4397
|
+
return {
|
|
4398
|
+
functions: true,
|
|
4399
|
+
streaming: true,
|
|
4400
|
+
hasThinkingBudget: mi?.hasThinkingBudget ?? false,
|
|
4401
|
+
hasShowThoughts: mi?.hasShowThoughts ?? false
|
|
4402
|
+
};
|
|
4403
|
+
};
|
|
4324
4404
|
super({
|
|
4325
4405
|
apiKey,
|
|
4326
4406
|
config: _config,
|
|
4327
4407
|
options,
|
|
4328
4408
|
apiURL: "https://api.x.ai/v1",
|
|
4329
|
-
modelInfo
|
|
4409
|
+
modelInfo,
|
|
4330
4410
|
models,
|
|
4331
|
-
supportFor
|
|
4332
|
-
const modelInf = axModelInfoGrok.find((m) => m.name === model);
|
|
4333
|
-
return {
|
|
4334
|
-
functions: true,
|
|
4335
|
-
streaming: true,
|
|
4336
|
-
hasThinkingBudget: modelInf?.hasThinkingBudget ?? false,
|
|
4337
|
-
hasShowThoughts: modelInf?.hasShowThoughts ?? false
|
|
4338
|
-
};
|
|
4339
|
-
}
|
|
4411
|
+
supportFor
|
|
4340
4412
|
});
|
|
4341
4413
|
super.setName("Grok");
|
|
4342
4414
|
}
|
|
@@ -6781,7 +6853,8 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6781
6853
|
ai,
|
|
6782
6854
|
mem,
|
|
6783
6855
|
options,
|
|
6784
|
-
traceContext
|
|
6856
|
+
traceContext,
|
|
6857
|
+
firstStep
|
|
6785
6858
|
}) {
|
|
6786
6859
|
const {
|
|
6787
6860
|
sessionId,
|
|
@@ -6799,7 +6872,10 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6799
6872
|
throw new Error("No chat prompt found");
|
|
6800
6873
|
}
|
|
6801
6874
|
const functions = _functions?.map((f) => "toFunction" in f ? f.toFunction() : f)?.flat();
|
|
6802
|
-
|
|
6875
|
+
let functionCall = _functionCall ?? this.options?.functionCall;
|
|
6876
|
+
if (!firstStep && (functionCall === "required" || typeof functionCall === "function")) {
|
|
6877
|
+
functionCall = void 0;
|
|
6878
|
+
}
|
|
6803
6879
|
const res = await ai.chat(
|
|
6804
6880
|
{
|
|
6805
6881
|
chatPrompt,
|
|
@@ -6824,6 +6900,7 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6824
6900
|
ai,
|
|
6825
6901
|
mem,
|
|
6826
6902
|
options,
|
|
6903
|
+
firstStep,
|
|
6827
6904
|
span,
|
|
6828
6905
|
traceContext
|
|
6829
6906
|
}) {
|
|
@@ -6835,7 +6912,8 @@ var AxGen = class extends AxProgramWithSignature {
|
|
|
6835
6912
|
ai,
|
|
6836
6913
|
mem,
|
|
6837
6914
|
options,
|
|
6838
|
-
traceContext
|
|
6915
|
+
traceContext,
|
|
6916
|
+
firstStep
|
|
6839
6917
|
});
|
|
6840
6918
|
if (res instanceof import_web5.ReadableStream) {
|
|
6841
6919
|
yield* this.processStreamingResponse({
|
|
@@ -7095,12 +7173,14 @@ Content: ${result.content}`
|
|
|
7095
7173
|
});
|
|
7096
7174
|
mem.add(prompt, options?.sessionId);
|
|
7097
7175
|
multiStepLoop: for (let n = 0; n < maxSteps; n++) {
|
|
7176
|
+
const firstStep = n === 0;
|
|
7098
7177
|
for (let errCount = 0; errCount < maxRetries; errCount++) {
|
|
7099
7178
|
try {
|
|
7100
7179
|
const generator = this.forwardCore({
|
|
7101
7180
|
options,
|
|
7102
7181
|
ai,
|
|
7103
7182
|
mem,
|
|
7183
|
+
firstStep,
|
|
7104
7184
|
span,
|
|
7105
7185
|
traceContext
|
|
7106
7186
|
});
|