@xapp/stentor-service-generative-ai 2.3.1 → 2.4.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/FallbackLLMService.js +14 -1
- package/lib/FallbackLLMService.js.map +1 -1
- package/lib/GenerativeAIService.d.ts +15 -1
- package/lib/GenerativeAIService.js +28 -0
- package/lib/GenerativeAIService.js.map +1 -1
- package/lib/models/ConversationAnalysis.d.ts +79 -0
- package/lib/models/ConversationAnalysis.js +27 -0
- package/lib/models/ConversationAnalysis.js.map +1 -0
- package/lib/models/GenerativeAIService.d.ts +10 -0
- 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/AnalyzeConversation.d.ts +26 -0
- package/lib/prompts/AnalyzeConversation.js +232 -0
- package/lib/prompts/AnalyzeConversation.js.map +1 -0
- package/lib/prompts/index.d.ts +1 -0
- package/lib/prompts/index.js +1 -0
- package/lib/prompts/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,15 @@ const FALLBACK_PATTERNS = [
|
|
|
30
30
|
/ModelTimeout/i,
|
|
31
31
|
/timed out/i
|
|
32
32
|
];
|
|
33
|
+
/**
|
|
34
|
+
* The provider has not been granted the model. Access is per provider and per account, so the
|
|
35
|
+
* fallback can still answer. Unlike an IAM denial (not authorized to perform bedrock:InvokeModel),
|
|
36
|
+
* which is our own misconfiguration and stays an error.
|
|
37
|
+
*/
|
|
38
|
+
const MODEL_ACCESS_PATTERNS = [
|
|
39
|
+
/Model use case details have not been submitted/i,
|
|
40
|
+
/You don't have access to the model/i
|
|
41
|
+
];
|
|
33
42
|
/**
|
|
34
43
|
* Network error codes: the provider could not be reached, so another one might be.
|
|
35
44
|
*/
|
|
@@ -38,7 +47,8 @@ const NETWORK_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "ETIMEDOUT", "ENOTFOU
|
|
|
38
47
|
* Check if an error means the primary is rate limited or unavailable, so the fallback may succeed.
|
|
39
48
|
*
|
|
40
49
|
* Errors that would fail the same way anywhere -- a malformed request, a prompt the service does
|
|
41
|
-
* not support,
|
|
50
|
+
* not support, an IAM denial -- are not matched and are rethrown. A provider that has not been
|
|
51
|
+
* granted the model is matched: that is the provider's, and the fallback has its own access.
|
|
42
52
|
*/
|
|
43
53
|
function shouldFallback(error) {
|
|
44
54
|
if (typeof error === "string") {
|
|
@@ -55,6 +65,9 @@ function shouldFallback(error) {
|
|
|
55
65
|
if (code && NETWORK_ERROR_CODES.includes(code)) {
|
|
56
66
|
return true;
|
|
57
67
|
}
|
|
68
|
+
if (MODEL_ACCESS_PATTERNS.some((pattern) => pattern.test(error.message))) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
58
71
|
return FALLBACK_PATTERNS.some((pattern) => pattern.test(error.name) || pattern.test(error.message));
|
|
59
72
|
}
|
|
60
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FallbackLLMService.js","sourceRoot":"","sources":["../src/FallbackLLMService.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;AAIlC;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACtB,aAAa;IACb,UAAU;IACV,oBAAoB;IACpB,KAAK;IACL,sBAAsB;IACtB,gCAAgC;IAChC,yCAAyC;IACzC,qBAAqB;IACrB,sBAAsB;IACtB,iCAAiC;IACjC,iBAAiB;IACjB,gBAAgB;IAChB,eAAe;IACf,YAAY;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAE3G
|
|
1
|
+
{"version":3,"file":"FallbackLLMService.js","sourceRoot":"","sources":["../src/FallbackLLMService.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;;;;;;;;;;AAIlC;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACtB,aAAa;IAC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I,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AACxG,CAAC;AAiBD;;;;;;;;;;;;;GAaG;AACH,MAAa,kBAAkB;IAK3B,YAAY,KAA8B;QACtC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;;;;;;OAOG;IACG,QAAQ,CAAC,MAAc,EAAE,OAA8B;;YACzD,IAAI,CAAC;gBACD,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YACxD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;oBACxB,IAAI,IAAI,CAAC,UAAU,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;wBAC5C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;oBAC3B,CAAC;oBACD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBACnD,CAAC;gBACD,MAAM,KAAK,CAAC;YAChB,CAAC;QACL,CAAC;KAAA;CACJ;AAhCD,gDAgCC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
2
|
import type { ExternalLead, Message } from "stentor-models";
|
|
3
|
-
import type { AnalyzeLeadOptions, AnalyzeWebsiteData, EngagementAnalysis, EngagementAnalysisConfig, IGenerativeAIService, LeadAnalysis, LLMService, LLMServiceResponse, Prompt } from "./models";
|
|
3
|
+
import type { AnalyzeConversationOptions, AnalyzeLeadOptions, AnalyzeWebsiteData, EngagementAnalysis, EngagementAnalysisConfig, IGenerativeAIService, LeadAnalysis, LLMService, LLMServiceResponse, Prompt } from "./models";
|
|
4
4
|
import type { CallAnalysisInput, CallLeadAnalysis } from "./models/CallAnalysis";
|
|
5
|
+
import type { ConversationAnalysis, ConversationAnalysisInput } from "./models/ConversationAnalysis";
|
|
5
6
|
import type { EmailAnalysisInput, EmailLeadAnalysis } from "./models/EmailAnalysis";
|
|
6
7
|
import type { ChatSummary } from "./models/ChatSummary";
|
|
7
8
|
import { WebsiteAnalysis } from "./models/WebsiteAnalysis";
|
|
@@ -40,6 +41,19 @@ export declare class GenerativeAIService implements IGenerativeAIService {
|
|
|
40
41
|
* @param options - Optional business context and LLM call options.
|
|
41
42
|
*/
|
|
42
43
|
analyzeCall(call: CallAnalysisInput, options?: AnalyzeLeadOptions): Promise<CallLeadAnalysis>;
|
|
44
|
+
/**
|
|
45
|
+
* Analyze a conversation between a business and a customer, by chat or phone, for what was
|
|
46
|
+
* agreed: whether the job was booked, the appointment, the price, follow-ups, objections, and
|
|
47
|
+
* whether the lead is real.
|
|
48
|
+
*
|
|
49
|
+
* Unlike the other analyses this does not degrade to a default: its answer is written onto the
|
|
50
|
+
* lead and its lifecycle, so a reply that can't be read throws `LLMResponseParseError` and the
|
|
51
|
+
* caller records nothing.
|
|
52
|
+
*
|
|
53
|
+
* @param conversation - The transcript and what is known about it.
|
|
54
|
+
* @param options - Optional business context and LLM call options.
|
|
55
|
+
*/
|
|
56
|
+
analyzeConversation(conversation: ConversationAnalysisInput, options?: AnalyzeConversationOptions): Promise<ConversationAnalysis>;
|
|
43
57
|
/**
|
|
44
58
|
* Analyze a completed conversation transcript to derive engagement metadata: sentiment,
|
|
45
59
|
* topics, whether the AI agent contained/resolved the conversation without human handoff,
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GenerativeAIService = void 0;
|
|
13
13
|
const AnalyzeCall_1 = require("./prompts/AnalyzeCall");
|
|
14
|
+
const AnalyzeConversation_1 = require("./prompts/AnalyzeConversation");
|
|
14
15
|
const AnalyzeEmail_1 = require("./prompts/AnalyzeEmail");
|
|
15
16
|
const AnalyzeLead_1 = require("./prompts/AnalyzeLead");
|
|
16
17
|
const AnalyzeTranscript_1 = require("./prompts/AnalyzeTranscript");
|
|
@@ -149,6 +150,33 @@ class GenerativeAIService {
|
|
|
149
150
|
return analysis;
|
|
150
151
|
});
|
|
151
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Analyze a conversation between a business and a customer, by chat or phone, for what was
|
|
155
|
+
* agreed: whether the job was booked, the appointment, the price, follow-ups, objections, and
|
|
156
|
+
* whether the lead is real.
|
|
157
|
+
*
|
|
158
|
+
* Unlike the other analyses this does not degrade to a default: its answer is written onto the
|
|
159
|
+
* lead and its lifecycle, so a reply that can't be read throws `LLMResponseParseError` and the
|
|
160
|
+
* caller records nothing.
|
|
161
|
+
*
|
|
162
|
+
* @param conversation - The transcript and what is known about it.
|
|
163
|
+
* @param options - Optional business context and LLM call options.
|
|
164
|
+
*/
|
|
165
|
+
analyzeConversation(conversation, options) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
const prompt = (0, AnalyzeConversation_1.generateAnalyzeConversation)({
|
|
168
|
+
businessDescription: (options === null || options === void 0 ? void 0 : options.businessDescription) || "",
|
|
169
|
+
conversation
|
|
170
|
+
});
|
|
171
|
+
const llmResponse = yield this.llmService.generate(prompt, {
|
|
172
|
+
timeout: options === null || options === void 0 ? void 0 : options.timeout
|
|
173
|
+
});
|
|
174
|
+
const analysis = (0, AnalyzeConversation_1.analyzeConversationResponseParse)(llmResponse.text);
|
|
175
|
+
analysis.analysisVersion = AnalyzeConversation_1.ANALYZE_CONVERSATION_VERSION;
|
|
176
|
+
analysis.rawResponse = capRawResponse(llmResponse.text);
|
|
177
|
+
return analysis;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
152
180
|
/**
|
|
153
181
|
* Analyze a completed conversation transcript to derive engagement metadata: sentiment,
|
|
154
182
|
* 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":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"GenerativeAIService.js","sourceRoot":"","sources":["../src/GenerativeAIService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAmBA,uDAAqI;AACrI,uEAA4I;AAC5I,yDAA0I;AAC1I,uDAAiI;AACjI,mEAA+J;AAC/J,uCAAkG;AAElG,4CAAwD;AACxD,wDAAgE;AAEhE,6DAA+F;AAE/F;;;;;;;;;;;;GAYG;AACH,SAAS,cAAc,CAAI,KAAc,EAAE,aAAgB,EAAE,OAAe;IACxE,IAAI,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;IACnB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,IAAI,CAAC,YAAY,8BAAqB,EAAE,CAAC;YACrC,OAAO,CAAC,IAAI,CACR,GAAG,OAAO,wFAAwF;gBAC9F,UAAU,CAAC,CAAC,OAAO,gBAAgB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CACzE,CAAC;YACF,OAAO,aAAa,CAAC;QACzB,CAAC;QACD,MAAM,CAAC,CAAC;IACZ,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,sCAAuB,CAAC,CAAC;AAClD,CAAC;AAED,MAAa,mBAAmB;IAG5B,YAAY,UAAsB;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACG,YAAY,CAAC,MAAc;;YAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5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AM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU;aACjC,CAAC,CAAC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAE3D,MAAM,QAAQ,GAAG,cAAc,CAC3B,GAAG,EAAE,CAAC,IAAA,kDAA8B,EAAC,WAAW,CAAC,IAAI,CAAC,oBACjD,6CAAyB,GAC9B,mBAAmB,CACtB,CAAC;YAEF,QAAQ,CAAC,eAAe,GAAG,8CAA0B,CAAC;YAEtD,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAED;;;;OAIG;IACG,2BAA2B,CAAC,UAAsC;;YACpE,MAAM,MAAM,GAAG,IAAA,qDAA2C,EAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YAC3E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC3D,OAAO,IAAA,kCAAwB,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;KAAA;IAEK,cAAc,CAAC,QAAgB,EAAE,IAAwB;;YAC3D,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;YAErB,MAAM,MAAM,GAAG,IAAA,uCAAsB,EAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;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;AAnMD,kDAmMC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
+
import type { JobType, UrgencyType } from "./LeadAnalysis";
|
|
3
|
+
/** One turn of a conversation: the business (a person or its AI agent), or the customer. */
|
|
4
|
+
export interface ConversationTurn {
|
|
5
|
+
speaker: "business" | "customer" | "other";
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A conversation between a business and a customer about a job: a chat on the business's site,
|
|
10
|
+
* an AI agent's chat, a partner's AI phone agent, or a recorded call bridged by Call Connect.
|
|
11
|
+
* Give `turns` when who said what is known, or `text` when there is only a transcript.
|
|
12
|
+
*/
|
|
13
|
+
export interface ConversationAnalysisInput {
|
|
14
|
+
channel: "chat" | "phone";
|
|
15
|
+
turns?: ConversationTurn[];
|
|
16
|
+
/** The transcript as plain text, used when there are no `turns`. */
|
|
17
|
+
text?: string;
|
|
18
|
+
businessName?: string;
|
|
19
|
+
/** What the customer asked about before the conversation, e.g. the lead form's message. */
|
|
20
|
+
request?: string;
|
|
21
|
+
/** When the conversation happened (ISO 8601), so "Tuesday at 9" can become a date. */
|
|
22
|
+
conversationDate?: string;
|
|
23
|
+
/** The business's IANA time zone, e.g. "America/Chicago". */
|
|
24
|
+
timeZone?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Whether the job was booked on the conversation. */
|
|
27
|
+
export declare const CONVERSATION_BOOKED: readonly ["yes", "not_yet", "no", "unknown"];
|
|
28
|
+
export type ConversationBooked = (typeof CONVERSATION_BOOKED)[number];
|
|
29
|
+
/** Whether the lead is a real prospect for the business. */
|
|
30
|
+
export declare const CONVERSATION_LEAD_QUALITY: readonly ["genuine", "spam", "wrong_number", "out_of_area", "existing_customer", "unknown"];
|
|
31
|
+
export type ConversationLeadQuality = (typeof CONVERSATION_LEAD_QUALITY)[number];
|
|
32
|
+
/** Why a customer held back or said no. */
|
|
33
|
+
export declare const CONVERSATION_REASONS: readonly ["price", "timing", "went_elsewhere", "out_of_scope", "other"];
|
|
34
|
+
export type ConversationReason = (typeof CONVERSATION_REASONS)[number];
|
|
35
|
+
/** Something someone said they would do after the conversation. */
|
|
36
|
+
export interface ConversationFollowUp {
|
|
37
|
+
who: "business" | "customer";
|
|
38
|
+
what: string;
|
|
39
|
+
/** When it is due (ISO 8601 date or date-time), when the conversation makes that clear. */
|
|
40
|
+
due?: string;
|
|
41
|
+
/** When it is due, as said. */
|
|
42
|
+
dueText?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Returned by `GenerativeAIService.analyzeConversation()`: what was agreed on the conversation. */
|
|
45
|
+
export interface ConversationAnalysis {
|
|
46
|
+
booked: ConversationBooked;
|
|
47
|
+
/** The appointment that was set. `start`/`end` are ISO 8601, present only when they could be worked out. */
|
|
48
|
+
appointment?: {
|
|
49
|
+
start?: string;
|
|
50
|
+
end?: string;
|
|
51
|
+
text: string;
|
|
52
|
+
};
|
|
53
|
+
/** The price the business gave. `amount` is present only when a single figure was given. */
|
|
54
|
+
quotedPrice?: {
|
|
55
|
+
amount?: number;
|
|
56
|
+
currency: "USD";
|
|
57
|
+
text: string;
|
|
58
|
+
};
|
|
59
|
+
jobType?: JobType;
|
|
60
|
+
urgency?: UrgencyType;
|
|
61
|
+
leadQuality: ConversationLeadQuality;
|
|
62
|
+
/** Why the job was lost; only when `booked` is "no". */
|
|
63
|
+
lostReason?: ConversationReason;
|
|
64
|
+
followUps: ConversationFollowUp[];
|
|
65
|
+
objections: ConversationReason[];
|
|
66
|
+
/** The customer's objections, in their words where possible. */
|
|
67
|
+
objectionText?: string;
|
|
68
|
+
/** How the business handled the conversation. */
|
|
69
|
+
businessQuality?: {
|
|
70
|
+
offeredTime: boolean;
|
|
71
|
+
askedDetails: boolean;
|
|
72
|
+
notes?: string;
|
|
73
|
+
};
|
|
74
|
+
summary: string;
|
|
75
|
+
/** The prompt version that produced this, set by the service. */
|
|
76
|
+
analysisVersion?: string;
|
|
77
|
+
/** The model's reply, trimmed, set by the service. */
|
|
78
|
+
rawResponse?: string;
|
|
79
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CONVERSATION_REASONS = exports.CONVERSATION_LEAD_QUALITY = exports.CONVERSATION_BOOKED = void 0;
|
|
5
|
+
/** Whether the job was booked on the conversation. */
|
|
6
|
+
exports.CONVERSATION_BOOKED = [
|
|
7
|
+
/** A visit, appointment or job was scheduled or confirmed. */
|
|
8
|
+
"yes",
|
|
9
|
+
/** They mean to book but nothing is set: a quote to send, a callback, a schedule to check. */
|
|
10
|
+
"not_yet",
|
|
11
|
+
/** It won't happen: the customer declined or went elsewhere, or the business can't do it. */
|
|
12
|
+
"no",
|
|
13
|
+
/** The conversation doesn't say. */
|
|
14
|
+
"unknown"
|
|
15
|
+
];
|
|
16
|
+
/** Whether the lead is a real prospect for the business. */
|
|
17
|
+
exports.CONVERSATION_LEAD_QUALITY = [
|
|
18
|
+
"genuine",
|
|
19
|
+
"spam",
|
|
20
|
+
"wrong_number",
|
|
21
|
+
"out_of_area",
|
|
22
|
+
"existing_customer",
|
|
23
|
+
"unknown"
|
|
24
|
+
];
|
|
25
|
+
/** Why a customer held back or said no. */
|
|
26
|
+
exports.CONVERSATION_REASONS = ["price", "timing", "went_elsewhere", "out_of_scope", "other"];
|
|
27
|
+
//# sourceMappingURL=ConversationAnalysis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationAnalysis.js","sourceRoot":"","sources":["../../src/models/ConversationAnalysis.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AA6BlC,sDAAsD;AACzC,QAAA,mBAAmB,GAAG;IAC/B,8DAA8D;IAC9D,KAAK;IACL,8FAA8F;IAC9F,SAAS;IACT,6FAA6F;IAC7F,IAAI;IACJ,oCAAoC;IACpC,SAAS;CACH,CAAC;AAIX,4DAA4D;AAC/C,QAAA,yBAAyB,GAAG;IACrC,SAAS;IACT,MAAM;IACN,cAAc;IACd,aAAa;IACb,mBAAmB;IACnB,SAAS;CACH,CAAC;AAIX,2CAA2C;AAC9B,QAAA,oBAAoB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,OAAO,CAAU,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
2
|
import type { ExternalLead, Message } from "stentor-models";
|
|
3
3
|
import type { CallAnalysisInput, CallLeadAnalysis } from "./CallAnalysis";
|
|
4
|
+
import type { ConversationAnalysis, ConversationAnalysisInput } from "./ConversationAnalysis";
|
|
4
5
|
import type { EmailAnalysisInput, EmailLeadAnalysis } from "./EmailAnalysis";
|
|
5
6
|
import type { EngagementAnalysis, EngagementAnalysisConfig } from "./EngagementAnalysis";
|
|
6
7
|
import type { LeadAnalysis } from "./LeadAnalysis";
|
|
@@ -18,6 +19,9 @@ export interface AnalyzeLeadOptions extends BaseOptions {
|
|
|
18
19
|
businessDescription?: string;
|
|
19
20
|
highValueLeadDescription?: string;
|
|
20
21
|
}
|
|
22
|
+
export interface AnalyzeConversationOptions extends BaseOptions {
|
|
23
|
+
businessDescription?: string;
|
|
24
|
+
}
|
|
21
25
|
export interface IGenerativeAIService {
|
|
22
26
|
/**
|
|
23
27
|
* Executes a custom prompt that the user is responsible for creating and parsing.
|
|
@@ -49,6 +53,12 @@ export interface IGenerativeAIService {
|
|
|
49
53
|
* @param options - Optional business context and LLM call options.
|
|
50
54
|
*/
|
|
51
55
|
analyzeCall(call: CallAnalysisInput, options?: AnalyzeLeadOptions): Promise<CallLeadAnalysis>;
|
|
56
|
+
/**
|
|
57
|
+
* Analyze a conversation between a business and a customer (chat or phone) for what was agreed:
|
|
58
|
+
* booked, appointment, price, follow-ups, objections and lead quality. Throws
|
|
59
|
+
* `LLMResponseParseError` when the model's reply can't be read.
|
|
60
|
+
*/
|
|
61
|
+
analyzeConversation(conversation: ConversationAnalysisInput, options?: AnalyzeConversationOptions): Promise<ConversationAnalysis>;
|
|
52
62
|
/**
|
|
53
63
|
* Analyze a completed conversation transcript to derive engagement metadata: sentiment,
|
|
54
64
|
* topics, whether the AI agent contained/resolved the conversation without human handoff,
|
package/lib/models/index.d.ts
CHANGED
package/lib/models/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
__exportStar(require("./CallAnalysis"), exports);
|
|
19
|
+
__exportStar(require("./ConversationAnalysis"), exports);
|
|
19
20
|
__exportStar(require("./EmailAnalysis"), exports);
|
|
20
21
|
__exportStar(require("./EngagementAnalysis"), exports);
|
|
21
22
|
__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,iDAA+B;AAC/B,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,yDAAuC;AACvC,kDAAgC;AAChC,uDAAqC;AACrC,2CAAyB;AACzB,wDAAsC;AACtC,iDAA+B;AAC/B,+CAA6B;AAC7B,2CAAyB;AACzB,oDAAkC;AAClC,mDAAiC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
+
import type { CompletionPrompt, PromptGenerator, ResponseParser } from "../models";
|
|
3
|
+
import { type ConversationAnalysis, type ConversationAnalysisInput } from "../models/ConversationAnalysis";
|
|
4
|
+
export declare const ANALYZE_CONVERSATION_VERSION = "1.0.0";
|
|
5
|
+
export interface AnalyzeConversationProps {
|
|
6
|
+
businessDescription?: string;
|
|
7
|
+
conversation: ConversationAnalysisInput;
|
|
8
|
+
}
|
|
9
|
+
export type AnalyzeConversationLLMOverrides = Partial<Pick<CompletionPrompt, "model" | "max_tokens" | "temperature" | "top_p" | "frequency_penalty" | "presence_penalty">>;
|
|
10
|
+
/** The conversation as one user message: what we know about it, then the transcript. */
|
|
11
|
+
export declare function conversationToMessages(system: string, conversation: ConversationAnalysisInput): {
|
|
12
|
+
role: "system" | "user";
|
|
13
|
+
content: string;
|
|
14
|
+
}[];
|
|
15
|
+
/**
|
|
16
|
+
* Generates a prompt that reads a conversation between a business and a customer and returns what
|
|
17
|
+
* was agreed: whether the job was booked, the appointment, the price, follow-ups, objections, and
|
|
18
|
+
* whether the lead is real.
|
|
19
|
+
*/
|
|
20
|
+
export declare const generateAnalyzeConversation: PromptGenerator<AnalyzeConversationProps, AnalyzeConversationLLMOverrides, CompletionPrompt>;
|
|
21
|
+
/**
|
|
22
|
+
* Reads the model's reply. Every value is checked against what is allowed, because Bedrock ignores
|
|
23
|
+
* the JSON schema. Throws `LLMResponseParseError` when the reply isn't JSON or has no summary: a
|
|
24
|
+
* caller that writes this onto a lead should skip it rather than record a made-up default.
|
|
25
|
+
*/
|
|
26
|
+
export declare const analyzeConversationResponseParse: ResponseParser<ConversationAnalysis>;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*! Copyright (c) 2026, XAPP AI */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.analyzeConversationResponseParse = exports.generateAnalyzeConversation = exports.ANALYZE_CONVERSATION_VERSION = void 0;
|
|
5
|
+
exports.conversationToMessages = conversationToMessages;
|
|
6
|
+
const ConversationAnalysis_1 = require("../models/ConversationAnalysis");
|
|
7
|
+
const errors_1 = require("../models/errors");
|
|
8
|
+
const LeadAnalysis_1 = require("../models/LeadAnalysis");
|
|
9
|
+
const extractJSON_1 = require("../utils/extractJSON");
|
|
10
|
+
exports.ANALYZE_CONVERSATION_VERSION = "1.0.0";
|
|
11
|
+
const SPEAKER_LABELS = { business: "Business", customer: "Customer", other: "Other" };
|
|
12
|
+
/** The conversation as one user message: what we know about it, then the transcript. */
|
|
13
|
+
function conversationToMessages(system, conversation) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const c = conversation;
|
|
16
|
+
const facts = [
|
|
17
|
+
`Channel: ${c.channel === "phone" ? "phone call" : "chat"}`,
|
|
18
|
+
c.businessName && `Business: ${c.businessName}`,
|
|
19
|
+
c.request && `What the customer asked about: ${c.request}`,
|
|
20
|
+
c.conversationDate &&
|
|
21
|
+
`Conversation date: ${c.conversationDate}${c.timeZone ? ` (time zone ${c.timeZone})` : ""}`
|
|
22
|
+
].filter((line) => !!line);
|
|
23
|
+
const transcript = ((_a = c.turns) === null || _a === void 0 ? void 0 : _a.length)
|
|
24
|
+
? c.turns.map((turn) => { var _a; return `${(_a = SPEAKER_LABELS[turn.speaker]) !== null && _a !== void 0 ? _a : "Other"}: ${turn.text}`; }).join("\n")
|
|
25
|
+
: ((_b = c.text) !== null && _b !== void 0 ? _b : "").trim();
|
|
26
|
+
return [
|
|
27
|
+
{ role: "system", content: system },
|
|
28
|
+
{ role: "user", content: `${facts.join("\n")}\n\n${transcript}` }
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generates a prompt that reads a conversation between a business and a customer and returns what
|
|
33
|
+
* was agreed: whether the job was booked, the appointment, the price, follow-ups, objections, and
|
|
34
|
+
* whether the lead is real.
|
|
35
|
+
*/
|
|
36
|
+
const generateAnalyzeConversation = ({ businessDescription, conversation }, overrides) => {
|
|
37
|
+
const intro = businessDescription
|
|
38
|
+
? `
|
|
39
|
+
You work for a home-services business with the following description:
|
|
40
|
+
|
|
41
|
+
===
|
|
42
|
+
${businessDescription}
|
|
43
|
+
===`
|
|
44
|
+
: "You work for a home-services business.";
|
|
45
|
+
const system = `
|
|
46
|
+
${intro}
|
|
47
|
+
|
|
48
|
+
You read a conversation between the business (a person, or an AI agent answering for it) and a customer about a job, and record what was agreed. Phone transcripts come from speech recognition and may contain mistakes; read through them. When the speakers aren't labelled, work out who is who.
|
|
49
|
+
|
|
50
|
+
Return a JSON object with these properties:
|
|
51
|
+
|
|
52
|
+
"booked": whether the job was booked on this conversation.
|
|
53
|
+
yes: a visit, appointment or job was scheduled or confirmed (a day or time was agreed, or the business clearly confirmed it is coming).
|
|
54
|
+
not_yet: they mean to book but nothing is set: the business will send a quote, call back or check its schedule, or the customer will think about it.
|
|
55
|
+
no: it won't happen: the customer declined or went elsewhere, or the business can't or won't do the job.
|
|
56
|
+
unknown: the conversation doesn't say (too short, cut off, inaudible, or only small talk).
|
|
57
|
+
When in doubt between two answers, choose the less certain one.
|
|
58
|
+
|
|
59
|
+
"appointment": the appointment that was set, or null. "text" is how it was said. "start" and "end" are ISO 8601 date-times with the offset of the business's time zone, worked out from the conversation date; null when they can't be worked out exactly (e.g. "sometime next week").
|
|
60
|
+
|
|
61
|
+
"quotedPrice": the price the business gave, or null. "text" is how it was said; "amount" is a number in US dollars when a single figure was given, otherwise null. A range or "it depends" keeps "amount" null.
|
|
62
|
+
|
|
63
|
+
"jobType" and "urgency": the trade and how time-sensitive the job is.
|
|
64
|
+
urgency: LOW (no rush), MEDIUM (within a couple of weeks), HIGH (within days to avoid damage), URGENT (damage or danger now), NOT_SPECIFIED (can't tell).
|
|
65
|
+
|
|
66
|
+
"leadQuality":
|
|
67
|
+
genuine: a real customer who wants work from this business.
|
|
68
|
+
spam: a sales pitch, robocall, vendor, or anything not from a real customer.
|
|
69
|
+
wrong_number: they meant to reach someone else.
|
|
70
|
+
out_of_area: a real customer the business can't serve because of where they are.
|
|
71
|
+
existing_customer: someone calling about work already done or booked (billing, rescheduling, a complaint).
|
|
72
|
+
unknown: can't tell.
|
|
73
|
+
|
|
74
|
+
"lostReason": only when "booked" is "no": price, timing, went_elsewhere, out_of_scope (the business doesn't do this job), or other. Otherwise null.
|
|
75
|
+
|
|
76
|
+
"followUps": what someone said they would do afterwards, e.g. the business sending a quote or the customer sending photos. Each has "who" (business or customer), "what", "due" (ISO 8601 date or date-time, or null) and "dueText" (as said, or null). An empty list when nothing was promised.
|
|
77
|
+
|
|
78
|
+
"objections": the customer's hesitations: any of price, timing, went_elsewhere, out_of_scope, other. "objectionText" sums them up in the customer's words where possible, or null.
|
|
79
|
+
|
|
80
|
+
"businessQuality": how the business handled it. "offeredTime": whether it offered a day or time. "askedDetails": whether it asked about the job. "notes": one short sentence when something stands out, or null.
|
|
81
|
+
|
|
82
|
+
"summary": one to three plain sentences on what was agreed, including any day, time or price. Name no people other than the business.
|
|
83
|
+
|
|
84
|
+
Only record what the conversation says. Never invent a time, price or promise.
|
|
85
|
+
`;
|
|
86
|
+
return Object.assign(Object.assign({ model: "gpt-4o-mini", max_tokens: 1024, frequency_penalty: 0,
|
|
87
|
+
// The same conversation should give the same answer.
|
|
88
|
+
temperature: 0, top_p: 1, presence_penalty: 0 }, overrides), { response_format: {
|
|
89
|
+
type: "json_schema",
|
|
90
|
+
json_schema: {
|
|
91
|
+
name: "analyze_conversation",
|
|
92
|
+
strict: false,
|
|
93
|
+
schema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
additionalProperties: false,
|
|
96
|
+
required: [
|
|
97
|
+
"booked",
|
|
98
|
+
"appointment",
|
|
99
|
+
"quotedPrice",
|
|
100
|
+
"jobType",
|
|
101
|
+
"urgency",
|
|
102
|
+
"leadQuality",
|
|
103
|
+
"lostReason",
|
|
104
|
+
"followUps",
|
|
105
|
+
"objections",
|
|
106
|
+
"objectionText",
|
|
107
|
+
"businessQuality",
|
|
108
|
+
"summary"
|
|
109
|
+
],
|
|
110
|
+
properties: {
|
|
111
|
+
booked: { type: "string", enum: [...ConversationAnalysis_1.CONVERSATION_BOOKED] },
|
|
112
|
+
appointment: {
|
|
113
|
+
type: ["object", "null"],
|
|
114
|
+
properties: {
|
|
115
|
+
start: { type: ["string", "null"] },
|
|
116
|
+
end: { type: ["string", "null"] },
|
|
117
|
+
text: { type: "string" }
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
quotedPrice: {
|
|
121
|
+
type: ["object", "null"],
|
|
122
|
+
properties: { amount: { type: ["number", "null"] }, text: { type: "string" } }
|
|
123
|
+
},
|
|
124
|
+
jobType: { type: "string", enum: [...LeadAnalysis_1.JOB_TYPES] },
|
|
125
|
+
urgency: { type: "string", enum: [...LeadAnalysis_1.URGENCY_TYPES] },
|
|
126
|
+
leadQuality: { type: "string", enum: [...ConversationAnalysis_1.CONVERSATION_LEAD_QUALITY] },
|
|
127
|
+
lostReason: { type: ["string", "null"], enum: [...ConversationAnalysis_1.CONVERSATION_REASONS, null] },
|
|
128
|
+
followUps: {
|
|
129
|
+
type: "array",
|
|
130
|
+
items: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
who: { type: "string", enum: ["business", "customer"] },
|
|
134
|
+
what: { type: "string" },
|
|
135
|
+
due: { type: ["string", "null"] },
|
|
136
|
+
dueText: { type: ["string", "null"] }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
objections: { type: "array", items: { type: "string", enum: [...ConversationAnalysis_1.CONVERSATION_REASONS] } },
|
|
141
|
+
objectionText: { type: ["string", "null"] },
|
|
142
|
+
businessQuality: {
|
|
143
|
+
type: ["object", "null"],
|
|
144
|
+
properties: {
|
|
145
|
+
offeredTime: { type: "boolean" },
|
|
146
|
+
askedDetails: { type: "boolean" },
|
|
147
|
+
notes: { type: ["string", "null"] }
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
summary: { type: "string" }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, type: "completions", messages: conversationToMessages(system, conversation) });
|
|
155
|
+
};
|
|
156
|
+
exports.generateAnalyzeConversation = generateAnalyzeConversation;
|
|
157
|
+
const text = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
|
|
158
|
+
const oneOf = (values, v) => values.includes(v) ? v : undefined;
|
|
159
|
+
const isDate = (v) => !Number.isNaN(Date.parse(v));
|
|
160
|
+
/**
|
|
161
|
+
* Reads the model's reply. Every value is checked against what is allowed, because Bedrock ignores
|
|
162
|
+
* the JSON schema. Throws `LLMResponseParseError` when the reply isn't JSON or has no summary: a
|
|
163
|
+
* caller that writes this onto a lead should skip it rather than record a made-up default.
|
|
164
|
+
*/
|
|
165
|
+
const analyzeConversationResponseParse = (response) => {
|
|
166
|
+
var _a, _b, _c, _d;
|
|
167
|
+
let parsed;
|
|
168
|
+
try {
|
|
169
|
+
parsed = JSON.parse((0, extractJSON_1.extractJSON)(response));
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
throw new errors_1.LLMResponseParseError("analyzeConversation", response, e);
|
|
173
|
+
}
|
|
174
|
+
const summary = text(parsed === null || parsed === void 0 ? void 0 : parsed.summary);
|
|
175
|
+
if (!summary) {
|
|
176
|
+
throw new errors_1.LLMResponseParseError("analyzeConversation", response, "no summary");
|
|
177
|
+
}
|
|
178
|
+
const booked = (_a = oneOf(ConversationAnalysis_1.CONVERSATION_BOOKED, parsed.booked)) !== null && _a !== void 0 ? _a : "unknown";
|
|
179
|
+
const leadQuality = (_b = oneOf(ConversationAnalysis_1.CONVERSATION_LEAD_QUALITY, parsed.leadQuality)) !== null && _b !== void 0 ? _b : "unknown";
|
|
180
|
+
const labels = (0, LeadAnalysis_1.normalizeLeadLabels)({ jobType: parsed.jobType, urgency: parsed.urgency });
|
|
181
|
+
const out = { booked, leadQuality, followUps: [], objections: [], summary };
|
|
182
|
+
const appointmentText = text((_c = parsed.appointment) === null || _c === void 0 ? void 0 : _c.text);
|
|
183
|
+
if (appointmentText) {
|
|
184
|
+
const start = text(parsed.appointment.start);
|
|
185
|
+
const end = text(parsed.appointment.end);
|
|
186
|
+
out.appointment = Object.assign(Object.assign(Object.assign({}, (start && isDate(start) ? { start } : {})), (end && isDate(end) ? { end } : {})), { text: appointmentText });
|
|
187
|
+
}
|
|
188
|
+
const priceText = text((_d = parsed.quotedPrice) === null || _d === void 0 ? void 0 : _d.text);
|
|
189
|
+
if (priceText) {
|
|
190
|
+
const amount = parsed.quotedPrice.amount;
|
|
191
|
+
out.quotedPrice = Object.assign(Object.assign({}, (typeof amount === "number" && Number.isFinite(amount) && amount > 0 ? { amount } : {})), { currency: "USD", text: priceText });
|
|
192
|
+
}
|
|
193
|
+
if (labels.jobType)
|
|
194
|
+
out.jobType = labels.jobType;
|
|
195
|
+
if (labels.urgency)
|
|
196
|
+
out.urgency = labels.urgency;
|
|
197
|
+
const lostReason = oneOf(ConversationAnalysis_1.CONVERSATION_REASONS, parsed.lostReason);
|
|
198
|
+
if (booked === "no" && lostReason)
|
|
199
|
+
out.lostReason = lostReason;
|
|
200
|
+
if (Array.isArray(parsed.followUps)) {
|
|
201
|
+
for (const f of parsed.followUps) {
|
|
202
|
+
const who = oneOf(["business", "customer"], f === null || f === void 0 ? void 0 : f.who);
|
|
203
|
+
const what = text(f === null || f === void 0 ? void 0 : f.what);
|
|
204
|
+
if (!who || !what)
|
|
205
|
+
continue;
|
|
206
|
+
const due = text(f.due);
|
|
207
|
+
const dueText = text(f.dueText);
|
|
208
|
+
const followUp = { who, what };
|
|
209
|
+
if (due && isDate(due))
|
|
210
|
+
followUp.due = due;
|
|
211
|
+
if (dueText)
|
|
212
|
+
followUp.dueText = dueText;
|
|
213
|
+
out.followUps.push(followUp);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (Array.isArray(parsed.objections)) {
|
|
217
|
+
out.objections = [
|
|
218
|
+
...new Set(parsed.objections.map((o) => oneOf(ConversationAnalysis_1.CONVERSATION_REASONS, o)).filter(Boolean))
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
const objectionText = text(parsed.objectionText);
|
|
222
|
+
if (objectionText)
|
|
223
|
+
out.objectionText = objectionText;
|
|
224
|
+
const q = parsed.businessQuality;
|
|
225
|
+
if (q && typeof q === "object") {
|
|
226
|
+
const notes = text(q.notes);
|
|
227
|
+
out.businessQuality = Object.assign({ offeredTime: q.offeredTime === true, askedDetails: q.askedDetails === true }, (notes ? { notes } : {}));
|
|
228
|
+
}
|
|
229
|
+
return out;
|
|
230
|
+
};
|
|
231
|
+
exports.analyzeConversationResponseParse = analyzeConversationResponseParse;
|
|
232
|
+
//# sourceMappingURL=AnalyzeConversation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyzeConversation.js","sourceRoot":"","sources":["../../src/prompts/AnalyzeConversation.ts"],"names":[],"mappings":";AAAA,kCAAkC;;;AAgClC,wDAmBC;AAhDD,yEAUwC;AACxC,6CAAyD;AACzD,yDAAuF;AACvF,sDAAmD;AAEtC,QAAA,4BAA4B,GAAG,OAAO,CAAC;AAWpD,MAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAW,CAAC;AAE/F,wFAAwF;AACxF,SAAgB,sBAAsB,CAClC,MAAc,EACd,YAAuC;;IAEvC,MAAM,CAAC,GAAG,YAAY,CAAC;IACvB,MAAM,KAAK,GAAG;QACV,YAAY,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EAAE;QAC3D,CAAC,CAAC,YAAY,IAAI,aAAa,CAAC,CAAC,YAAY,EAAE;QAC/C,CAAC,CAAC,OAAO,IAAI,kCAAkC,CAAC,CAAC,OAAO,EAAE;QAC1D,CAAC,CAAC,gBAAgB;YACd,sBAAsB,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;KAClG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,CAAA,MAAA,CAAC,CAAC,KAAK,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,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAU,EAAE,EAAE,CAAC,KAAK,CAAC,2CAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SAC5E,CAAC;IAC9B,CAAC;IACD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACjD,IAAI,aAAa;QAAE,GAAG,CAAC,aAAa,GAAG,aAAa,CAAC;IAErD,MAAM,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC;IACjC,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5B,GAAG,CAAC,eAAe,mBACf,WAAW,EAAE,CAAC,CAAC,WAAW,KAAK,IAAI,EACnC,YAAY,EAAE,CAAC,CAAC,YAAY,KAAK,IAAI,IAClC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC9B,CAAC;IACN,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AA/EW,QAAA,gCAAgC,oCA+E3C"}
|
package/lib/prompts/index.d.ts
CHANGED
package/lib/prompts/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
__exportStar(require("./AnalyzeCall"), exports);
|
|
19
|
+
__exportStar(require("./AnalyzeConversation"), exports);
|
|
19
20
|
__exportStar(require("./AnalyzeEmail"), exports);
|
|
20
21
|
__exportStar(require("./AnalyzeLead"), exports);
|
|
21
22
|
__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,gDAA8B;AAC9B,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,wDAAsC;AACtC,iDAA+B;AAC/B,gDAA8B;AAC9B,sDAAoC;AACpC,gDAA8B"}
|