@xapp/stentor-service-generative-ai 2.2.3 → 2.3.1
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 +10 -0
- package/lib/GenerativeAIService.js +29 -0
- package/lib/GenerativeAIService.js.map +1 -1
- package/lib/models/CallAnalysis.d.ts +39 -0
- package/lib/models/CallAnalysis.js +25 -0
- package/lib/models/CallAnalysis.js.map +1 -0
- package/lib/models/GenerativeAIService.d.ts +9 -0
- package/lib/models/LeadAnalysis.d.ts +2 -2
- package/lib/models/LeadAnalysis.js +2 -2
- package/lib/models/LeadAnalysis.js.map +1 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.js +1 -0
- package/lib/models/index.js.map +1 -1
- package/lib/prompts/AnalyzeCall.d.ts +25 -0
- package/lib/prompts/AnalyzeCall.js +248 -0
- package/lib/prompts/AnalyzeCall.js.map +1 -0
- package/lib/prompts/AnalyzeEmail.d.ts +12 -3
- package/lib/prompts/AnalyzeEmail.js +41 -13
- package/lib/prompts/AnalyzeEmail.js.map +1 -1
- package/lib/prompts/AnalyzeLead.d.ts +4 -1
- package/lib/prompts/AnalyzeLead.js +4 -1
- package/lib/prompts/AnalyzeLead.js.map +1 -1
- package/lib/prompts/index.d.ts +1 -0
- package/lib/prompts/index.js +1 -0
- package/lib/prompts/index.js.map +1 -1
- package/lib/prompts/leadTaxonomyPrompt.js +2 -0
- package/lib/prompts/leadTaxonomyPrompt.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
2
|
import type { ExternalLead, Message } from "stentor-models";
|
|
3
3
|
import type { AnalyzeLeadOptions, AnalyzeWebsiteData, EngagementAnalysis, EngagementAnalysisConfig, IGenerativeAIService, LeadAnalysis, LLMService, LLMServiceResponse, Prompt } from "./models";
|
|
4
|
+
import type { CallAnalysisInput, CallLeadAnalysis } from "./models/CallAnalysis";
|
|
4
5
|
import type { EmailAnalysisInput, EmailLeadAnalysis } from "./models/EmailAnalysis";
|
|
5
6
|
import type { ChatSummary } from "./models/ChatSummary";
|
|
6
7
|
import { WebsiteAnalysis } from "./models/WebsiteAnalysis";
|
|
@@ -30,6 +31,15 @@ export declare class GenerativeAIService implements IGenerativeAIService {
|
|
|
30
31
|
* @param options - Optional business context and LLM call options.
|
|
31
32
|
*/
|
|
32
33
|
analyzeEmail(email: EmailAnalysisInput, options?: AnalyzeLeadOptions): Promise<EmailLeadAnalysis>;
|
|
34
|
+
/**
|
|
35
|
+
* Analyze a phone call to the business, from an AI phone agent or a call recording's transcript:
|
|
36
|
+
* what happened on it, whether it is a lead, what the caller wants and the contact details they
|
|
37
|
+
* gave, with the same lead labels as `analyzeLead`.
|
|
38
|
+
*
|
|
39
|
+
* @param call - The call's transcript and what the phone system knows about it.
|
|
40
|
+
* @param options - Optional business context and LLM call options.
|
|
41
|
+
*/
|
|
42
|
+
analyzeCall(call: CallAnalysisInput, options?: AnalyzeLeadOptions): Promise<CallLeadAnalysis>;
|
|
33
43
|
/**
|
|
34
44
|
* Analyze a completed conversation transcript to derive engagement metadata: sentiment,
|
|
35
45
|
* topics, whether the AI agent contained/resolved the conversation without human handoff,
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GenerativeAIService = void 0;
|
|
13
|
+
const AnalyzeCall_1 = require("./prompts/AnalyzeCall");
|
|
13
14
|
const AnalyzeEmail_1 = require("./prompts/AnalyzeEmail");
|
|
14
15
|
const AnalyzeLead_1 = require("./prompts/AnalyzeLead");
|
|
15
16
|
const AnalyzeTranscript_1 = require("./prompts/AnalyzeTranscript");
|
|
@@ -120,6 +121,34 @@ class GenerativeAIService {
|
|
|
120
121
|
return analysis;
|
|
121
122
|
});
|
|
122
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Analyze a phone call to the business, from an AI phone agent or a call recording's transcript:
|
|
126
|
+
* what happened on it, whether it is a lead, what the caller wants and the contact details they
|
|
127
|
+
* gave, with the same lead labels as `analyzeLead`.
|
|
128
|
+
*
|
|
129
|
+
* @param call - The call's transcript and what the phone system knows about it.
|
|
130
|
+
* @param options - Optional business context and LLM call options.
|
|
131
|
+
*/
|
|
132
|
+
analyzeCall(call, options) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const prompt = (0, AnalyzeCall_1.generateAnalyzeCall)({
|
|
135
|
+
businessDescription: (options === null || options === void 0 ? void 0 : options.businessDescription) || "",
|
|
136
|
+
highValueLeadDescription: (options === null || options === void 0 ? void 0 : options.highValueLeadDescription) || "",
|
|
137
|
+
call
|
|
138
|
+
});
|
|
139
|
+
const llmResponse = yield this.llmService.generate(prompt, {
|
|
140
|
+
timeout: options === null || options === void 0 ? void 0 : options.timeout
|
|
141
|
+
});
|
|
142
|
+
const analysis = parseOrDegrade(() => (0, AnalyzeCall_1.analyzeCallResponseParse)(llmResponse.text), Object.assign({}, AnalyzeCall_1.defaultCallLeadAnalysis), "analyzeCall");
|
|
143
|
+
// remove highValueLead if a description is not provided
|
|
144
|
+
if (!(options === null || options === void 0 ? void 0 : options.highValueLeadDescription)) {
|
|
145
|
+
delete analysis.highValueLead;
|
|
146
|
+
}
|
|
147
|
+
analysis.analysisVersion = AnalyzeCall_1.ANALYZE_CALL_VERSION;
|
|
148
|
+
analysis.rawResponse = capRawResponse(llmResponse.text);
|
|
149
|
+
return analysis;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
123
152
|
/**
|
|
124
153
|
* Analyze a completed conversation transcript to derive engagement metadata: sentiment,
|
|
125
154
|
* topics, whether the AI agent contained/resolved the conversation without human handoff,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerativeAIService.js","sourceRoot":"","sources":["../src/GenerativeAIService.ts"],"names":[],"mappings":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YACzD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC3D,OAAO,IAAA,4CAA2B,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;KAAA;CACJ;AAvKD,kDAuKC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
+
import type { ExtractedContactInfo } from "./EmailAnalysis";
|
|
3
|
+
import type { LeadAnalysis } from "./LeadAnalysis";
|
|
4
|
+
/** One turn of a phone call: the AI or human agent answering for the business, or the caller. */
|
|
5
|
+
export interface CallTranscriptTurn {
|
|
6
|
+
speaker: "agent" | "caller" | "other";
|
|
7
|
+
text: string;
|
|
8
|
+
/** When it was said (ISO 8601), if the phone platform records it. */
|
|
9
|
+
at?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A phone call to analyze, from an AI phone agent (AI CSR) or a call recording's transcript.
|
|
13
|
+
* Give `turns` when the platform labels who said what, or `text` when it only has a transcript.
|
|
14
|
+
*/
|
|
15
|
+
export interface CallAnalysisInput {
|
|
16
|
+
turns?: CallTranscriptTurn[];
|
|
17
|
+
/** The transcript as plain text, used when there are no `turns`. */
|
|
18
|
+
text?: string;
|
|
19
|
+
direction?: "inbound" | "outbound";
|
|
20
|
+
durationSeconds?: number;
|
|
21
|
+
/** The caller's number from the phone system: a strong hint, though the caller may give another. */
|
|
22
|
+
callerPhone?: string;
|
|
23
|
+
}
|
|
24
|
+
/** What happened on the call, from the business's side. */
|
|
25
|
+
export declare const CALL_OUTCOMES: readonly ["booked", "quote_requested", "callback_requested", "service_requested", "information_only", "existing_customer", "spam", "wrong_number", "hang_up", "other"];
|
|
26
|
+
export type CallOutcome = (typeof CALL_OUTCOMES)[number];
|
|
27
|
+
/** Returned by `GenerativeAIService.analyzeCall()`: the lead labels, plus what happened on the call. */
|
|
28
|
+
export interface CallLeadAnalysis extends LeadAnalysis {
|
|
29
|
+
outcome: CallOutcome;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the call is a lead for the business: someone wanting service, a quote or a callback,
|
|
32
|
+
* whom the business can follow up with.
|
|
33
|
+
*/
|
|
34
|
+
leadCaptured: boolean;
|
|
35
|
+
/** What the caller wants, in their words where possible. Absent when nothing was asked for. */
|
|
36
|
+
request?: string;
|
|
37
|
+
/** Contact details the caller gave on the call. */
|
|
38
|
+
extractedContact?: ExtractedContactInfo;
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CALL_OUTCOMES = void 0;
|
|
5
|
+
/** What happened on the call, from the business's side. */
|
|
6
|
+
exports.CALL_OUTCOMES = [
|
|
7
|
+
/** An appointment or visit was booked on the call. */
|
|
8
|
+
"booked",
|
|
9
|
+
/** The caller asked for a price, estimate or quote. */
|
|
10
|
+
"quote_requested",
|
|
11
|
+
/** The caller asked to be called back, or the agent promised a callback. */
|
|
12
|
+
"callback_requested",
|
|
13
|
+
/** The caller asked for service but nothing was booked or promised on the call. */
|
|
14
|
+
"service_requested",
|
|
15
|
+
/** The caller only asked a question and got an answer. */
|
|
16
|
+
"information_only",
|
|
17
|
+
/** An existing customer calling about existing work: billing, rescheduling, a complaint. */
|
|
18
|
+
"existing_customer",
|
|
19
|
+
"spam",
|
|
20
|
+
"wrong_number",
|
|
21
|
+
/** The caller hung up or the call dropped before saying what they wanted. */
|
|
22
|
+
"hang_up",
|
|
23
|
+
"other"
|
|
24
|
+
];
|
|
25
|
+
//# sourceMappingURL=CallAnalysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CallAnalysis.js","sourceRoot":"","sources":["../../src/models/CallAnalysis.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AA2BlC,2DAA2D;AAC9C,QAAA,aAAa,GAAG;IACzB,sDAAsD;IACtD,QAAQ;IACR,uDAAuD;IACvD,iBAAiB;IACjB,4EAA4E;IAC5E,oBAAoB;IACpB,mFAAmF;IACnF,mBAAmB;IACnB,0DAA0D;IAC1D,kBAAkB;IAClB,4FAA4F;IAC5F,mBAAmB;IACnB,MAAM;IACN,cAAc;IACd,6EAA6E;IAC7E,SAAS;IACT,OAAO;CACD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
2
|
import type { ExternalLead, Message } from "stentor-models";
|
|
3
|
+
import type { CallAnalysisInput, CallLeadAnalysis } from "./CallAnalysis";
|
|
3
4
|
import type { EmailAnalysisInput, EmailLeadAnalysis } from "./EmailAnalysis";
|
|
4
5
|
import type { EngagementAnalysis, EngagementAnalysisConfig } from "./EngagementAnalysis";
|
|
5
6
|
import type { LeadAnalysis } from "./LeadAnalysis";
|
|
@@ -40,6 +41,14 @@ export interface IGenerativeAIService {
|
|
|
40
41
|
* @param options - Optional business context and LLM call options.
|
|
41
42
|
*/
|
|
42
43
|
analyzeEmail(email: EmailAnalysisInput, options?: AnalyzeLeadOptions): Promise<EmailLeadAnalysis>;
|
|
44
|
+
/**
|
|
45
|
+
* Analyze a phone call to the business: what happened, whether it is a lead, what the caller
|
|
46
|
+
* wants and the contact details they gave, with the same lead labels as `analyzeLead`.
|
|
47
|
+
*
|
|
48
|
+
* @param call - The call's transcript and what the phone system knows about it.
|
|
49
|
+
* @param options - Optional business context and LLM call options.
|
|
50
|
+
*/
|
|
51
|
+
analyzeCall(call: CallAnalysisInput, options?: AnalyzeLeadOptions): Promise<CallLeadAnalysis>;
|
|
43
52
|
/**
|
|
44
53
|
* Analyze a completed conversation transcript to derive engagement metadata: sentiment,
|
|
45
54
|
* topics, whether the AI agent contained/resolved the conversation without human handoff,
|
|
@@ -149,7 +149,7 @@ export declare const JOB_TYPE_DEFINITIONS: readonly [{
|
|
|
149
149
|
readonly definition: "Pest control services (insects, termites, rodents).";
|
|
150
150
|
}, {
|
|
151
151
|
readonly value: "plumbing";
|
|
152
|
-
readonly definition: "Plumbing
|
|
152
|
+
readonly definition: "Plumbing repair and service: leaks, clogs, pipes, water heaters, fixture repair, backflow testing, and septic.";
|
|
153
153
|
}, {
|
|
154
154
|
readonly value: "pool_spa";
|
|
155
155
|
readonly definition: "Pool and spa installation, repair, cleaning, and maintenance.";
|
|
@@ -161,7 +161,7 @@ export declare const JOB_TYPE_DEFINITIONS: readonly [{
|
|
|
161
161
|
readonly definition: "Radon testing and mitigation systems.";
|
|
162
162
|
}, {
|
|
163
163
|
readonly value: "remodeling";
|
|
164
|
-
readonly definition: "Remodeling or renovation (kitchen, bathroom, home).";
|
|
164
|
+
readonly definition: "Remodeling or renovation (kitchen, bathroom, home), including replacing or converting a shower or tub and walk-in tubs or showers.";
|
|
165
165
|
}, {
|
|
166
166
|
readonly value: "restoration";
|
|
167
167
|
readonly definition: "Water, fire, or damage restoration services.";
|
|
@@ -124,11 +124,11 @@ exports.JOB_TYPE_DEFINITIONS = [
|
|
|
124
124
|
{ value: "moving", definition: "Moving or relocation services." },
|
|
125
125
|
{ value: "painting", definition: "Painting services." },
|
|
126
126
|
{ value: "pest_control", definition: "Pest control services (insects, termites, rodents)." },
|
|
127
|
-
{ value: "plumbing", definition: "Plumbing
|
|
127
|
+
{ value: "plumbing", definition: "Plumbing repair and service: leaks, clogs, pipes, water heaters, fixture repair, backflow testing, and septic." },
|
|
128
128
|
{ value: "pool_spa", definition: "Pool and spa installation, repair, cleaning, and maintenance." },
|
|
129
129
|
{ value: "pressure_washing", definition: "Pressure washing and power washing services." },
|
|
130
130
|
{ value: "radon_mitigation", definition: "Radon testing and mitigation systems." },
|
|
131
|
-
{ value: "remodeling", definition: "Remodeling or renovation (kitchen, bathroom, home)." },
|
|
131
|
+
{ value: "remodeling", definition: "Remodeling or renovation (kitchen, bathroom, home), including replacing or converting a shower or tub and walk-in tubs or showers." },
|
|
132
132
|
{ value: "restoration", definition: "Water, fire, or damage restoration services." },
|
|
133
133
|
{ value: "roofing", definition: "Roofing services." },
|
|
134
134
|
{ value: "salon", definition: "Hair, nail, and beauty salon services." },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LeadAnalysis.js","sourceRoot":"","sources":["../../src/models/LeadAnalysis.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AAwSlC,kDA0BC;AAhUD;;;;;;;;;;;;;;;;;;;;GAoBG;AACU,QAAA,aAAa,GAAG;IACzB,eAAe;IACf,cAAc;IACd,WAAW;IACX,YAAY;IACZ,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,UAAU;IACV,eAAe;IACf,oBAAoB;IACpB,iBAAiB;IACjB,MAAM;IACN,MAAM;IACN,OAAO;CACD,CAAC;AAIX;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,aAAa,GAAG;IACzB,UAAU;IACV,cAAc;IACd,YAAY;IACZ,cAAc;IACd,aAAa;IACb,UAAU;IACV,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,OAAO;CACD,CAAC;AAIX;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACU,QAAA,oBAAoB,GAAG;IAChC,EAAE,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,4BAA4B,EAAE;IACvE,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,gEAAgE,EAAE;IACxG,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,iDAAiD,EAAE;IAClF,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,oCAAoC,EAAE;IACxE,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,wDAAwD,EAAE;IAC3F,EAAE,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,iDAAiD,EAAE;IAChG,EAAE,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,gCAAgC,EAAE;IACvE,EAAE,KAAK,EA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H,GAAG,CAAC,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAmB,CAAC,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC;IACxF,CAAC;IAED,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,0CAAE,WAAW,EAAE,CAAC;IACjD,IAAI,OAAO,EAAE,CAAC;QACV,GAAG,CAAC,OAAO,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAgB,CAAC;IAC7F,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"}
|
package/lib/models/index.d.ts
CHANGED
package/lib/models/index.js
CHANGED
|
@@ -15,6 +15,7 @@ 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("./CallAnalysis"), exports);
|
|
18
19
|
__exportStar(require("./EmailAnalysis"), exports);
|
|
19
20
|
__exportStar(require("./EngagementAnalysis"), exports);
|
|
20
21
|
__exportStar(require("./errors"), exports);
|
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,kDAAgC;AAChC,uDAAqC;AACrC,2CAAyB;AACzB,wDAAsC;AACtC,iDAA+B;AAC/B,+CAA6B;AAC7B,2CAAyB;AACzB,oDAAkC;AAClC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,iDAA+B;AAC/B,kDAAgC;AAChC,uDAAqC;AACrC,2CAAyB;AACzB,wDAAsC;AACtC,iDAA+B;AAC/B,+CAA6B;AAC7B,2CAAyB;AACzB,oDAAkC;AAClC,mDAAiC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
+
import type { CompletionPrompt, PromptGenerator, ResponseParser } from "../models";
|
|
3
|
+
import { type CallAnalysisInput, type CallLeadAnalysis } from "../models/CallAnalysis";
|
|
4
|
+
export declare const ANALYZE_CALL_VERSION = "1.0.1";
|
|
5
|
+
export interface AnalyzeCallProps {
|
|
6
|
+
businessDescription?: string;
|
|
7
|
+
highValueLeadDescription?: string;
|
|
8
|
+
call: CallAnalysisInput;
|
|
9
|
+
}
|
|
10
|
+
export type AnalyzeCallLLMOverrides = Partial<Pick<CompletionPrompt, "model" | "max_tokens" | "temperature" | "top_p" | "frequency_penalty" | "presence_penalty">>;
|
|
11
|
+
/**
|
|
12
|
+
* The call as one user message: what the phone system knows about it, then the transcript, one
|
|
13
|
+
* labelled turn per line, or the plain-text transcript as given.
|
|
14
|
+
*/
|
|
15
|
+
export declare function callToMessages(system: string, call: CallAnalysisInput): {
|
|
16
|
+
role: "system" | "user";
|
|
17
|
+
content: string;
|
|
18
|
+
}[];
|
|
19
|
+
/**
|
|
20
|
+
* Generates a prompt that analyzes a phone call to a business: what happened on it, whether it is a
|
|
21
|
+
* lead and what the caller wants, the contact details they gave, and the usual lead labels.
|
|
22
|
+
*/
|
|
23
|
+
export declare const generateAnalyzeCall: PromptGenerator<AnalyzeCallProps, AnalyzeCallLLMOverrides, CompletionPrompt>;
|
|
24
|
+
export declare const defaultCallLeadAnalysis: CallLeadAnalysis;
|
|
25
|
+
export declare const analyzeCallResponseParse: ResponseParser<CallLeadAnalysis>;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.analyzeCallResponseParse = exports.defaultCallLeadAnalysis = exports.generateAnalyzeCall = exports.ANALYZE_CALL_VERSION = void 0;
|
|
5
|
+
exports.callToMessages = callToMessages;
|
|
6
|
+
const CallAnalysis_1 = require("../models/CallAnalysis");
|
|
7
|
+
const errors_1 = require("../models/errors");
|
|
8
|
+
const LeadAnalysis_1 = require("../models/LeadAnalysis");
|
|
9
|
+
const extractJSON_1 = require("../utils/extractJSON");
|
|
10
|
+
const AnalyzeLead_1 = require("./AnalyzeLead");
|
|
11
|
+
const leadTaxonomyPrompt_1 = require("./leadTaxonomyPrompt");
|
|
12
|
+
exports.ANALYZE_CALL_VERSION = "1.0.1"; // 1.0.1: the shared jobType section gained the shower and tub rule (AnalyzeLead 1.4.2)
|
|
13
|
+
const SPEAKER_LABELS = { agent: "Agent", caller: "Caller", other: "Other" };
|
|
14
|
+
/**
|
|
15
|
+
* The call as one user message: what the phone system knows about it, then the transcript, one
|
|
16
|
+
* labelled turn per line, or the plain-text transcript as given.
|
|
17
|
+
*/
|
|
18
|
+
function callToMessages(system, call) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const facts = [
|
|
21
|
+
call.direction && `Direction: ${call.direction}`,
|
|
22
|
+
typeof call.durationSeconds === "number" && `Duration: ${call.durationSeconds} seconds`,
|
|
23
|
+
call.callerPhone && `Caller phone: ${call.callerPhone}`
|
|
24
|
+
].filter((line) => !!line);
|
|
25
|
+
const transcript = ((_a = call.turns) === null || _a === void 0 ? void 0 : _a.length)
|
|
26
|
+
? call.turns.map((turn) => { var _a; return `${(_a = SPEAKER_LABELS[turn.speaker]) !== null && _a !== void 0 ? _a : "Other"}: ${turn.text}`; }).join("\n")
|
|
27
|
+
: ((_b = call.text) !== null && _b !== void 0 ? _b : "").trim();
|
|
28
|
+
const content = facts.length ? `${facts.join("\n")}\n\n${transcript}` : transcript;
|
|
29
|
+
return [
|
|
30
|
+
{ role: "system", content: system },
|
|
31
|
+
{ role: "user", content }
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Generates a prompt that analyzes a phone call to a business: what happened on it, whether it is a
|
|
36
|
+
* lead and what the caller wants, the contact details they gave, and the usual lead labels.
|
|
37
|
+
*/
|
|
38
|
+
const generateAnalyzeCall = ({ businessDescription, highValueLeadDescription, call }, overrides) => {
|
|
39
|
+
const hasBusinessDescription = !!businessDescription;
|
|
40
|
+
const hasHighValueLeadDescription = !!highValueLeadDescription;
|
|
41
|
+
const intro = hasBusinessDescription
|
|
42
|
+
? `
|
|
43
|
+
You are a knowledgeable employee of a business with the following description:
|
|
44
|
+
|
|
45
|
+
===
|
|
46
|
+
${businessDescription}
|
|
47
|
+
===`
|
|
48
|
+
: "You are a knowledgeable employee of a business.";
|
|
49
|
+
const highValueLeadInstruction = hasHighValueLeadDescription
|
|
50
|
+
? `A high value lead is defined as:
|
|
51
|
+
===
|
|
52
|
+
${(0, AnalyzeLead_1.getHighValueLeadDescription)(highValueLeadDescription)}
|
|
53
|
+
===
|
|
54
|
+
|
|
55
|
+
Return "highValueLead": true when the call matches that definition and false when it does not. Always return one or the other - never omit it. Judge it only against the definition above, not against how urgent or how large the request seems.`
|
|
56
|
+
: "A high value lead description was not provided, do not return highValueLead.";
|
|
57
|
+
const system = `
|
|
58
|
+
${intro}
|
|
59
|
+
|
|
60
|
+
Your job is to analyze the transcript of a phone call to the business and say what happened on it. The call was answered by an agent for the business - often an AI phone agent - and the transcript may contain speech-recognition mistakes; read through them.
|
|
61
|
+
|
|
62
|
+
You will return your analysis as a JSON object with the following properties:
|
|
63
|
+
|
|
64
|
+
- outcome
|
|
65
|
+
- leadCaptured
|
|
66
|
+
- request
|
|
67
|
+
- extractedContact
|
|
68
|
+
- contactType
|
|
69
|
+
- serviceType
|
|
70
|
+
- jobType
|
|
71
|
+
- urgency
|
|
72
|
+
- analysis
|
|
73
|
+
- summary
|
|
74
|
+
- conciseSummary${hasHighValueLeadDescription ? "\n- highValueLead" : ""}
|
|
75
|
+
|
|
76
|
+
"outcome" is what happened on the call, from the business's side:
|
|
77
|
+
booked: an appointment or visit was booked on the call.
|
|
78
|
+
quote_requested: the caller asked for a price, estimate or quote.
|
|
79
|
+
callback_requested: the caller asked to be called back, or the agent promised a callback.
|
|
80
|
+
service_requested: the caller asked for service, but nothing was booked or promised on the call.
|
|
81
|
+
information_only: the caller only asked a question and got an answer.
|
|
82
|
+
existing_customer: an existing customer calling about existing work, such as billing, rescheduling or a complaint.
|
|
83
|
+
spam: a sales call, robocall, vendor pitch or anything else not from a real customer.
|
|
84
|
+
wrong_number: the caller meant to reach someone else.
|
|
85
|
+
hang_up: the caller hung up, or the call dropped, before saying what they wanted.
|
|
86
|
+
other: none of the above.
|
|
87
|
+
When more than one applies, use the one furthest along: booked over quote_requested over callback_requested over service_requested.
|
|
88
|
+
|
|
89
|
+
"leadCaptured" is true when the caller is a real customer or prospective customer who wants service, a quote or a callback, whether or not it was booked. It is false for spam, wrong numbers, hang-ups and calls that only asked a question.
|
|
90
|
+
|
|
91
|
+
"request" is what the caller wants, in their words where possible, at most 250 characters. Return null when they asked for nothing.
|
|
92
|
+
|
|
93
|
+
"extractedContact" holds the contact details the caller gave on the call: fullName, phone, email, address, city, state, zip, propertyType, preferredContactTime. Only include what was actually said; never invent a value. The caller's phone number from the phone system may be given above the transcript; use it as phone only when the caller didn't give another. Set "confidence" between 0.0 and 1.0 for how sure you are of the details, lowering it for spellings the transcript may have garbled. Return null when the caller gave no contact details.
|
|
94
|
+
|
|
95
|
+
Provide your analysis of why you made these decisions, which will be placed in "analysis". It should be concise and not exceed 500 characters.
|
|
96
|
+
|
|
97
|
+
"contactType" definitions are as follows:
|
|
98
|
+
BILLING_ISSUE: Concerns about charges, refunds, pricing discrepancies, or payments.
|
|
99
|
+
CANCELLATION: Asking to cancel an appointment, service, subscription, or contract.
|
|
100
|
+
COMPLAINT: Dissatisfaction with the business, product, or service quality, excluding billing or scheduling issues.
|
|
101
|
+
COMPLIMENT: Positive feedback about the business, staff, or product.
|
|
102
|
+
CONTACT_REQUEST: A request to be contacted without describing any service need, quote request, scheduling intent or other purpose.
|
|
103
|
+
EMPLOYMENT_INQUIRY: Questions about jobs, openings, hiring, or how to apply.
|
|
104
|
+
MISSED_APPOINTMENT: Reporting a no-show, missed call/visit, or confusion about appointment status.
|
|
105
|
+
QUESTION: A general question about the business, services, availability, or policies, without requesting service or a quote.
|
|
106
|
+
QUOTE_REQUEST: Requesting a price, cost, estimate, quote, or ballpark figure.
|
|
107
|
+
RESCHEDULE_REQUEST: Asking to change the date or time of an existing appointment.
|
|
108
|
+
SERVICE_REQUEST: Requesting service, repair, installation, maintenance, inspection, or booking a visit, or reporting a problem to be fixed.
|
|
109
|
+
SPAM: Sales calls, robocalls, vendor pitches, people offering to buy the business, or anything else not from a real customer.
|
|
110
|
+
TEST: A test call.
|
|
111
|
+
OTHER: The purpose of the call cannot be determined.
|
|
112
|
+
|
|
113
|
+
When multiple could apply, prefer BILLING_ISSUE, RESCHEDULE_REQUEST, CANCELLATION, or MISSED_APPOINTMENT over COMPLAINT or CONTACT_REQUEST.
|
|
114
|
+
${leadTaxonomyPrompt_1.DETAIL_FREE_CONTACT_RULE}
|
|
115
|
+
${leadTaxonomyPrompt_1.ESTIMATING_VENDOR_SPAM_EXAMPLES}
|
|
116
|
+
|
|
117
|
+
The definitions of each "serviceType" value are as follows:
|
|
118
|
+
CLEANING: Cleaning work (e.g., house, windows, ducts, carpet, gutters).
|
|
119
|
+
CONSULTATION: Requesting advice or guidance only, not execution.
|
|
120
|
+
INSPECTION: Evaluation or check to assess a condition or issue.
|
|
121
|
+
INSTALLATION: New install of a product or system.
|
|
122
|
+
MAINTENANCE: Routine or recurring upkeep.
|
|
123
|
+
REFINISH: Refinishing surfaces (e.g., floors, cabinets).
|
|
124
|
+
REMODEL: Renovating or improving an existing structure or space.
|
|
125
|
+
REPAIR: Fixing an existing product or system.
|
|
126
|
+
SUPPORT: Help with an issue or appointment related to the service but not the work itself.
|
|
127
|
+
TRANSPORT: Requests to move, haul, or deliver items.
|
|
128
|
+
TREATMENT: Active service to resolve or prevent an issue (e.g., pest treatment, lawn spraying).
|
|
129
|
+
OTHER: Anything not covered above. If multiple apply, pick the most specific.
|
|
130
|
+
|
|
131
|
+
${(0, leadTaxonomyPrompt_1.jobTypeSection)(hasBusinessDescription)}
|
|
132
|
+
|
|
133
|
+
The definitions of each "urgency" value are as follows:
|
|
134
|
+
LOW: Not time sensitive at all; can be addressed at the business's convenience.
|
|
135
|
+
MEDIUM: Not time sensitive; can be addressed within a couple weeks.
|
|
136
|
+
HIGH: Not life threatening, but should be addressed within a few days to avoid damage.
|
|
137
|
+
URGENT: Life threatening or causing property damage now; should be addressed as soon as possible.
|
|
138
|
+
NOT_SPECIFIED: The urgency could not be determined from the call.
|
|
139
|
+
|
|
140
|
+
A request for a price or an estimate on planned work, with no problem described, is LOW. Use NOT_SPECIFIED only when you cannot tell.
|
|
141
|
+
|
|
142
|
+
${highValueLeadInstruction}
|
|
143
|
+
|
|
144
|
+
Provide a summary of the call in "summary", at most 250 characters, and a 2-3 word phrase for the main topic or request in "conciseSummary".
|
|
145
|
+
`;
|
|
146
|
+
return Object.assign(Object.assign({ model: "gpt-4o-mini", max_tokens: 1024, frequency_penalty: 0,
|
|
147
|
+
// A classifier should give the same call the same labels; see AnalyzeEmail.
|
|
148
|
+
temperature: 0, top_p: 1, presence_penalty: 0 }, overrides), { response_format: {
|
|
149
|
+
type: "json_schema",
|
|
150
|
+
json_schema: {
|
|
151
|
+
name: "analyze_call",
|
|
152
|
+
strict: false,
|
|
153
|
+
schema: {
|
|
154
|
+
type: "object",
|
|
155
|
+
additionalProperties: false,
|
|
156
|
+
required: [
|
|
157
|
+
"outcome",
|
|
158
|
+
"leadCaptured",
|
|
159
|
+
"request",
|
|
160
|
+
"extractedContact",
|
|
161
|
+
"contactType",
|
|
162
|
+
"jobType",
|
|
163
|
+
"serviceType",
|
|
164
|
+
"urgency",
|
|
165
|
+
"highValueLead",
|
|
166
|
+
"conciseSummary",
|
|
167
|
+
"summary",
|
|
168
|
+
"analysis"
|
|
169
|
+
],
|
|
170
|
+
properties: {
|
|
171
|
+
outcome: { type: "string", enum: [...CallAnalysis_1.CALL_OUTCOMES] },
|
|
172
|
+
leadCaptured: { type: "boolean" },
|
|
173
|
+
request: { type: ["string", "null"] },
|
|
174
|
+
contactType: { type: "string", enum: [...LeadAnalysis_1.CONTACT_TYPES] },
|
|
175
|
+
jobType: { type: "string", enum: [...LeadAnalysis_1.JOB_TYPES] },
|
|
176
|
+
serviceType: { type: "string", enum: [...LeadAnalysis_1.SERVICE_TYPES] },
|
|
177
|
+
urgency: { type: "string", enum: [...LeadAnalysis_1.URGENCY_TYPES] },
|
|
178
|
+
highValueLead: { type: "boolean" },
|
|
179
|
+
summary: { type: "string" },
|
|
180
|
+
conciseSummary: { type: "string" },
|
|
181
|
+
analysis: { type: "string" },
|
|
182
|
+
extractedContact: {
|
|
183
|
+
type: ["object", "null"],
|
|
184
|
+
properties: {
|
|
185
|
+
fullName: { type: "string" },
|
|
186
|
+
phone: { type: "string" },
|
|
187
|
+
email: { type: "string" },
|
|
188
|
+
address: { type: "string" },
|
|
189
|
+
city: { type: "string" },
|
|
190
|
+
state: { type: "string" },
|
|
191
|
+
zip: { type: "string" },
|
|
192
|
+
propertyType: { type: "string", enum: ["residential", "commercial"] },
|
|
193
|
+
preferredContactTime: { type: "string" },
|
|
194
|
+
confidence: { type: "number" }
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}, type: "completions", messages: callToMessages(system, call) });
|
|
201
|
+
};
|
|
202
|
+
exports.generateAnalyzeCall = generateAnalyzeCall;
|
|
203
|
+
exports.defaultCallLeadAnalysis = {
|
|
204
|
+
outcome: "other",
|
|
205
|
+
leadCaptured: false,
|
|
206
|
+
contactType: "OTHER",
|
|
207
|
+
urgency: "NOT_SPECIFIED",
|
|
208
|
+
highValueLead: false,
|
|
209
|
+
summary: "A summary could not be generated.",
|
|
210
|
+
analysis: "An analysis could not be generated."
|
|
211
|
+
};
|
|
212
|
+
const analyzeCallResponseParse = (response) => {
|
|
213
|
+
var _a;
|
|
214
|
+
try {
|
|
215
|
+
const parsed = JSON.parse((0, extractJSON_1.extractJSON)(response));
|
|
216
|
+
const { contactType, jobType, serviceType, urgency, highValueLead, summary, analysis, conciseSummary, extractedContact, request } = parsed;
|
|
217
|
+
// Checked against the allowed values: Bedrock ignores the schema, so nothing else does.
|
|
218
|
+
const labels = (0, LeadAnalysis_1.normalizeLeadLabels)({ contactType, serviceType, jobType, urgency });
|
|
219
|
+
const outcome = CallAnalysis_1.CALL_OUTCOMES.includes(parsed.outcome) ? parsed.outcome : "other";
|
|
220
|
+
const draft = Object.assign(Object.assign({}, exports.defaultCallLeadAnalysis), { outcome, leadCaptured: ((_a = parsed.leadCaptured) === null || _a === void 0 ? void 0 : _a.toString().toLowerCase()) === "true", contactType: labels.contactType || exports.defaultCallLeadAnalysis.contactType, urgency: labels.urgency || exports.defaultCallLeadAnalysis.urgency, highValueLead: (highValueLead === null || highValueLead === void 0 ? void 0 : highValueLead.toString().toLowerCase()) === "true", summary: summary || exports.defaultCallLeadAnalysis.summary, analysis: analysis || exports.defaultCallLeadAnalysis.analysis });
|
|
221
|
+
if (typeof request === "string" && request.trim()) {
|
|
222
|
+
draft.request = request.trim();
|
|
223
|
+
}
|
|
224
|
+
if (conciseSummary) {
|
|
225
|
+
draft.conciseSummary = conciseSummary;
|
|
226
|
+
}
|
|
227
|
+
if (labels.jobType) {
|
|
228
|
+
draft.jobType = labels.jobType;
|
|
229
|
+
}
|
|
230
|
+
if (labels.serviceType) {
|
|
231
|
+
draft.serviceType = labels.serviceType;
|
|
232
|
+
}
|
|
233
|
+
if (extractedContact) {
|
|
234
|
+
const contact = extractedContact;
|
|
235
|
+
if (contact.fullName || contact.phone || contact.email) {
|
|
236
|
+
contact.confidence = typeof contact.confidence === "number" ? Math.max(0, Math.min(1, contact.confidence)) : 0;
|
|
237
|
+
draft.extractedContact = contact;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return draft;
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
// Surfaced rather than swallowed, as in AnalyzeEmail: the caller decides how to degrade.
|
|
244
|
+
throw new errors_1.LLMResponseParseError("analyzeCall", response, e);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
exports.analyzeCallResponseParse = analyzeCallResponseParse;
|
|
248
|
+
//# sourceMappingURL=AnalyzeCall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyzeCall.js","sourceRoot":"","sources":["../../src/prompts/AnalyzeCall.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AA8BlC,wCAcC;AAzCD,yDAAwH;AAExH,6CAAyD;AACzD,yDAAqH;AACrH,sDAAmD;AAEnD,+CAA4D;AAC5D,6DAAiH;AAEpG,QAAA,oBAAoB,GAAG,OAAO,CAAC,CAAC,uFAAuF;AAYpI,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAW,CAAC;AAErF;;;GAGG;AACH,SAAgB,cAAc,CAAC,MAAc,EAAE,IAAuB;;IAClE,MAAM,KAAK,GAAG;QACV,IAAI,CAAC,SAAS,IAAI,cAAc,IAAI,CAAC,SAAS,EAAE;QAChD,OAAO,IAAI,CAAC,eAAe,KAAK,QAAQ,IAAI,aAAa,IAAI,CAAC,eAAe,UAAU;QACvF,IAAI,CAAC,WAAW,IAAI,iBAAiB,IAAI,CAAC,WAAW,EAAE;KAC1D,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,MAAM;QACjC,CAA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AAK,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QACnC,CAAC;QACD,IAAI,cAAc,EAAE,CAAC;YACjB,KAAK,CAAC,cAAc,GAAG,cAAc,CAAC;QAC1C,CAAC;QACD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QACnC,CAAC;QACD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QAC3C,CAAC;QACD,IAAI,gBAAgB,EAAE,CAAC;YACnB,MAAM,OAAO,GAAG,gBAAwC,CAAC;YACzD,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBACrD,OAAO,CAAC,UAAU,GAAG,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC/G,KAAK,CAAC,gBAAgB,GAAG,OAAO,CAAC;YACrC,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,yFAAyF;QACzF,MAAM,IAAI,8BAAqB,CAAC,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC;AACL,CAAC,CAAC;AA1CW,QAAA,wBAAwB,4BA0CnC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
2
|
import type { CompletionPrompt, PromptGenerator, ResponseParser } from "../models";
|
|
3
3
|
import type { EmailAnalysisInput, EmailLeadAnalysis } from "../models/EmailAnalysis";
|
|
4
|
-
export declare const ANALYZE_EMAIL_VERSION = "1.3.
|
|
4
|
+
export declare const ANALYZE_EMAIL_VERSION = "1.3.3";
|
|
5
5
|
export interface AnalyzeEmailProps {
|
|
6
6
|
businessDescription?: string;
|
|
7
7
|
highValueLeadDescription?: string;
|
|
@@ -11,8 +11,17 @@ export type AnalyzeEmailLLMOverrides = Partial<Pick<CompletionPrompt, "model" |
|
|
|
11
11
|
/**
|
|
12
12
|
* Converts an email (with optional thread history) into the messages array for an LLM completion prompt.
|
|
13
13
|
*
|
|
14
|
-
* Thread history
|
|
15
|
-
*
|
|
14
|
+
* Thread history is rendered as a single labelled block of CONTENT inside the final user turn — it is
|
|
15
|
+
* deliberately NOT replayed as alternating user/assistant turns.
|
|
16
|
+
*
|
|
17
|
+
* Replaying it that way (the pre-fix shape of `transcriptToMessages`) made the model believe it *was*
|
|
18
|
+
* the assistant in an ongoing conversation, and a thread that ends on a customer message invites the
|
|
19
|
+
* model to answer it rather than analyze it. On OpenAI that instinct was masked by
|
|
20
|
+
* `response_format: json_schema`, which forces a JSON reply; Bedrock ignores that field, so nothing
|
|
21
|
+
* suppresses it there. See XappMedia/stentor-api#5622 and the `transcriptToMessages` fix it prompted.
|
|
22
|
+
*
|
|
23
|
+
* The current email's `Subject`/`From`/header framing is preserved even with no thread history —
|
|
24
|
+
* that framing is what signals "document to analyze" rather than "your turn to speak".
|
|
16
25
|
*
|
|
17
26
|
* @param system - The system instruction message.
|
|
18
27
|
* @param email - The email to analyze.
|
|
@@ -8,14 +8,23 @@ const errors_1 = require("../models/errors");
|
|
|
8
8
|
const extractJSON_1 = require("../utils/extractJSON");
|
|
9
9
|
const LeadAnalysis_1 = require("../models/LeadAnalysis");
|
|
10
10
|
const leadTaxonomyPrompt_1 = require("./leadTaxonomyPrompt");
|
|
11
|
-
exports.ANALYZE_EMAIL_VERSION = "1.3.
|
|
11
|
+
exports.ANALYZE_EMAIL_VERSION = "1.3.3"; // 1.2.0: the AnalyzeLead 1.3.0 taxonomy and validation, shared. 1.2.1: its reworded jobType rules. 1.2.2: its 1.3.2 contactType scoping. 1.3.0: its 1.4.0 taxonomy — one name per trade, not_stated, quote urgency. 1.3.1: its 1.4.1 highValueLead request. 1.3.2: thread history rendered as content in one user turn, never as assistant turns (#5269). 1.3.3: its 1.4.2 shower and tub rule
|
|
12
12
|
/** Headers forwarded to the LLM to help disambiguate the actual contact from template senders. */
|
|
13
13
|
const RELEVANT_HEADERS = ["reply-to", "x-mailer", "x-original-sender", "x-source"];
|
|
14
14
|
/**
|
|
15
15
|
* Converts an email (with optional thread history) into the messages array for an LLM completion prompt.
|
|
16
16
|
*
|
|
17
|
-
* Thread history
|
|
18
|
-
*
|
|
17
|
+
* Thread history is rendered as a single labelled block of CONTENT inside the final user turn — it is
|
|
18
|
+
* deliberately NOT replayed as alternating user/assistant turns.
|
|
19
|
+
*
|
|
20
|
+
* Replaying it that way (the pre-fix shape of `transcriptToMessages`) made the model believe it *was*
|
|
21
|
+
* the assistant in an ongoing conversation, and a thread that ends on a customer message invites the
|
|
22
|
+
* model to answer it rather than analyze it. On OpenAI that instinct was masked by
|
|
23
|
+
* `response_format: json_schema`, which forces a JSON reply; Bedrock ignores that field, so nothing
|
|
24
|
+
* suppresses it there. See XappMedia/stentor-api#5622 and the `transcriptToMessages` fix it prompted.
|
|
25
|
+
*
|
|
26
|
+
* The current email's `Subject`/`From`/header framing is preserved even with no thread history —
|
|
27
|
+
* that framing is what signals "document to analyze" rather than "your turn to speak".
|
|
19
28
|
*
|
|
20
29
|
* @param system - The system instruction message.
|
|
21
30
|
* @param email - The email to analyze.
|
|
@@ -24,14 +33,7 @@ function emailThreadToMessages(system, email) {
|
|
|
24
33
|
const messages = [
|
|
25
34
|
{ role: "system", content: system }
|
|
26
35
|
];
|
|
27
|
-
|
|
28
|
-
for (const msg of email.threadHistory) {
|
|
29
|
-
// customer → user; agent and fsm_crm system messages both map to assistant
|
|
30
|
-
const role = msg.role === "customer" ? "user" : "assistant";
|
|
31
|
-
messages.push({ role, content: msg.content });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// Build the current email as the final user message
|
|
36
|
+
// Build the current email content (Subject/From/headers framing, unchanged from before)
|
|
35
37
|
let currentEmailContent = `Subject: ${email.subject}`;
|
|
36
38
|
if (email.from) {
|
|
37
39
|
const fromStr = email.from.name ? `${email.from.name} <${email.from.email}>` : email.from.email;
|
|
@@ -56,7 +58,26 @@ function emailThreadToMessages(system, email) {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
currentEmailContent += `\n\n${email.body}`;
|
|
59
|
-
|
|
61
|
+
let userContent;
|
|
62
|
+
if (email.threadHistory && email.threadHistory.length > 0) {
|
|
63
|
+
// Speaker labels are preserved (customer/agent/fsm_crm) so the model can still tell who
|
|
64
|
+
// said what, even though the whole thread is now one block of content, not alternating turns.
|
|
65
|
+
const renderedHistory = email.threadHistory
|
|
66
|
+
.map((msg) => {
|
|
67
|
+
const speaker = msg.role === "customer" ? "Customer" : msg.role === "agent" ? "Agent" : "System";
|
|
68
|
+
return `${speaker}: ${msg.content}`;
|
|
69
|
+
})
|
|
70
|
+
.join("\n");
|
|
71
|
+
userContent =
|
|
72
|
+
`Analyze the following email thread. Do not reply to it or continue it.\n\n` +
|
|
73
|
+
`=== THREAD HISTORY START ===\n${renderedHistory}\n=== THREAD HISTORY END ===\n\n` +
|
|
74
|
+
`=== CURRENT EMAIL START ===\n${currentEmailContent}\n=== CURRENT EMAIL END ===\n\n` +
|
|
75
|
+
`Respond with ONLY the JSON object described above. No prose, no preamble.`;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
userContent = currentEmailContent;
|
|
79
|
+
}
|
|
80
|
+
messages.push({ role: "user", content: userContent });
|
|
60
81
|
return messages;
|
|
61
82
|
}
|
|
62
83
|
/**
|
|
@@ -71,6 +92,7 @@ function emailThreadToMessages(system, email) {
|
|
|
71
92
|
* - Email threads with prior conversation history
|
|
72
93
|
*/
|
|
73
94
|
const generateAnalyzeEmail = ({ businessDescription, highValueLeadDescription, email }, overrides) => {
|
|
95
|
+
var _a;
|
|
74
96
|
const hasBusinessDescription = !!businessDescription;
|
|
75
97
|
const hasHighValueLeadDescription = !!highValueLeadDescription;
|
|
76
98
|
let intro = `You are a knowledgeable employee of a business.`;
|
|
@@ -93,6 +115,12 @@ ${(0, AnalyzeLead_1.getHighValueLeadDescription)(highValueLeadDescription)}
|
|
|
93
115
|
|
|
94
116
|
Return "highValueLead": true when the email matches that definition and false when it does not. Always return one or the other - never omit it. Judge it only against the definition above, not against how urgent or how large the request seems.`;
|
|
95
117
|
}
|
|
118
|
+
// Only when there is a thread, so emails without one keep exactly the prompt they had. Rendered as
|
|
119
|
+
// content (see emailThreadToMessages), the history otherwise falls under the "most recent email
|
|
120
|
+
// only" rule above it, and a follow-up like "can you come Tuesday?" loses what the job was.
|
|
121
|
+
const threadHistoryInstruction = ((_a = email.threadHistory) === null || _a === void 0 ? void 0 : _a.length)
|
|
122
|
+
? `- The earlier messages of this conversation are provided in a THREAD HISTORY block before the current email. They are part of the customer's request, not quoted noise: use them together with the current email to determine what the customer needs and to find their contact details. Classify the conversation as a whole: a short follow-up (\"any update?\", \"can you come Tuesday?\") carries the work and the request described earlier in the thread, so it is not a request with no detail.\n`
|
|
123
|
+
: "";
|
|
96
124
|
const system = `
|
|
97
125
|
${intro}
|
|
98
126
|
|
|
@@ -100,7 +128,7 @@ Your job is to analyze the following inbound email received by the business and
|
|
|
100
128
|
|
|
101
129
|
IMPORTANT INSTRUCTIONS:
|
|
102
130
|
- Focus on the most recent/primary email content only. Ignore quoted reply chains (lines starting with ">"), forwarded content, and blocks beginning with "On ... wrote:" or "---Original Message---".
|
|
103
|
-
- Ignore email signatures, unsubscribe footers, physical address blocks, and legal disclaimers — unless the address or phone is the only contact info present.
|
|
131
|
+
${threadHistoryInstruction}- Ignore email signatures, unsubscribe footers, physical address blocks, and legal disclaimers — unless the address or phone is the only contact info present.
|
|
104
132
|
- Some emails are system notifications from FSM/CRM tools (e.g., Jobber, ServiceTitan, Housecall Pro). These often embed lead data in a structured text format like "Contact name: X", "Phone: Y", "Email: Z". Extract that contact data and treat the embedded customer as the actual lead. The From header on these emails is typically the system name (e.g., "The Jobber Team"), NOT the actual customer — always prefer names found in the email body over the From header display name.
|
|
105
133
|
- Additional email headers (reply-to, x-mailer, etc.) may be included when available. Use these as context clues — for example, a reply-to address different from the From address often indicates the actual customer contact.
|
|
106
134
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyzeEmail.js","sourceRoot":"","sources":["../../src/prompts/AnalyzeEmail.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;
|
|
1
|
+
{"version":3,"file":"AnalyzeEmail.js","sourceRoot":"","sources":["../../src/prompts/AnalyzeEmail.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AA4ClC,sDA4DC;AAnGD,+CAA4D;AAC5D,6CAAyD;AACzD,sDAAmD;AACnD,yDAAqH;AACrH,6DAAiH;AAEpG,QAAA,qBAAqB,GAAG,OAAO,CAAC,CAAC,+XAA+X;AAE7a,kGAAkG;AAClG,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,UAAU,CAAU,CAAC;AAY5F;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,qBAAqB,CACjC,MAAc,EACd,KAAyB;IAEzB,MAAM,QAAQ,GAAiE;QAC3E,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE;KACtC,CAAC;IAEF,wFAAwF;IACxF,IAAI,mBAAmB,GAAG,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC;IACtD,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAA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AO,CAAC,KAAK,EAAE,CAAC;gBACrD,oEAAoE;gBACpE,OAAO,CAAC,UAAU,GAAG,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;oBACvD,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;oBAC9C,CAAC,CAAC,CAAC,CAAC;gBACR,aAAa,CAAC,gBAAgB,GAAG,OAAO,CAAC;YAC7C,CAAC;QACL,CAAC;QAED,OAAO,aAAa,CAAC;IACzB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,uFAAuF;QACvF,yFAAyF;QACzF,0FAA0F;QAC1F,MAAM,IAAI,8BAAqB,CAAC,cAAc,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;AACL,CAAC,CAAC;AAhDW,QAAA,yBAAyB,6BAgDpC"}
|
|
@@ -24,8 +24,11 @@ import type { CompletionPrompt, LeadAnalysis, PromptGenerator, ResponseParser }
|
|
|
24
24
|
* JOB_TYPE_VARIANTS so anything that already wrote them still resolves. "other" split: not_stated
|
|
25
25
|
* for a request that names no work, other for work in no listed trade. A price request on planned
|
|
26
26
|
* work is LOW rather than NOT_SPECIFIED.
|
|
27
|
+
* 1.4.2 (2026-11-19): replacing or converting a shower or tub is remodeling, repairing a fixture
|
|
28
|
+
* is plumbing. A bath remodeler's "We need to have our shower replaced" came back plumbing,
|
|
29
|
+
* because plumbing's definition named fixtures and remodeling only named "bathroom".
|
|
27
30
|
*/
|
|
28
|
-
export declare const ANALYZE_LEAD_VERSION = "1.4.
|
|
31
|
+
export declare const ANALYZE_LEAD_VERSION = "1.4.2";
|
|
29
32
|
export interface TranscriptMessage {
|
|
30
33
|
text: string;
|
|
31
34
|
speaker: string;
|
|
@@ -34,8 +34,11 @@ const leadTaxonomyPrompt_1 = require("./leadTaxonomyPrompt");
|
|
|
34
34
|
* JOB_TYPE_VARIANTS so anything that already wrote them still resolves. "other" split: not_stated
|
|
35
35
|
* for a request that names no work, other for work in no listed trade. A price request on planned
|
|
36
36
|
* work is LOW rather than NOT_SPECIFIED.
|
|
37
|
+
* 1.4.2 (2026-11-19): replacing or converting a shower or tub is remodeling, repairing a fixture
|
|
38
|
+
* is plumbing. A bath remodeler's "We need to have our shower replaced" came back plumbing,
|
|
39
|
+
* because plumbing's definition named fixtures and remodeling only named "bathroom".
|
|
37
40
|
*/
|
|
38
|
-
exports.ANALYZE_LEAD_VERSION = "1.4.
|
|
41
|
+
exports.ANALYZE_LEAD_VERSION = "1.4.2";
|
|
39
42
|
function getName(profile) {
|
|
40
43
|
// Sorting these based on priority.
|
|
41
44
|
return (profile === null || profile === void 0 ? void 0 : profile.name) || (profile === null || profile === void 0 ? void 0 : profile.email) || (profile === null || profile === void 0 ? void 0 : profile.phone) || "Unknown";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyzeLead.js","sourceRoot":"","sources":["../../src/prompts/AnalyzeLead.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AnalyzeLead.js","sourceRoot":"","sources":["../../src/prompts/AnalyzeLead.ts"],"names":[],"mappings":";;;AA6EA,kDAMC;AAyBD,oDAkEC;AAOD,kCAaC;AAQD,kEAEC;AA1MD,iDAAkD;AAGlD,6CAAyD;AACzD,sDAAmD;AACnD,yDAAqH;AACrH,6DAAiH;AAEjH,kDAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,oBAAoB,GAAG,OAAO,CAAC;AA2B5C,SAAS,OAAO,CAAC,OAA+C;IAC5D,mCAAmC;IACnC,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAA,KAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAA,IAAI,SAAS,CAAC;AAC1E,CAAC;A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CAAC;YACjB,aAAa,CAAC,cAAc,GAAG,cAAc,CAAC;QAClD,CAAC;QAED,6GAA6G;QAC7G,MAAM,MAAM,GAAG,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACpG,IAAI,MAAM,EAAE,CAAC;YACT,aAAa,CAAC,aAAa,GAAG,MAAM,CAAC;QACzC,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,aAAa,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC3C,CAAC;QAED,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACrB,aAAa,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACnD,CAAC;QAED,OAAO,aAAa,CAAC;IACzB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,uFAAuF;QACvF,yFAAyF;QACzF,0FAA0F;QAC1F,MAAM,IAAI,8BAAqB,CAAC,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC;AACL,CAAC,CAAC;AAzCW,QAAA,wBAAwB,4BAyCnC"}
|
package/lib/prompts/index.d.ts
CHANGED
package/lib/prompts/index.js
CHANGED
|
@@ -15,6 +15,7 @@ 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("./AnalyzeCall"), exports);
|
|
18
19
|
__exportStar(require("./AnalyzeEmail"), exports);
|
|
19
20
|
__exportStar(require("./AnalyzeLead"), exports);
|
|
20
21
|
__exportStar(require("./AnalyzeTranscript"), exports);
|
package/lib/prompts/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,iDAA+B;AAC/B,gDAA8B;AAC9B,sDAAoC;AACpC,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;;;;;AAElC,gDAA8B;AAC9B,iDAA+B;AAC/B,gDAA8B;AAC9B,sDAAoC;AACpC,gDAA8B"}
|
|
@@ -40,6 +40,8 @@ Examples of requests that fit an existing jobType:
|
|
|
40
40
|
- "garage floor coating" or "epoxy garage floor" → flooring
|
|
41
41
|
- "install a Level 2 EV charger" or "Tesla charger" → electrical
|
|
42
42
|
- "water heater replacement", "septic tank pumping" or "backflow test" → plumbing
|
|
43
|
+
- "shower replacement", "replace our tub", "tub-to-shower conversion" or "walk-in tub" → remodeling: replacing or converting a whole shower or tub is a remodel
|
|
44
|
+
- "leaking shower valve", "dripping faucet" or "clogged tub drain" → plumbing: repairing a fixture is plumbing
|
|
43
45
|
- "dryer vent cleaning" → hvac
|
|
44
46
|
- "gas fireplace won't light" or "chimney sweep" → fireplace_chimney
|
|
45
47
|
- "French drain" or "wet basement" → drainage_waterproofing`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadTaxonomyPrompt.js","sourceRoot":"","sources":["../../src/prompts/leadTaxonomyPrompt.ts"],"names":[],"mappings":";;;AAUA,
|
|
1
|
+
{"version":3,"file":"leadTaxonomyPrompt.js","sourceRoot":"","sources":["../../src/prompts/leadTaxonomyPrompt.ts"],"names":[],"mappings":";;;AAUA,wCAoCC;AA9CD,kCAAkC;AAClC,yDAA8D;AAE9D;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,sBAA+B;IAC1D,MAAM,WAAW,GAAG,mCAAoB,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE9G,wFAAwF;IACxF,0FAA0F;IAC1F,+FAA+F;IAC/F,kFAAkF;IAClF,MAAM,QAAQ,GAAG,sBAAsB;QACnC,CAAC,CAAC;;;;;6KAKmK;QACrK,CAAC,CAAC;wFAC8E,CAAC;IAErF,OAAO;;;;;EAKT,QAAQ;;;EAGR,WAAW;;;;;;;;;;4DAU+C,CAAC;AAC7D,CAAC;AAED;;;;;;;;GAQG;AACU,QAAA,wBAAwB,GAAG;+YACuW,CAAA;AAE/Y;;;;GAIG;AACU,QAAA,+BAA+B,GAAG;;;;+FAIgD,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "2.
|
|
7
|
+
"version": "2.3.1",
|
|
8
8
|
"description": "Generative AI Service",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"chai": "4.5.0",
|
|
22
22
|
"dotenv": "17.4.2",
|
|
23
23
|
"mocha": "11.8.0",
|
|
24
|
-
"stentor-logger": "1.74.
|
|
25
|
-
"stentor-models": "1.
|
|
26
|
-
"stentor-service-fetch": "1.74.
|
|
27
|
-
"stentor-utils": "1.
|
|
24
|
+
"stentor-logger": "1.74.18",
|
|
25
|
+
"stentor-models": "1.85.0",
|
|
26
|
+
"stentor-service-fetch": "1.74.11",
|
|
27
|
+
"stentor-utils": "1.77.0",
|
|
28
28
|
"ts-node": "10.9.2",
|
|
29
29
|
"typescript": "5.9.3"
|
|
30
30
|
},
|