@stackfactor/agent-utils 1.0.0

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.
@@ -0,0 +1,15 @@
1
+ declare const _default: {
2
+ HTTP_CODES: {
3
+ BAD_REQUEST: number;
4
+ UNPROCESSABLE_ENTITY: number;
5
+ INTERNAL_SERVER_ERROR: number;
6
+ BAD_GATEWAY: number;
7
+ };
8
+ ERROR: {
9
+ UNABLE_TO_GENERATE_CONTENT: string;
10
+ UNEXPECTED_ERROR: string;
11
+ UNSUPPORTED_MODEL: string;
12
+ };
13
+ };
14
+ export default _default;
15
+ //# sourceMappingURL=const.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/const.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,wBAaE"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ HTTP_CODES: {
5
+ BAD_REQUEST: 400,
6
+ UNPROCESSABLE_ENTITY: 422,
7
+ INTERNAL_SERVER_ERROR: 500,
8
+ BAD_GATEWAY: 502,
9
+ },
10
+ ERROR: {
11
+ UNABLE_TO_GENERATE_CONTENT: "Unable to generate content",
12
+ UNEXPECTED_ERROR: "An unexpected error occured. If the issue persists please contact the StackFactor support team at support@stackfactor.ai",
13
+ UNSUPPORTED_MODEL: "The specified model is not supported",
14
+ },
15
+ };
@@ -0,0 +1,20 @@
1
+ declare const _default: {
2
+ /**
3
+ * Creates a structured error object with a code, message, and optional details.
4
+ * This is used as a convenience factory to produce consistently shaped error payloads
5
+ * that can be passed to other error-handling methods in this module.
6
+ *
7
+ * @param errorCode - The numeric HTTP status code or application error code representing the error.
8
+ * @param errorMessage - A human-readable description of the error.
9
+ * @param details - Optional supplementary information about the error, such as validation details.
10
+ * @returns A plain object with `code`, `message`, and `details` properties.
11
+ */
12
+ create: (errorCode: number, errorMessage: string, details?: any) => {
13
+ code: number;
14
+ message: string;
15
+ details: any;
16
+ stack: string;
17
+ };
18
+ };
19
+ export default _default;
20
+ //# sourceMappingURL=errorHandling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorHandling.d.ts","sourceRoot":"","sources":["../../src/errorHandling.ts"],"names":[],"mappings":";IACE;;;;;;;;;OASG;wBACiB,MAAM,gBAAgB,MAAM,YAAW,GAAG;;;;;;;AAXhE,wBAoBE"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ /**
5
+ * Creates a structured error object with a code, message, and optional details.
6
+ * This is used as a convenience factory to produce consistently shaped error payloads
7
+ * that can be passed to other error-handling methods in this module.
8
+ *
9
+ * @param errorCode - The numeric HTTP status code or application error code representing the error.
10
+ * @param errorMessage - A human-readable description of the error.
11
+ * @param details - Optional supplementary information about the error, such as validation details.
12
+ * @returns A plain object with `code`, `message`, and `details` properties.
13
+ */
14
+ create: (errorCode, errorMessage, details = null) => {
15
+ const error = new Error(errorMessage);
16
+ return {
17
+ code: errorCode,
18
+ message: errorMessage,
19
+ details: details,
20
+ stack: error.stack,
21
+ };
22
+ },
23
+ };
@@ -0,0 +1,9 @@
1
+ import constants from "./const.js";
2
+ import errorHandling from "./errorHandling.js";
3
+ import langChain from "./langChain.js";
4
+ import logger from "./logger.js";
5
+ export { constants };
6
+ export { errorHandling };
7
+ export { langChain };
8
+ export { logger };
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.logger = exports.langChain = exports.errorHandling = exports.constants = void 0;
7
+ const const_js_1 = __importDefault(require("./const.js"));
8
+ exports.constants = const_js_1.default;
9
+ const errorHandling_js_1 = __importDefault(require("./errorHandling.js"));
10
+ exports.errorHandling = errorHandling_js_1.default;
11
+ const langChain_js_1 = __importDefault(require("./langChain.js"));
12
+ exports.langChain = langChain_js_1.default;
13
+ const logger_js_1 = __importDefault(require("./logger.js"));
14
+ exports.logger = logger_js_1.default;
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ createAIAgent: (name: string, modelName: string, systemPrompt: string, tools: any[], responseFormat: any, config: any, onReportProgress?: Function | null, minPercent?: number, maxPercent?: number) => any;
3
+ runAIAgent: (agent: any, prompt: string, config: any, onProgress?: Function | null) => Promise<any>;
4
+ runChatPromptWithModel: (modelName: string, config: any, prompt: any, onProgressReport: any) => any;
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
+ runPromptWithModelForImageGeneration: (modelName: string, config: any, prompt: string, options?: any) => Promise<any>;
7
+ throwErrorIfNotSuccessful: (response: any) => string;
8
+ };
9
+ export default _default;
10
+ //# sourceMappingURL=langChain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langChain.d.ts","sourceRoot":"","sources":["../../src/langChain.ts"],"names":[],"mappings":";0BAoaQ,MAAM,aACD,MAAM,gBACH,MAAM,SACb,GAAG,EAAE,kBACI,GAAG,UACX,GAAG,qBACO,QAAQ,GAAG,IAAI,eACrB,MAAM,eACN,MAAM,KACjB,GAAG;wBAyCG,GAAG,UACF,MAAM,UACN,GAAG,eACC,QAAQ,GAAG,IAAI,KAC1B,OAAO,CAAC,GAAG,CAAC;wCAioBF,MAAM,UACT,GAAG,UACH,GAAG,oBACO,GAAG,KACpB,GAAG;oCApfO,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;sDAyyBF,MAAM,UACT,GAAG,UACH,MAAM,YACL,GAAG,KACX,OAAO,CAAC,GAAG,CAAC;0CAz2B8B,GAAG,KAAG,MAAM;;AAo6BzD,wBAOE"}