@stackfactor/agent-utils 1.0.23 → 1.0.24
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/dist/cjs/langChain.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
runPromptWithModel: (modelName: string, config: any, prompt: any, onProgressReport: any, minPercent?: number, maxPercent?: number, expectsJsonResponse?: boolean, schema?: any, agentName?: string, tools?: any[]) => Promise<any>;
|
|
6
6
|
runPromptWithModelForImageGeneration: (modelName: string, config: any, prompt: string, options?: any) => Promise<any>;
|
|
7
7
|
throwErrorIfNotSuccessful: (response: any) => string;
|
|
8
|
+
validateModel: (selectedModel: string, supportedModels: string[]) => string;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
10
11
|
//# sourceMappingURL=langChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";0CAgD6C,GAAG,KAAG,IAAI;wBAke/C,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";0CAgD6C,GAAG,KAAG,IAAI;wBAke/C,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;oCAuXF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA59B8B,GAAG,KAAG,MAAM;mCAoBxC,MAAM,mBACJ,MAAM,EAAE,KACxB,MAAM;;AAigCT,wBAQE"}
|
package/dist/cjs/langChain.js
CHANGED
|
@@ -589,6 +589,20 @@ const throwErrorIfNotSuccessful = (response) => {
|
|
|
589
589
|
throw errorHandling_js_1.default.create(const_js_1.default.HTTP_CODES.INTERNAL_SERVER_ERROR, const_js_1.default.ERROR.UNABLE_TO_GENERATE_CONTENT);
|
|
590
590
|
}
|
|
591
591
|
};
|
|
592
|
+
/**
|
|
593
|
+
* Returns `selectedModel` when it appears in `supportedModels`, otherwise returns
|
|
594
|
+
* the first entry in `supportedModels` as a safe fallback. Use this to coerce a
|
|
595
|
+
* caller-supplied model identifier to one the current integration is known to
|
|
596
|
+
* support, instead of failing or silently passing an unsupported model to
|
|
597
|
+
* `getLLMModel`. When `supportedModels` is empty there is no fallback to pick,
|
|
598
|
+
* so the original `selectedModel` is returned unchanged.
|
|
599
|
+
*/
|
|
600
|
+
const validateModel = (selectedModel, supportedModels) => {
|
|
601
|
+
if (supportedModels.includes(selectedModel)) {
|
|
602
|
+
return selectedModel;
|
|
603
|
+
}
|
|
604
|
+
return supportedModels[0] ?? selectedModel;
|
|
605
|
+
};
|
|
592
606
|
const MAX_VALIDATION_RETRIES = 3;
|
|
593
607
|
const MAX_RATE_LIMIT_RETRIES = 2;
|
|
594
608
|
const RATE_LIMIT_MIN_WAIT_MS = 30_000;
|
|
@@ -1412,4 +1426,5 @@ exports.default = {
|
|
|
1412
1426
|
runPromptWithModel,
|
|
1413
1427
|
runPromptWithModelForImageGeneration,
|
|
1414
1428
|
throwErrorIfNotSuccessful,
|
|
1429
|
+
validateModel,
|
|
1415
1430
|
};
|
package/dist/esm/langChain.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
runPromptWithModel: (modelName: string, config: any, prompt: any, onProgressReport: any, minPercent?: number, maxPercent?: number, expectsJsonResponse?: boolean, schema?: any, agentName?: string, tools?: any[]) => Promise<any>;
|
|
6
6
|
runPromptWithModelForImageGeneration: (modelName: string, config: any, prompt: string, options?: any) => Promise<any>;
|
|
7
7
|
throwErrorIfNotSuccessful: (response: any) => string;
|
|
8
|
+
validateModel: (selectedModel: string, supportedModels: string[]) => string;
|
|
8
9
|
};
|
|
9
10
|
export default _default;
|
|
10
11
|
//# sourceMappingURL=langChain.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";0CAgD6C,GAAG,KAAG,IAAI;wBAke/C,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";0CAgD6C,GAAG,KAAG,IAAI;wBAke/C,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,KACV,GAAG;sBAyBG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;oCAuXF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,eACT,MAAM,eACN,MAAM,wBACG,OAAO,WACpB,GAAG,cACA,MAAM,UACV,GAAG,EAAE,KACX,OAAO,CAAC,GAAG,CAAC;sDA6rBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CA59B8B,GAAG,KAAG,MAAM;mCAoBxC,MAAM,mBACJ,MAAM,EAAE,KACxB,MAAM;;AAigCT,wBAQE"}
|
package/dist/esm/langChain.js
CHANGED
|
@@ -584,6 +584,20 @@ const throwErrorIfNotSuccessful = (response) => {
|
|
|
584
584
|
throw errorHandlingHelper.create(constants.HTTP_CODES.INTERNAL_SERVER_ERROR, constants.ERROR.UNABLE_TO_GENERATE_CONTENT);
|
|
585
585
|
}
|
|
586
586
|
};
|
|
587
|
+
/**
|
|
588
|
+
* Returns `selectedModel` when it appears in `supportedModels`, otherwise returns
|
|
589
|
+
* the first entry in `supportedModels` as a safe fallback. Use this to coerce a
|
|
590
|
+
* caller-supplied model identifier to one the current integration is known to
|
|
591
|
+
* support, instead of failing or silently passing an unsupported model to
|
|
592
|
+
* `getLLMModel`. When `supportedModels` is empty there is no fallback to pick,
|
|
593
|
+
* so the original `selectedModel` is returned unchanged.
|
|
594
|
+
*/
|
|
595
|
+
const validateModel = (selectedModel, supportedModels) => {
|
|
596
|
+
if (supportedModels.includes(selectedModel)) {
|
|
597
|
+
return selectedModel;
|
|
598
|
+
}
|
|
599
|
+
return supportedModels[0] ?? selectedModel;
|
|
600
|
+
};
|
|
587
601
|
const MAX_VALIDATION_RETRIES = 3;
|
|
588
602
|
const MAX_RATE_LIMIT_RETRIES = 2;
|
|
589
603
|
const RATE_LIMIT_MIN_WAIT_MS = 30_000;
|
|
@@ -1407,4 +1421,5 @@ export default {
|
|
|
1407
1421
|
runPromptWithModel,
|
|
1408
1422
|
runPromptWithModelForImageGeneration,
|
|
1409
1423
|
throwErrorIfNotSuccessful,
|
|
1424
|
+
validateModel,
|
|
1410
1425
|
};
|