@xapp/stentor-service-generative-ai 1.83.0 → 1.89.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.
- package/package.json +6 -6
- package/lib/AWSBedrockService.d.ts +0 -67
- package/lib/AWSBedrockService.js +0 -133
- package/lib/AWSBedrockService.js.map +0 -1
- package/lib/ClaudeService.d.ts +0 -77
- package/lib/ClaudeService.js +0 -142
- package/lib/ClaudeService.js.map +0 -1
- package/lib/FallbackLLMService.d.ts +0 -46
- package/lib/FallbackLLMService.js +0 -83
- package/lib/FallbackLLMService.js.map +0 -1
- package/lib/GenerativeAIService.d.ts +0 -40
- package/lib/GenerativeAIService.js +0 -108
- package/lib/GenerativeAIService.js.map +0 -1
- package/lib/OpenAIService.d.ts +0 -33
- package/lib/OpenAIService.js +0 -76
- package/lib/OpenAIService.js.map +0 -1
- package/lib/http/HTTPService.d.ts +0 -18
- package/lib/http/HTTPService.js +0 -4
- package/lib/http/HTTPService.js.map +0 -1
- package/lib/http/NodeHTTPService.d.ts +0 -8
- package/lib/http/NodeHTTPService.js +0 -70
- package/lib/http/NodeHTTPService.js.map +0 -1
- package/lib/http/index.d.ts +0 -3
- package/lib/http/index.js +0 -20
- package/lib/http/index.js.map +0 -1
- package/lib/index.d.ts +0 -10
- package/lib/index.js +0 -27
- package/lib/index.js.map +0 -1
- package/lib/models/ChatSummary.d.ts +0 -10
- package/lib/models/ChatSummary.js +0 -4
- package/lib/models/ChatSummary.js.map +0 -1
- package/lib/models/EmailAnalysis.d.ts +0 -73
- package/lib/models/EmailAnalysis.js +0 -4
- package/lib/models/EmailAnalysis.js.map +0 -1
- package/lib/models/GenerativeAIService.d.ts +0 -55
- package/lib/models/GenerativeAIService.js +0 -3
- package/lib/models/GenerativeAIService.js.map +0 -1
- package/lib/models/LLMService.d.ts +0 -24
- package/lib/models/LLMService.js +0 -4
- package/lib/models/LLMService.js.map +0 -1
- package/lib/models/LeadAnalysis.d.ts +0 -105
- package/lib/models/LeadAnalysis.js +0 -4
- package/lib/models/LeadAnalysis.js.map +0 -1
- package/lib/models/Prompt.d.ts +0 -37
- package/lib/models/Prompt.js +0 -8
- package/lib/models/Prompt.js.map +0 -1
- package/lib/models/PromptGenerator.d.ts +0 -6
- package/lib/models/PromptGenerator.js +0 -4
- package/lib/models/PromptGenerator.js.map +0 -1
- package/lib/models/ResponseParser.d.ts +0 -5
- package/lib/models/ResponseParser.js +0 -4
- package/lib/models/ResponseParser.js.map +0 -1
- package/lib/models/WebsiteAnalysis.d.ts +0 -48
- package/lib/models/WebsiteAnalysis.js +0 -4
- package/lib/models/WebsiteAnalysis.js.map +0 -1
- package/lib/models/errors.d.ts +0 -7
- package/lib/models/errors.js +0 -15
- package/lib/models/errors.js.map +0 -1
- package/lib/models/index.d.ts +0 -9
- package/lib/models/index.js +0 -26
- package/lib/models/index.js.map +0 -1
- package/lib/prompts/AnalyzeEmail.d.ts +0 -36
- package/lib/prompts/AnalyzeEmail.js +0 -385
- package/lib/prompts/AnalyzeEmail.js.map +0 -1
- package/lib/prompts/AnalyzeLead.d.ts +0 -59
- package/lib/prompts/AnalyzeLead.js +0 -396
- package/lib/prompts/AnalyzeLead.js.map +0 -1
- package/lib/prompts/AnalyzeWebsite.d.ts +0 -10
- package/lib/prompts/AnalyzeWebsite.js +0 -176
- package/lib/prompts/AnalyzeWebsite.js.map +0 -1
- package/lib/prompts/ChatSummary.d.ts +0 -62
- package/lib/prompts/ChatSummary.js +0 -67
- package/lib/prompts/ChatSummary.js.map +0 -1
- package/lib/prompts/index.d.ts +0 -4
- package/lib/prompts/index.js +0 -21
- package/lib/prompts/index.js.map +0 -1
- package/lib/utils/extractJSON.d.ts +0 -10
- package/lib/utils/extractJSON.js +0 -17
- package/lib/utils/extractJSON.js.map +0 -1
- package/lib/utils/standardizeTerms.d.ts +0 -15
- package/lib/utils/standardizeTerms.js +0 -53
- package/lib/utils/standardizeTerms.js.map +0 -1
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GenerativeAIService = void 0;
|
|
13
|
-
const AnalyzeEmail_1 = require("./prompts/AnalyzeEmail");
|
|
14
|
-
const AnalyzeLead_1 = require("./prompts/AnalyzeLead");
|
|
15
|
-
const prompts_1 = require("./prompts");
|
|
16
|
-
const AnalyzeWebsite_1 = require("./prompts/AnalyzeWebsite");
|
|
17
|
-
class GenerativeAIService {
|
|
18
|
-
constructor(llmService) {
|
|
19
|
-
this.llmService = llmService;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Executes a custom prompt that the user is responsible for creating and parsing.
|
|
23
|
-
*
|
|
24
|
-
* @param prompt
|
|
25
|
-
*/
|
|
26
|
-
customPrompt(prompt) {
|
|
27
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
return this.llmService.generate(prompt);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Can take in an external lead and help summarize and classify.
|
|
33
|
-
*
|
|
34
|
-
* @param lead
|
|
35
|
-
*/
|
|
36
|
-
analyzeLead(lead, options) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const prompt = (0, AnalyzeLead_1.generateAnalyzeLead)({
|
|
39
|
-
channel: lead.source,
|
|
40
|
-
businessDescription: (options === null || options === void 0 ? void 0 : options.businessDescription) || "",
|
|
41
|
-
highValueLeadDescription: (options === null || options === void 0 ? void 0 : options.highValueLeadDescription) || "",
|
|
42
|
-
fields: lead.fields,
|
|
43
|
-
transcript: lead.transcript
|
|
44
|
-
});
|
|
45
|
-
const llmResponse = yield this.llmService.generate(prompt, {
|
|
46
|
-
timeout: options === null || options === void 0 ? void 0 : options.timeout
|
|
47
|
-
});
|
|
48
|
-
const analysis = (0, AnalyzeLead_1.analyzeLeadResponseParse)(llmResponse.text);
|
|
49
|
-
// remove highValueLead if a description is not provided
|
|
50
|
-
if (!(options === null || options === void 0 ? void 0 : options.highValueLeadDescription)) {
|
|
51
|
-
delete analysis.highValueLead;
|
|
52
|
-
}
|
|
53
|
-
analysis.analysisVersion = "1.2.0"; // Update this version when the analysis process changes
|
|
54
|
-
return analysis;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Analyze an inbound email (or email thread) to classify and extract lead information.
|
|
59
|
-
*
|
|
60
|
-
* Combines lead classification (contactType, serviceType, jobType, urgency) with
|
|
61
|
-
* structured contact extraction in a single LLM call. Handles direct customer emails,
|
|
62
|
-
* FSM/CRM lead notification emails, and multi-email threads.
|
|
63
|
-
*
|
|
64
|
-
* @param email - The email content and optional thread history to analyze.
|
|
65
|
-
* @param options - Optional business context and LLM call options.
|
|
66
|
-
*/
|
|
67
|
-
analyzeEmail(email, options) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const prompt = (0, AnalyzeEmail_1.generateAnalyzeEmail)({
|
|
70
|
-
businessDescription: (options === null || options === void 0 ? void 0 : options.businessDescription) || "",
|
|
71
|
-
highValueLeadDescription: (options === null || options === void 0 ? void 0 : options.highValueLeadDescription) || "",
|
|
72
|
-
email
|
|
73
|
-
});
|
|
74
|
-
const llmResponse = yield this.llmService.generate(prompt, {
|
|
75
|
-
timeout: options === null || options === void 0 ? void 0 : options.timeout
|
|
76
|
-
});
|
|
77
|
-
const analysis = (0, AnalyzeEmail_1.analyzeEmailResponseParse)(llmResponse.text);
|
|
78
|
-
// remove highValueLead if a description is not provided
|
|
79
|
-
if (!(options === null || options === void 0 ? void 0 : options.highValueLeadDescription)) {
|
|
80
|
-
delete analysis.highValueLead;
|
|
81
|
-
}
|
|
82
|
-
analysis.analysisVersion = AnalyzeEmail_1.ANALYZE_EMAIL_VERSION;
|
|
83
|
-
return analysis;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Summarize a chat transcript
|
|
88
|
-
* @param transcript
|
|
89
|
-
* @returns Returns the summarized chat of a lead transcript
|
|
90
|
-
*/
|
|
91
|
-
summarizeChatFromTranscript(transcript) {
|
|
92
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
const prompt = (0, prompts_1.generateChatSummaryPromptFromLeadTranscript)({ transcript });
|
|
94
|
-
const llmResponse = yield this.llmService.generate(prompt);
|
|
95
|
-
return (0, prompts_1.chatSummaryResponseParse)(llmResponse.text);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
analyzeWebsite(markdown, data) {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
const { url } = data;
|
|
101
|
-
const prompt = (0, AnalyzeWebsite_1.generateAnalyzeWebsite)({ markdown, url });
|
|
102
|
-
const llmResponse = yield this.llmService.generate(prompt);
|
|
103
|
-
return (0, AnalyzeWebsite_1.parseAnalyzeWebsiteResponse)(llmResponse.text);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
exports.GenerativeAIService = GenerativeAIService;
|
|
108
|
-
//# sourceMappingURL=GenerativeAIService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GenerativeAIService.js","sourceRoot":"","sources":["../src/GenerativeAIService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAcA,yDAAgH;AAChH,uD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MAAM,CAAC,CAAC;YAC3D,OAAO,IAAA,4CAA2B,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;KAAA;CACJ;AA/FD,kDA+FC"}
|
package/lib/OpenAIService.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
import type { APIKeyGetter, LLMService, LLMServiceResponse, Prompt } from "./models";
|
|
3
|
-
import type { HTTPService } from "./http/HTTPService";
|
|
4
|
-
export declare const DEFAULT_OPEN_AI_URL = "https://api.openai.com";
|
|
5
|
-
export interface OpenAIServiceProps {
|
|
6
|
-
/**
|
|
7
|
-
* Returns the API key to use for the OpenAI service authorization
|
|
8
|
-
*/
|
|
9
|
-
keyGetter: APIKeyGetter;
|
|
10
|
-
/**
|
|
11
|
-
* The HTTP service to use for making requests
|
|
12
|
-
*
|
|
13
|
-
* Defaults to a Node.js HTTP service if not provided.
|
|
14
|
-
*/
|
|
15
|
-
httpService?: Pick<HTTPService, "post">;
|
|
16
|
-
/**
|
|
17
|
-
* The base URL for the OpenAI service
|
|
18
|
-
*/
|
|
19
|
-
openAIUrl?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare class OpenAIService implements LLMService {
|
|
22
|
-
private readonly keyGetter;
|
|
23
|
-
private readonly openAIUrl;
|
|
24
|
-
private readonly httpService;
|
|
25
|
-
constructor(props: OpenAIServiceProps);
|
|
26
|
-
generate(prompt: Prompt, options?: {
|
|
27
|
-
timeout?: number;
|
|
28
|
-
}): Promise<LLMServiceResponse>;
|
|
29
|
-
completions(prompt: Prompt, options?: {
|
|
30
|
-
timeout?: number;
|
|
31
|
-
}): Promise<LLMServiceResponse>;
|
|
32
|
-
private post;
|
|
33
|
-
}
|
package/lib/OpenAIService.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.OpenAIService = exports.DEFAULT_OPEN_AI_URL = void 0;
|
|
25
|
-
const models_1 = require("./models");
|
|
26
|
-
const http_1 = require("./http");
|
|
27
|
-
exports.DEFAULT_OPEN_AI_URL = "https://api.openai.com";
|
|
28
|
-
class OpenAIService {
|
|
29
|
-
constructor(props) {
|
|
30
|
-
this.keyGetter = props.keyGetter;
|
|
31
|
-
this.openAIUrl = props.openAIUrl || exports.DEFAULT_OPEN_AI_URL;
|
|
32
|
-
this.httpService = props.httpService || new http_1.NodeHttpService();
|
|
33
|
-
}
|
|
34
|
-
generate(prompt, options) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const { type } = prompt;
|
|
37
|
-
if (type === "completions") {
|
|
38
|
-
return this.completions(prompt, options);
|
|
39
|
-
}
|
|
40
|
-
throw new models_1.InvalidPromptTypeError(type);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
completions(prompt, options) {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const { type } = prompt, remainingPrompt = __rest(prompt, ["type"]);
|
|
46
|
-
const response = yield this.post({
|
|
47
|
-
path: "v1/chat/completions",
|
|
48
|
-
body: Object.assign({}, remainingPrompt)
|
|
49
|
-
}, options);
|
|
50
|
-
let content;
|
|
51
|
-
try {
|
|
52
|
-
content = JSON.parse(response.body).choices[0].message.content;
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
content = response.body;
|
|
56
|
-
}
|
|
57
|
-
return { text: content };
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
post(props, options) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const apiKey = yield this.keyGetter();
|
|
63
|
-
const response = yield this.httpService.post({
|
|
64
|
-
url: `${this.openAIUrl}/${props.path}`,
|
|
65
|
-
body: props.body,
|
|
66
|
-
headers: {
|
|
67
|
-
Authorization: `Bearer ${apiKey}`
|
|
68
|
-
},
|
|
69
|
-
timeout: options === null || options === void 0 ? void 0 : options.timeout
|
|
70
|
-
});
|
|
71
|
-
return response;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.OpenAIService = OpenAIService;
|
|
76
|
-
//# sourceMappingURL=OpenAIService.js.map
|
package/lib/OpenAIService.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenAIService.js","sourceRoot":"","sources":["../src/OpenAIService.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;AAGlC,qCAAkD;AAElD,iCAAyC;AAE5B,QAAA,mBAAmB,GAAG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AAC,SAAS,EAAE,CAAC;YACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBACzC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE;gBACtC,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,OAAO,EAAE;oBACL,aAAa,EAAE,UAAU,MAAM,EAAE;iBACpC;gBACD,OAAO,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO;aAC5B,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ;AAtDD,sCAsDC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
export type Headers = Record<string, string | number>;
|
|
3
|
-
export interface PostProps {
|
|
4
|
-
url: string | URL;
|
|
5
|
-
body: string | object;
|
|
6
|
-
headers?: Headers;
|
|
7
|
-
/**
|
|
8
|
-
* Optional timeout in milliseconds for the request.
|
|
9
|
-
*/
|
|
10
|
-
timeout?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface Response {
|
|
13
|
-
status: number;
|
|
14
|
-
body: string;
|
|
15
|
-
}
|
|
16
|
-
export interface HTTPService {
|
|
17
|
-
post(props: PostProps): Promise<Response>;
|
|
18
|
-
}
|
package/lib/http/HTTPService.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HTTPService.js","sourceRoot":"","sources":["../../src/http/HTTPService.ts"],"names":[],"mappings":";AAAA,kCAAkC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { HTTPService, PostProps, Response } from "./HTTPService";
|
|
2
|
-
export declare class NodeHttpService implements HTTPService {
|
|
3
|
-
post(props: PostProps): Promise<Response>;
|
|
4
|
-
}
|
|
5
|
-
export declare class InvalidHTTPUrlError extends Error {
|
|
6
|
-
name: string;
|
|
7
|
-
constructor(url: string);
|
|
8
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
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.InvalidHTTPUrlError = exports.NodeHttpService = void 0;
|
|
7
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
8
|
-
const http_1 = __importDefault(require("http"));
|
|
9
|
-
const https_1 = __importDefault(require("https"));
|
|
10
|
-
class NodeHttpService {
|
|
11
|
-
post(props) {
|
|
12
|
-
var _a;
|
|
13
|
-
const url = new URL(props.url);
|
|
14
|
-
const http = retrieveHttp(url);
|
|
15
|
-
const bodyIsObject = typeof props.body !== "string";
|
|
16
|
-
const postData = typeof props.body === "string" ? props.body : JSON.stringify(props.body);
|
|
17
|
-
const baseHeaders = {
|
|
18
|
-
"Content-Length": Buffer.byteLength(postData)
|
|
19
|
-
};
|
|
20
|
-
if (bodyIsObject) {
|
|
21
|
-
baseHeaders["Content-Type"] = "application/json";
|
|
22
|
-
}
|
|
23
|
-
const timeoutMs = (_a = props.timeout) !== null && _a !== void 0 ? _a : 30000; // Optional timeout from props or default
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
const request = http.request({
|
|
26
|
-
host: url.hostname, // use hostname, not host
|
|
27
|
-
port: url.port || (url.protocol === "https:" ? 443 : 80),
|
|
28
|
-
path: url.pathname + url.search, // include query params
|
|
29
|
-
method: "POST",
|
|
30
|
-
headers: Object.assign(Object.assign({}, props.headers), baseHeaders)
|
|
31
|
-
}, (response) => {
|
|
32
|
-
let body = "";
|
|
33
|
-
response.setEncoding("utf-8");
|
|
34
|
-
response.on("data", (chunk) => (body += chunk));
|
|
35
|
-
response.on("end", () => resolve({ body, status: response.statusCode }));
|
|
36
|
-
response.on("error", (err) => reject(err));
|
|
37
|
-
});
|
|
38
|
-
request.setTimeout(timeoutMs, () => {
|
|
39
|
-
request.destroy(new Error(`Request timed out after ${timeoutMs}ms`));
|
|
40
|
-
});
|
|
41
|
-
request.on("error", (err) => reject(err));
|
|
42
|
-
request.write(postData);
|
|
43
|
-
request.end();
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.NodeHttpService = NodeHttpService;
|
|
48
|
-
class InvalidHTTPUrlError extends Error {
|
|
49
|
-
constructor(url) {
|
|
50
|
-
super(`Unable to decipher URL: ${url}`);
|
|
51
|
-
this.name = InvalidHTTPUrlError.name;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.InvalidHTTPUrlError = InvalidHTTPUrlError;
|
|
55
|
-
/**
|
|
56
|
-
* Retrieves the proper HTTP node module based on the url.
|
|
57
|
-
*
|
|
58
|
-
* @param url
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
function retrieveHttp(url) {
|
|
62
|
-
if (url.toString().startsWith("https")) {
|
|
63
|
-
return https_1.default;
|
|
64
|
-
}
|
|
65
|
-
else if (url.toString().startsWith("http")) {
|
|
66
|
-
return http_1.default;
|
|
67
|
-
}
|
|
68
|
-
throw new InvalidHTTPUrlError(url.toString());
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=NodeHTTPService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeHTTPService.js","sourceRoot":"","sources":["../../src/http/NodeHTTPService.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAkC;AAClC,gDAAwB;AACxB,kDAA0B;AAI1B,MAAa,eAAe;IACxB,IAAI,CAAC,KAAgB;;QACjB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAE/B,MAAM,YAAY,GAAG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;QACpD,MAAM,QAAQ,G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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
|
package/lib/http/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
export * from "./AWSBedrockService";
|
|
3
|
-
export * from "./ClaudeService";
|
|
4
|
-
export * from "./FallbackLLMService";
|
|
5
|
-
export * from "./GenerativeAIService";
|
|
6
|
-
export * from "./OpenAIService";
|
|
7
|
-
export * from "./http";
|
|
8
|
-
export * from "./models";
|
|
9
|
-
export * from "./prompts";
|
|
10
|
-
export * from "./utils/standardizeTerms";
|
package/lib/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
18
|
-
__exportStar(require("./AWSBedrockService"), exports);
|
|
19
|
-
__exportStar(require("./ClaudeService"), exports);
|
|
20
|
-
__exportStar(require("./FallbackLLMService"), exports);
|
|
21
|
-
__exportStar(require("./GenerativeAIService"), exports);
|
|
22
|
-
__exportStar(require("./OpenAIService"), exports);
|
|
23
|
-
__exportStar(require("./http"), exports);
|
|
24
|
-
__exportStar(require("./models"), exports);
|
|
25
|
-
__exportStar(require("./prompts"), exports);
|
|
26
|
-
__exportStar(require("./utils/standardizeTerms"), exports);
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,kCAAkC;AAClC,sDAAoC;AACpC,kDAAgC;AAChC,uDAAqC;AACrC,wDAAsC;AACtC,kDAAgC;AAChC,yCAAuB;AACvB,2CAAyB;AACzB,4CAA0B;AAC1B,2DAAyC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
/**
|
|
3
|
-
* A quick summary returned by the LLM which summerizes the a chat widget transcript.
|
|
4
|
-
*/
|
|
5
|
-
export interface ChatSummary {
|
|
6
|
-
/**
|
|
7
|
-
* The summary that is returned by the LLM or undefined if the LLM failed.
|
|
8
|
-
*/
|
|
9
|
-
summary: string | undefined;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSummary.js","sourceRoot":"","sources":["../../src/models/ChatSummary.ts"],"names":[],"mappings":";AAAA,kCAAkC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
-
import type { LeadAnalysis } from "./LeadAnalysis";
|
|
3
|
-
export interface EmailThreadMessage {
|
|
4
|
-
role: "customer" | "agent" | "fsm_crm";
|
|
5
|
-
content: string;
|
|
6
|
-
timestamp?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface EmailSender {
|
|
9
|
-
name?: string;
|
|
10
|
-
email: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Represents an inbound email (or email thread) to be analyzed.
|
|
14
|
-
*/
|
|
15
|
-
export interface EmailAnalysisInput {
|
|
16
|
-
/**
|
|
17
|
-
* The email subject line.
|
|
18
|
-
*/
|
|
19
|
-
subject: string;
|
|
20
|
-
/**
|
|
21
|
-
* The email body text. May include an email signature or quoted reply chains — the
|
|
22
|
-
* LLM is instructed to ignore those sections.
|
|
23
|
-
*/
|
|
24
|
-
body: string;
|
|
25
|
-
/**
|
|
26
|
-
* The sender of the current (most recent) email.
|
|
27
|
-
*/
|
|
28
|
-
from?: EmailSender;
|
|
29
|
-
/**
|
|
30
|
-
* Prior messages in the email thread, oldest first. Used to provide conversation
|
|
31
|
-
* context when the current email is a reply in an ongoing thread.
|
|
32
|
-
*/
|
|
33
|
-
threadHistory?: EmailThreadMessage[];
|
|
34
|
-
/**
|
|
35
|
-
* Raw email headers (e.g., Reply-To, X-Mailer). Provides additional context
|
|
36
|
-
* for the LLM to disambiguate the actual contact from template senders
|
|
37
|
-
* (e.g., Jobber, ServiceTitan). Values must be strings; if a header has
|
|
38
|
-
* multiple values, join them before passing.
|
|
39
|
-
*/
|
|
40
|
-
headers?: Record<string, string>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Structured contact information extracted from an email body, particularly useful
|
|
44
|
-
* for FSM/CRM system notification emails (Jobber, ServiceTitan, Housecall Pro, etc.)
|
|
45
|
-
* that embed lead data in a structured text format.
|
|
46
|
-
*/
|
|
47
|
-
export interface ExtractedContactInfo {
|
|
48
|
-
fullName?: string;
|
|
49
|
-
phone?: string;
|
|
50
|
-
email?: string;
|
|
51
|
-
address?: string;
|
|
52
|
-
city?: string;
|
|
53
|
-
state?: string;
|
|
54
|
-
zip?: string;
|
|
55
|
-
propertyType?: "residential" | "commercial";
|
|
56
|
-
preferredContactTime?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Confidence score from 0.0 (low) to 1.0 (high) indicating how confident the LLM
|
|
59
|
-
* is in the extracted contact information.
|
|
60
|
-
*/
|
|
61
|
-
confidence: number;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Extends the standard LeadAnalysis with email-specific contact extraction fields.
|
|
65
|
-
* Returned by `GenerativeAIService.analyzeEmail()`.
|
|
66
|
-
*/
|
|
67
|
-
export interface EmailLeadAnalysis extends LeadAnalysis {
|
|
68
|
-
/**
|
|
69
|
-
* Contact information extracted from the email body. Only populated when the LLM
|
|
70
|
-
* can identify structured contact data (e.g., in FSM/CRM notification emails).
|
|
71
|
-
*/
|
|
72
|
-
extractedContact?: ExtractedContactInfo;
|
|
73
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EmailAnalysis.js","sourceRoot":"","sources":["../../src/models/EmailAnalysis.ts"],"names":[],"mappings":";AAAA,kCAAkC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
-
import type { ExternalLead } from "stentor-models";
|
|
3
|
-
import type { EmailAnalysisInput, EmailLeadAnalysis } from "./EmailAnalysis";
|
|
4
|
-
import type { LeadAnalysis } from "./LeadAnalysis";
|
|
5
|
-
import type { WebsiteAnalysis } from "./WebsiteAnalysis";
|
|
6
|
-
import type { ChatSummary } from "./ChatSummary";
|
|
7
|
-
import { Prompt } from "./Prompt";
|
|
8
|
-
import { LLMServiceResponse } from "./LLMService";
|
|
9
|
-
export type AnalyzeWebsiteData = {
|
|
10
|
-
url: string;
|
|
11
|
-
};
|
|
12
|
-
export interface BaseOptions {
|
|
13
|
-
timeout?: number;
|
|
14
|
-
}
|
|
15
|
-
export interface AnalyzeLeadOptions extends BaseOptions {
|
|
16
|
-
businessDescription?: string;
|
|
17
|
-
highValueLeadDescription?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface IGenerativeAIService {
|
|
20
|
-
/**
|
|
21
|
-
* Executes a custom prompt that the user is responsible for creating and parsing.
|
|
22
|
-
*
|
|
23
|
-
* @param prompt
|
|
24
|
-
*/
|
|
25
|
-
customPrompt(prompt: Prompt): Promise<LLMServiceResponse>;
|
|
26
|
-
/**
|
|
27
|
-
* Analyze a lead to find summary
|
|
28
|
-
* @param lead
|
|
29
|
-
*/
|
|
30
|
-
analyzeLead(lead: ExternalLead): Promise<LeadAnalysis>;
|
|
31
|
-
/**
|
|
32
|
-
* Analyze an inbound email (or email thread) to classify and extract lead information.
|
|
33
|
-
*
|
|
34
|
-
* Combines lead classification (contactType, serviceType, jobType, urgency) with
|
|
35
|
-
* structured contact extraction in a single LLM call. Handles direct customer emails,
|
|
36
|
-
* FSM/CRM lead notification emails, and multi-email threads.
|
|
37
|
-
*
|
|
38
|
-
* @param email - The email content and optional thread history to analyze.
|
|
39
|
-
* @param options - Optional business context and LLM call options.
|
|
40
|
-
*/
|
|
41
|
-
analyzeEmail(email: EmailAnalysisInput, options?: AnalyzeLeadOptions): Promise<EmailLeadAnalysis>;
|
|
42
|
-
/**
|
|
43
|
-
* Summarize a chat transcript
|
|
44
|
-
* @param transcript
|
|
45
|
-
* @returns Returns the summarized chat of a lead transcript
|
|
46
|
-
*/
|
|
47
|
-
summarizeChatFromTranscript(transcript: ExternalLead["transcript"]): Promise<ChatSummary>;
|
|
48
|
-
/**
|
|
49
|
-
* Analyze a website to find information about the business, such as contact information, about us, and more.
|
|
50
|
-
*
|
|
51
|
-
* @param markdown
|
|
52
|
-
* @param data
|
|
53
|
-
*/
|
|
54
|
-
analyzeWebsite(markdown: string, data: AnalyzeWebsiteData): Promise<WebsiteAnalysis>;
|
|
55
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GenerativeAIService.js","sourceRoot":"","sources":["../../src/models/GenerativeAIService.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
-
import { Prompt } from "./Prompt";
|
|
3
|
-
/**
|
|
4
|
-
* A function that returns an API key, either synchronously or asynchronously
|
|
5
|
-
*/
|
|
6
|
-
export type APIKeyGetter = () => string | Promise<string>;
|
|
7
|
-
export interface LLMServiceResponse {
|
|
8
|
-
text: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* A service that can generate text based on a prompt sent to an LLM Service
|
|
12
|
-
*/
|
|
13
|
-
export interface LLMService {
|
|
14
|
-
/**
|
|
15
|
-
* Generate a response based on the input
|
|
16
|
-
* @param input
|
|
17
|
-
* @param options - Optional parameters for the generation, such as timeout
|
|
18
|
-
* @returns A promise that resolves to the response from the LLM Service
|
|
19
|
-
* @throws Error if the LLM Service is not available or the prompt is invalid
|
|
20
|
-
*/
|
|
21
|
-
generate(prompt: Prompt, options?: {
|
|
22
|
-
timeout?: number;
|
|
23
|
-
}): Promise<LLMServiceResponse>;
|
|
24
|
-
}
|
package/lib/models/LLMService.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LLMService.js","sourceRoot":"","sources":["../../src/models/LLMService.ts"],"names":[],"mappings":";AAAA,kCAAkC"}
|