@xapp/stentor-service-generative-ai 1.62.39 → 1.62.41
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/lib/GenerativeAIService.d.ts +1 -1
- package/lib/http/index.d.ts +3 -0
- package/lib/http/index.js +20 -0
- package/lib/http/index.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/models/GenerativeAIService.d.ts +1 -1
- package/lib/models/LeadAnalysis.d.ts +4 -0
- package/lib/models/index.d.ts +3 -3
- package/lib/models/index.js +3 -3
- package/lib/models/index.js.map +1 -1
- package/lib/prompts/AnalyzeLead.js +10 -8
- package/lib/prompts/AnalyzeLead.js.map +1 -1
- package/lib/prompts/index.d.ts +2 -0
- package/lib/prompts/index.js +19 -0
- package/lib/prompts/index.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright (c) 2024, XAPP AI */
|
|
2
2
|
import type { ExternalLead } from "stentor-models";
|
|
3
|
-
import type {
|
|
3
|
+
import type { IGenerativeAIService, LeadAnalysis, LLMService } from "./models";
|
|
4
4
|
export interface AnalyzeLeadOptions {
|
|
5
5
|
businessDescription?: string;
|
|
6
6
|
highValueLeadDescription?: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2024, XAPP AI */
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./HTTPService"), exports);
|
|
19
|
+
__exportStar(require("./NodeHTTPService"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,gDAA8B;AAC9B,oDAAkC"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -16,4 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*! Copyright (c) 2024, XAPP AI */
|
|
18
18
|
__exportStar(require("./GenerativeAIService"), exports);
|
|
19
|
+
__exportStar(require("./OpenAIService"), exports);
|
|
20
|
+
__exportStar(require("./http"), exports);
|
|
21
|
+
__exportStar(require("./models"), exports);
|
|
22
|
+
__exportStar(require("./prompts"), exports);
|
|
19
23
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,kCAAkC;AAClC,wDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,kCAAkC;AAClC,wDAAsC;AACtC,kDAAgC;AAChC,yCAAuB;AACvB,2CAAyB;AACzB,4CAA0B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! Copyright (c) 2024, XAPP AI */
|
|
2
2
|
import { ExternalLead } from "stentor-models";
|
|
3
3
|
import { LeadAnalysis } from "./LeadAnalysis";
|
|
4
|
-
export interface
|
|
4
|
+
export interface IGenerativeAIService {
|
|
5
5
|
/**
|
|
6
6
|
* Analyze a lead to find summary
|
|
7
7
|
* @param lead
|
package/lib/models/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
export * from './LeadAnalysis';
|
|
3
2
|
export * from './GenerativeAIService';
|
|
4
|
-
export * from
|
|
3
|
+
export * from './LeadAnalysis';
|
|
5
4
|
export * from "./LLMService";
|
|
6
|
-
export * from "./PromptGenerator";
|
|
7
5
|
export * from "./Prompt";
|
|
6
|
+
export * from "./PromptGenerator";
|
|
7
|
+
export * from "./ResponseParser";
|
package/lib/models/index.js
CHANGED
|
@@ -15,10 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./LeadAnalysis"), exports);
|
|
19
18
|
__exportStar(require("./GenerativeAIService"), exports);
|
|
20
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./LeadAnalysis"), exports);
|
|
21
20
|
__exportStar(require("./LLMService"), exports);
|
|
22
|
-
__exportStar(require("./PromptGenerator"), exports);
|
|
23
21
|
__exportStar(require("./Prompt"), exports);
|
|
22
|
+
__exportStar(require("./PromptGenerator"), exports);
|
|
23
|
+
__exportStar(require("./ResponseParser"), exports);
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/lib/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,iDAA+B;AAC/B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,wDAAsC;AACtC,iDAA+B;AAC/B,+CAA6B;AAC7B,2CAAyB;AACzB,oDAAkC;AAClC,mDAAiC"}
|
|
@@ -56,15 +56,16 @@ const generateAnalyzeLead = ({ businessDescription, highValueLeadDescription, tr
|
|
|
56
56
|
`EMPLOYMENT_INQUIRY: The lead is inquiring about employment opportunities.\n` +
|
|
57
57
|
`OTHER: The content of the lead could not be determined by the transcript provided.\n\n` +
|
|
58
58
|
`Next, determine the urgency of the lead. The urgency can be LOW, MEDIUM, HIGH, or URGENT which are defined as the following:\n` +
|
|
59
|
-
`LOW: The lead is not time sensitive and can be addressed at the convenience
|
|
60
|
-
`MEDIUM: The lead is
|
|
61
|
-
`HIGH: The lead is
|
|
62
|
-
`URGENT: The lead is
|
|
59
|
+
`LOW: The lead requests a service that is not time sensitive at all and can be addressed at the business's convenience.\n` +
|
|
60
|
+
`MEDIUM: The lead requests a service that is not time sensitive and can be addressed within a couple weeks.\n` +
|
|
61
|
+
`HIGH: The lead requests some service that is not life threatening, but should be addressed within a few days.\n` +
|
|
62
|
+
`URGENT: The lead requests some service that is life threatening or is causing property damage. It should be addressed as soon as possible.\n` +
|
|
63
63
|
`NOT_SPECIFIED: The urgency of the lead could not be determined by the content of the transcript.\n\n` +
|
|
64
64
|
`Next, determine if the lead is a high value lead. A high value lead is defined as "${getHighValueLeadDescription(highValueLeadDescription)}".\n\n` +
|
|
65
|
-
`
|
|
65
|
+
`Next, provide a summary of the conversation. The summary should not exceed 250 characters.\n\n` +
|
|
66
|
+
`Finally, provide your analysis of why you made these decisions. The summary should not exceed 250 characters.\n\n` +
|
|
66
67
|
`Please provide your analysis in the following format:\n\n` +
|
|
67
|
-
`<Contact Type>::<Urgency Type>::<High Value Lead (true/false)>::<Summary>`
|
|
68
|
+
`<Contact Type>::<Urgency Type>::<High Value Lead (true/false)>::<Conversation Summary>::<Analysis>`
|
|
68
69
|
}
|
|
69
70
|
}, {
|
|
70
71
|
role: "user",
|
|
@@ -76,12 +77,13 @@ const generateAnalyzeLead = ({ businessDescription, highValueLeadDescription, tr
|
|
|
76
77
|
};
|
|
77
78
|
exports.generateAnalyzeLead = generateAnalyzeLead;
|
|
78
79
|
const analyzeLeadResponseParse = (response) => {
|
|
79
|
-
const [contactType, urgencyType, highValueLead, summary] = response.split("::");
|
|
80
|
+
const [contactType, urgencyType, highValueLead, summary, analysis] = response.split("::");
|
|
80
81
|
return {
|
|
81
82
|
contactType: (contactType === null || contactType === void 0 ? void 0 : contactType.toUpperCase()) || "OTHER",
|
|
82
83
|
urgencyType: (urgencyType === null || urgencyType === void 0 ? void 0 : urgencyType.toUpperCase()) || "NOT_SPECIFIED",
|
|
83
84
|
highValueLead: (highValueLead === null || highValueLead === void 0 ? void 0 : highValueLead.toLocaleLowerCase()) === "true",
|
|
84
|
-
summary: summary || "A summary could not be generated."
|
|
85
|
+
summary: summary || "A summary could not be generated.",
|
|
86
|
+
analysis: analysis || "An analysis could not be generated."
|
|
85
87
|
};
|
|
86
88
|
};
|
|
87
89
|
exports.analyzeLeadResponseParse = analyzeLeadResponseParse;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyzeLead.js","sourceRoot":"","sources":["../../src/prompts/AnalyzeLead.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AA4BlC,kDAEC;AAQD,kEAEC;AAvBD,SAAS,OAAO,CAAC,OAA8C;IAC3D,mCAAmC;IACnC,OAAO,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,SAAS,CAAC;AACvE,CAAC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,UAAsC;IACtE,OAAO,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AAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACL,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBACnD;aACJ,CAAC,IACL;AACL,CAAC,CAAA;AAjDY,QAAA,mBAAmB,uBAiD/B;AAEM,MAAM,wBAAwB,GAAiC,CAAC,QAAQ,EAAE,EAAE;IAC/E,MAAM,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE1F,OAAO;QACH,WAAW,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAAiC,KAAI,OAAO;QACjF,WAAW,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,WAAW,EAA6B,KAAI,eAAe;QACrF,aAAa,EAAE,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,iBAAiB,EAAE,MAAK,MAAM;QAC5D,OAAO,EAAE,OAAO,IAAI,mCAAmC;QACvD,QAAQ,EAAE,QAAQ,IAAI,qCAAqC;KAC9D,CAAC;AACN,CAAC,CAAA;AAVY,QAAA,wBAAwB,4BAUpC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2024, XAPP AI */
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
__exportStar(require("./AnalyzeLead"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,gDAA8B"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.62.
|
|
7
|
+
"version": "1.62.41",
|
|
8
8
|
"description": "Generative AI Service",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\"",
|
|
39
39
|
"local": "npm run test"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "e12e5ca62659db51c217c978348fdd76b244a4d1"
|
|
42
42
|
}
|