@aiqa/sdk 2.1.0 → 2.1.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/README.md +184 -216
- package/dist/browser/browser.d.ts +87 -103
- package/dist/browser/browser.js +1 -1
- package/dist/browser/browser.js.map +1 -1
- package/dist/node/node.d.ts +87 -103
- package/dist/node/node.js +1 -1
- package/dist/node/node.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,39 +1,50 @@
|
|
|
1
1
|
import { Socket } from 'socket.io-client';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* failed,
|
|
6
|
-
*
|
|
7
|
-
* was skipped and nothing was wrong reads `no_errors`.
|
|
4
|
+
* Overall result for the call: `critical_errors` if a fact you sent with
|
|
5
|
+
* `critical: true` failed, `errors` if any other fact failed, else
|
|
6
|
+
* `no_errors`.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* call
|
|
8
|
+
* Only answers count. A question that was never asked never raises it, so a
|
|
9
|
+
* call where nothing was asked reads `no_errors`.
|
|
10
|
+
*
|
|
11
|
+
* Not the same as `VerificationStatus`, which describes a single fact.
|
|
11
12
|
*/
|
|
12
13
|
type ApplicationVerificationStatus = "no_errors" | "errors" | "critical_errors";
|
|
13
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* How the facts on one application are counted up. None of these is a count of
|
|
16
|
+
* facts that passed, and they overlap — to show a pass count, count the facts
|
|
17
|
+
* whose `verification_status` is `matched` in `getFacts()`.
|
|
18
|
+
*/
|
|
14
19
|
type ApplicationVerificationSummary = {
|
|
15
20
|
status: ApplicationVerificationStatus;
|
|
16
21
|
/** Facts whose answer did not match the expected one. */
|
|
17
22
|
count_errors: number;
|
|
18
|
-
/**
|
|
23
|
+
/** The facts in `count_errors` that you sent with `critical: true`. */
|
|
19
24
|
count_critical_errors: number;
|
|
20
25
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* `
|
|
26
|
+
* Every fact on the application, checked or not. The other counters are
|
|
27
|
+
* subsets of it and can overlap each other, so no subtraction from
|
|
28
|
+
* `count_total` yields a pass count.
|
|
24
29
|
*/
|
|
25
30
|
count_total: number;
|
|
26
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Facts whose question was never asked. Excludes the still-pending ones, but
|
|
33
|
+
* overlaps `count_errors`: a fact never asked that came back wrong is in both.
|
|
34
|
+
*/
|
|
27
35
|
count_not_asked: number;
|
|
28
|
-
/**
|
|
36
|
+
/** The facts in `count_not_asked` that you sent with `critical: true`. */
|
|
29
37
|
count_critical_not_asked: number;
|
|
30
38
|
/**
|
|
31
|
-
* Facts
|
|
32
|
-
*
|
|
33
|
-
* call proceeds.
|
|
39
|
+
* Facts added but not resolved yet. During a live call most facts sit here
|
|
40
|
+
* and move into the other counters as their results arrive.
|
|
34
41
|
*/
|
|
35
42
|
count_pending: number;
|
|
36
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Facts flagged as suspicious when the call is reviewed — for instance the
|
|
45
|
+
* agent leading the customer to the expected answer. Independent of the
|
|
46
|
+
* answer: a matched fact can be flagged. Reads 0 while the call is running.
|
|
47
|
+
*/
|
|
37
48
|
count_suspicious: number;
|
|
38
49
|
};
|
|
39
50
|
type Application = {
|
|
@@ -41,12 +52,14 @@ type Application = {
|
|
|
41
52
|
client_name: string;
|
|
42
53
|
client_phone_number: string;
|
|
43
54
|
agent_id: string;
|
|
55
|
+
/** Comes back empty. Set an agent name with `updateConversation()`. */
|
|
44
56
|
agent_first_name: string;
|
|
57
|
+
/** Comes back empty. Set an agent name with `updateConversation()`. */
|
|
45
58
|
agent_last_name: string;
|
|
46
59
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
60
|
+
* How the call is going so far. When it is missing there is no summary —
|
|
61
|
+
* which is not the same as all zeros — and the fields above may then be the
|
|
62
|
+
* ones from authentication, without an `updateConversation()` you made since.
|
|
50
63
|
*/
|
|
51
64
|
verification?: ApplicationVerificationSummary;
|
|
52
65
|
};
|
|
@@ -84,7 +97,7 @@ type UpdateConversationInput = {
|
|
|
84
97
|
advisorName?: string;
|
|
85
98
|
agentGroups?: string[];
|
|
86
99
|
};
|
|
87
|
-
/**
|
|
100
|
+
/** Only the fields you sent come back in `conversation`. */
|
|
88
101
|
type UpdateConversationResult = {
|
|
89
102
|
success: boolean;
|
|
90
103
|
conversation: {
|
|
@@ -129,11 +142,10 @@ type ApplicationFactAnswerFormat = {
|
|
|
129
142
|
type ApplicationFactInput = {
|
|
130
143
|
id: string;
|
|
131
144
|
/**
|
|
132
|
-
* Stable identifier for the underlying question, shared across applications
|
|
133
|
-
* conversations. When provided it
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* dashboard are scoped per `questionId`.
|
|
145
|
+
* Stable identifier for the underlying question, shared across applications
|
|
146
|
+
* and conversations. When provided it identifies the question instead of
|
|
147
|
+
* `id`. Keep it consistent across calls: whatever AIQA has tuned for a
|
|
148
|
+
* question is attached to this identity.
|
|
137
149
|
*/
|
|
138
150
|
questionId?: string;
|
|
139
151
|
question: string;
|
|
@@ -142,35 +154,41 @@ type ApplicationFactInput = {
|
|
|
142
154
|
category_id?: string;
|
|
143
155
|
category_name?: string;
|
|
144
156
|
language?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Mark the question critical: its failures land in `count_critical_errors`,
|
|
159
|
+
* and one of them sets the call's `status` to `critical_errors`.
|
|
160
|
+
*/
|
|
145
161
|
critical?: boolean;
|
|
146
162
|
is_skipped?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Your own identifiers for this fact — a form field ID, a section name,
|
|
165
|
+
* anything that lets your UI map the result back to the right place.
|
|
166
|
+
* `getFacts()` returns it unchanged — `{}` for a fact you added without
|
|
167
|
+
* one — and it plays no part in verification.
|
|
168
|
+
*
|
|
169
|
+
* Keys and values must all be strings, and each value is limited to 1024
|
|
170
|
+
* characters. A payload that breaks either rule is rejected.
|
|
171
|
+
*/
|
|
147
172
|
metadata?: Record<string, string>;
|
|
148
173
|
};
|
|
149
174
|
type QuestionStatus = "searching" | "asked" | "not_asked";
|
|
150
175
|
/**
|
|
151
|
-
* Per-fact verification state.
|
|
176
|
+
* Per-fact verification state. Handle any value you don't recognize as
|
|
177
|
+
* `processing`.
|
|
152
178
|
*
|
|
153
|
-
*
|
|
154
|
-
* the
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* - `
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* - `
|
|
165
|
-
*
|
|
166
|
-
* clarifications (e.g. spellings, "I mean…");
|
|
167
|
-
* resolves to `matched`/`unmatched`
|
|
168
|
-
* - `pending_confirmation_unmatched` same as above but the held verdict is
|
|
169
|
-
* `unmatched`; UI can show "we heard X but it
|
|
170
|
-
* doesn't match, waiting to confirm" instead
|
|
171
|
-
* of a hard red verdict
|
|
172
|
-
* - `matched` terminal: answer matched expected
|
|
173
|
-
* - `unmatched` terminal: budget exhausted with no match
|
|
179
|
+
* - `processing` queued, or nothing to go on yet
|
|
180
|
+
* - `awaiting_question` the agent hasn't asked the question yet
|
|
181
|
+
* - `awaiting_answer` asked, the customer hasn't answered yet
|
|
182
|
+
* - `partial` partial evidence so far (e.g. "305" of "30521")
|
|
183
|
+
* - `pending_confirmation_matched` a matching answer is held briefly in case
|
|
184
|
+
* the customer corrects it mid-answer
|
|
185
|
+
* (spellings, "I mean…"); resolves to
|
|
186
|
+
* `matched`/`unmatched`
|
|
187
|
+
* - `pending_confirmation_unmatched` same, with an unmatched answer held; show
|
|
188
|
+
* "we heard X but it doesn't match, waiting
|
|
189
|
+
* to confirm" rather than a hard result
|
|
190
|
+
* - `matched` final: the answer matched
|
|
191
|
+
* - `unmatched` final: the answer did not match
|
|
174
192
|
*/
|
|
175
193
|
type VerificationStatus = "processing" | "awaiting_question" | "awaiting_answer" | "partial" | "pending_confirmation_matched" | "pending_confirmation_unmatched" | "matched" | "unmatched";
|
|
176
194
|
type ApplicationFact = ApplicationFactInput & {
|
|
@@ -181,7 +199,7 @@ type ApplicationFact = ApplicationFactInput & {
|
|
|
181
199
|
flagged: boolean;
|
|
182
200
|
};
|
|
183
201
|
interface AddFactResult {
|
|
184
|
-
/** Conversation the fact was attached to.
|
|
202
|
+
/** Conversation the fact was attached to. */
|
|
185
203
|
conversation_id?: string;
|
|
186
204
|
/** Echo of the original question text from the fact input. */
|
|
187
205
|
question?: string;
|
|
@@ -192,24 +210,19 @@ interface AddFactResult {
|
|
|
192
210
|
is_valid_answer: boolean;
|
|
193
211
|
question_asked?: boolean;
|
|
194
212
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* Renamed from `match_score` to disambiguate from the answer-side score.
|
|
213
|
+
* How closely the agent's utterance matched the expected question, on a 0–1
|
|
214
|
+
* or a 0–100 scale. Higher is closer.
|
|
198
215
|
*/
|
|
199
216
|
question_match_score?: number;
|
|
200
217
|
/**
|
|
201
|
-
* 0–1 score
|
|
202
|
-
*
|
|
203
|
-
* matched-components ratio). Undefined when no partial signal exists,
|
|
204
|
-
* or on older server versions.
|
|
218
|
+
* 0–1 score for how closely the customer's answer matched the expected one.
|
|
219
|
+
* Undefined when there is no partial signal to score.
|
|
205
220
|
*/
|
|
206
221
|
answer_match_score?: number;
|
|
207
222
|
metadata?: Record<string, string>;
|
|
208
223
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* resolves on terminals. Optional for compatibility with older
|
|
212
|
-
* server versions.
|
|
224
|
+
* The final state: `matched` or `unmatched` whenever it is present. Fall
|
|
225
|
+
* back to `is_valid_answer` when it is missing.
|
|
213
226
|
*/
|
|
214
227
|
verification_status?: VerificationStatus;
|
|
215
228
|
/**
|
|
@@ -221,18 +234,9 @@ interface AddFactResult {
|
|
|
221
234
|
missing_components?: string[];
|
|
222
235
|
}
|
|
223
236
|
/**
|
|
224
|
-
* Payload of the `FACT_VERIFIED`
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* non-terminal (`partial`, `awaiting_question`, `awaiting_answer`,
|
|
228
|
-
* `pending_confirmation_matched`, `pending_confirmation_unmatched`,
|
|
229
|
-
* `processing`) AND terminal (`matched`, `unmatched`).
|
|
230
|
-
*
|
|
231
|
-
* Subscribe with:
|
|
232
|
-
* sdk.on("FACT_VERIFIED", (payload: FactVerifiedPayload) => {...});
|
|
233
|
-
*
|
|
234
|
-
* `addFact()`'s Promise resolves only on terminals; this event stream
|
|
235
|
-
* is the channel for rendering live progress in the agent UI.
|
|
237
|
+
* Payload of the `FACT_VERIFIED` event, which fires on every state change —
|
|
238
|
+
* see `VerificationStatus`. Use it to show progress; `addFact()` resolves
|
|
239
|
+
* only once a fact is done.
|
|
236
240
|
*/
|
|
237
241
|
interface FactVerifiedPayload {
|
|
238
242
|
factId: string;
|
|
@@ -242,12 +246,7 @@ interface FactVerifiedPayload {
|
|
|
242
246
|
answer_match_score?: number;
|
|
243
247
|
matched_components?: string[];
|
|
244
248
|
missing_components?: string[];
|
|
245
|
-
/**
|
|
246
|
-
* Inner data payload. Shape matches `AddFactResult` (minus the
|
|
247
|
-
* top-level envelope fields) so consumers can reuse the same
|
|
248
|
-
* rendering code for the terminal addFact() resolution and the
|
|
249
|
-
* broadcast event.
|
|
250
|
-
*/
|
|
249
|
+
/** Inner payload, shaped like `AddFactResult`. */
|
|
251
250
|
data?: AddFactResult;
|
|
252
251
|
error?: string;
|
|
253
252
|
}
|
|
@@ -255,38 +254,26 @@ type FlagFactResult = {
|
|
|
255
254
|
success: boolean;
|
|
256
255
|
};
|
|
257
256
|
/**
|
|
258
|
-
*
|
|
259
|
-
* not gate
|
|
260
|
-
*
|
|
261
|
-
* band.
|
|
257
|
+
* What the utterance appears to be doing in the conversation. A best-effort
|
|
258
|
+
* guess: display it if it helps, but do not gate behaviour on it. Its
|
|
259
|
+
* confidence band is `dialog_act_confidence`.
|
|
262
260
|
*/
|
|
263
261
|
type DialogAct = "question" | "answer" | "acknowledgement" | "filler" | "other";
|
|
264
262
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* two are unrelated, so do not compare or conflate them.
|
|
263
|
+
* Confidence band for `dialog_act` only. Unrelated to the numeric
|
|
264
|
+
* `confidence` field on the same utterance — do not compare the two.
|
|
268
265
|
*/
|
|
269
266
|
type DialogActConfidence = "high" | "medium" | "low";
|
|
270
267
|
/**
|
|
271
|
-
*
|
|
272
|
-
* `TRANSCRIPTION_UPDATED` broadcast.
|
|
268
|
+
* An utterance from the `TRANSCRIPTION_UPDATED` event.
|
|
273
269
|
*
|
|
274
|
-
*
|
|
275
|
-
* persisted by older server versions lack them.
|
|
276
|
-
* Treat any missing or nullish value as "unknown" — NOT as a deliberate
|
|
277
|
-
* negative signal. `is_ivr_filler_candidate === false` in particular
|
|
278
|
-
* does NOT round-trip through `undefined`, so consumer logic that wants
|
|
279
|
-
* "definitely not a filler" must check `=== false` after confirming the
|
|
280
|
-
* field is present.
|
|
270
|
+
* A missing optional field means "unknown", not "no".
|
|
281
271
|
*/
|
|
282
272
|
type Utterance = {
|
|
283
|
-
/**
|
|
273
|
+
/** Sort utterances by this: ids sort in chronological order. */
|
|
284
274
|
id: string;
|
|
285
275
|
call_id: number;
|
|
286
|
-
/**
|
|
287
|
-
* Reserved — currently always 0. Do not use for sorting; sort by `id`
|
|
288
|
-
* (UUIDv7) instead.
|
|
289
|
-
*/
|
|
276
|
+
/** Always 0. Sort by `id`, not this. */
|
|
290
277
|
order: number;
|
|
291
278
|
is_agent: boolean | null;
|
|
292
279
|
speaker: number;
|
|
@@ -302,10 +289,7 @@ type Utterance = {
|
|
|
302
289
|
spoken_digits_normalized?: string | null;
|
|
303
290
|
vendor?: string | null;
|
|
304
291
|
};
|
|
305
|
-
/**
|
|
306
|
-
* Payload of the `TRANSCRIPTION_UPDATED` broadcast event. Mirrors
|
|
307
|
-
* `TranscriptionUpdateResponseDto` on the gateway.
|
|
308
|
-
*/
|
|
292
|
+
/** Payload of the `TRANSCRIPTION_UPDATED` broadcast event. */
|
|
309
293
|
type TranscriptionUpdate = {
|
|
310
294
|
policyNumber: string;
|
|
311
295
|
conversationId: string;
|
package/dist/browser/browser.js
CHANGED
|
@@ -3398,7 +3398,7 @@ var compareVersions = (left, right) => {
|
|
|
3398
3398
|
// package.json
|
|
3399
3399
|
var package_default = {
|
|
3400
3400
|
name: "@aiqa/sdk",
|
|
3401
|
-
version: "2.1.0",
|
|
3401
|
+
version: "2.1.0-develop.5",
|
|
3402
3402
|
main: "dist/node/node.js",
|
|
3403
3403
|
module: "dist/node/node.js",
|
|
3404
3404
|
types: "dist/node/node.d.ts",
|