@aiqa/sdk 3.1.0-develop.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -71
- package/dist/browser/browser.d.ts +9 -10
- package/dist/browser/browser.js +1 -1
- package/dist/browser/browser.js.map +1 -1
- package/dist/node/node.d.ts +9 -10
- package/dist/node/node.js +1 -1
- package/dist/node/node.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,6 @@ A TypeScript/JavaScript SDK for interacting with the AIQA WebSocket service. Thi
|
|
|
14
14
|
- [Recording Management](#recording-management)
|
|
15
15
|
- [Event Handling](#event-handling)
|
|
16
16
|
- [Verification lifecycle](#verification-lifecycle)
|
|
17
|
-
- [Watched facts](#watched-facts)
|
|
18
17
|
- [Types](#types)
|
|
19
18
|
- [Application](#application)
|
|
20
19
|
- [ApplicationVerificationSummary](#applicationverificationsummary)
|
|
@@ -332,10 +331,6 @@ verification result. The Promise resolves with an
|
|
|
332
331
|
`pending_confirmation_matched`, `pending_confirmation_unmatched`)
|
|
333
332
|
while you wait.
|
|
334
333
|
|
|
335
|
-
A [watched fact](#watched-facts) is the exception: its Promise resolves right
|
|
336
|
-
away with `verification_status: "awaiting_question"`, and the result arrives
|
|
337
|
-
later on `FACT_VERIFIED`.
|
|
338
|
-
|
|
339
334
|
A failed verification is not an error: an unmatched fact resolves with
|
|
340
335
|
`is_valid_answer: false` and, where present, `verification_status: "unmatched"`.
|
|
341
336
|
The Promise rejects only when the request itself fails — a dropped connection,
|
|
@@ -344,7 +339,7 @@ a timeout, a rejected payload.
|
|
|
344
339
|
**Returns:**
|
|
345
340
|
|
|
346
341
|
- `Promise<`[`AddFactResult`](#addfactresult)`>` — resolves once the fact
|
|
347
|
-
reaches a final `verification_status
|
|
342
|
+
reaches a final `verification_status`.
|
|
348
343
|
- `warnings`: present only when part of this `addFact()` was not applied.
|
|
349
344
|
See [`FactWarning`](#factwarning).
|
|
350
345
|
|
|
@@ -377,7 +372,10 @@ a timeout, a rejected payload.
|
|
|
377
372
|
reference?: boolean
|
|
378
373
|
/**
|
|
379
374
|
* Optional. Use "watch" to check the fact over the whole call instead of
|
|
380
|
-
* at one moment.
|
|
375
|
+
* at one moment, about every 15 seconds. addFact() then resolves right
|
|
376
|
+
* away with verification_status: "awaiting_question", and the result
|
|
377
|
+
* (matched or unmatched) arrives later on FACT_VERIFIED, at the latest
|
|
378
|
+
* when the call ends.
|
|
381
379
|
*/
|
|
382
380
|
evaluation?: "watch"
|
|
383
381
|
/**
|
|
@@ -537,8 +535,7 @@ Registers an event listener. Call `connect()` before `on()`.
|
|
|
537
535
|
- `FACT_VERIFIED` - fires on **every** verification state change, progress and
|
|
538
536
|
final result alike, for **every** fact in the conversation. Payload:
|
|
539
537
|
[`FactVerifiedPayload`](#factverifiedpayload). Use it to show live progress;
|
|
540
|
-
`addFact()`'s Promise resolves only on the final result
|
|
541
|
-
[watched fact](#watched-facts).
|
|
538
|
+
`addFact()`'s Promise resolves only on the final result.
|
|
542
539
|
|
|
543
540
|
```typescript
|
|
544
541
|
sdk.connect();
|
|
@@ -589,14 +586,11 @@ processing
|
|
|
589
586
|
matched | unmatched ← final
|
|
590
587
|
```
|
|
591
588
|
|
|
592
|
-
A [watched fact](#watched-facts) does not follow this sequence: it stays at
|
|
593
|
-
`awaiting_question` until it goes straight to `matched` or `unmatched`.
|
|
594
|
-
|
|
595
589
|
Rules:
|
|
596
590
|
|
|
597
591
|
- **`addFact()` resolves only on a final state** (`matched`,
|
|
598
|
-
`unmatched`)
|
|
599
|
-
|
|
592
|
+
`unmatched`). Show progress from the `FACT_VERIFIED` event, show the final
|
|
593
|
+
result from the Promise.
|
|
600
594
|
- **Handle a `verification_status` you don't recognize as `processing`.**
|
|
601
595
|
- **A fact sent with `prefilled: true` is never verified**, so it gets no
|
|
602
596
|
`verification_status` and no `FACT_VERIFIED` event.
|
|
@@ -612,57 +606,6 @@ Rules:
|
|
|
612
606
|
result on screen for the rest of the call, leave your `FACT_VERIFIED`
|
|
613
607
|
listener attached and always show the latest state for that `factId`.
|
|
614
608
|
|
|
615
|
-
### Watched facts
|
|
616
|
-
|
|
617
|
-
Send `evaluation: "watch"` for a fact you want checked over the whole call
|
|
618
|
-
rather than at one moment: from the moment you send it until it is `matched`
|
|
619
|
-
or the call ends.
|
|
620
|
-
|
|
621
|
-
```typescript
|
|
622
|
-
const result = await sdk.addFact({
|
|
623
|
-
id: "my_fact",
|
|
624
|
-
question: "What you want checked in the call",
|
|
625
|
-
expected_answer: "the value it has to match",
|
|
626
|
-
answer_format: { type: FactAnswerFormatType.string },
|
|
627
|
-
evaluation: "watch",
|
|
628
|
-
});
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
- **`question`:** describe, in plain words, what has to happen in the call for
|
|
632
|
-
this fact to be `matched`.
|
|
633
|
-
- **`expected_answer`:** the value it has to match.
|
|
634
|
-
- **Send `evaluation: "watch"` every time** you send the fact. Without it, the
|
|
635
|
-
fact goes through the regular
|
|
636
|
-
[Verification lifecycle](#verification-lifecycle): it is checked against one
|
|
637
|
-
moment of the call, and `addFact()` waits for the final result.
|
|
638
|
-
- **Send the fact before that part of the call starts.** Only the part of the
|
|
639
|
-
call shortly before you send the fact is checked; anything earlier is
|
|
640
|
-
missed.
|
|
641
|
-
- **`addFact()` resolves right away** with
|
|
642
|
-
`verification_status: "awaiting_question"` and `is_valid_answer: false`.
|
|
643
|
-
This is not a result: don't show it as one.
|
|
644
|
-
- **The result arrives on `FACT_VERIFIED`** for that `factId`. A watched fact
|
|
645
|
-
goes from `awaiting_question` straight to `matched` or `unmatched`. Read
|
|
646
|
-
`payload.verification_status` and `payload.error`:
|
|
647
|
-
- `matched`: it happened in the call, matching `expected_answer` when you
|
|
648
|
-
sent one.
|
|
649
|
-
- `unmatched` with `error: "question-not-detected"`: it never happened.
|
|
650
|
-
- `unmatched` with `error: "answer-not-found"`: it happened, but could not
|
|
651
|
-
be confirmed against `expected_answer`.
|
|
652
|
-
- `unmatched` with no `error`: it happened, but with a different value. This
|
|
653
|
-
result is final.
|
|
654
|
-
- **If it never happens**, the result is `unmatched` and arrives only when the
|
|
655
|
-
call ends. To get it as an event, keep the SDK connected and your
|
|
656
|
-
`FACT_VERIFIED` listener attached until then. Otherwise, call `getFacts()`
|
|
657
|
-
after the call: its `verification_status` shows `matched` or `unmatched`,
|
|
658
|
-
but not the reason (`error`) for an `unmatched` result.
|
|
659
|
-
- **Sending a watched fact again** with the same `id` and `expected_answer`:
|
|
660
|
-
if it already matched, `addFact()` resolves with `matched`. Otherwise it
|
|
661
|
-
resolves with `awaiting_question` and the result arrives on `FACT_VERIFIED`
|
|
662
|
-
as before. With a different `expected_answer`, the earlier result no longer
|
|
663
|
-
applies: `addFact()` resolves with `awaiting_question` again, and the new
|
|
664
|
-
result arrives on `FACT_VERIFIED`.
|
|
665
|
-
|
|
666
609
|
## Types
|
|
667
610
|
|
|
668
611
|
### Application
|
|
@@ -756,8 +699,7 @@ type ApplicationFact = ApplicationFactInput & {
|
|
|
756
699
|
### AddFactResult
|
|
757
700
|
|
|
758
701
|
Resolved value of `addFact()`. Only sent once the fact reaches its final
|
|
759
|
-
state
|
|
760
|
-
[Verification lifecycle](#verification-lifecycle).
|
|
702
|
+
state — see [Verification lifecycle](#verification-lifecycle).
|
|
761
703
|
|
|
762
704
|
```typescript
|
|
763
705
|
interface AddFactResult {
|
|
@@ -786,9 +728,8 @@ interface AddFactResult {
|
|
|
786
728
|
answer_match_score?: number;
|
|
787
729
|
|
|
788
730
|
/**
|
|
789
|
-
* `matched` or `unmatched
|
|
790
|
-
*
|
|
791
|
-
* `FACT_VERIFIED`. If this field is missing, use `is_valid_answer`.
|
|
731
|
+
* The final state: `matched` or `unmatched` whenever it is present.
|
|
732
|
+
* Fall back to `is_valid_answer` when it is missing.
|
|
792
733
|
*/
|
|
793
734
|
verification_status?: VerificationStatus;
|
|
794
735
|
|
|
@@ -918,7 +859,10 @@ type ApplicationFactInput = {
|
|
|
918
859
|
reference?: boolean;
|
|
919
860
|
/**
|
|
920
861
|
* Optional. Use `"watch"` to check the fact over the whole call instead of
|
|
921
|
-
* at one moment
|
|
862
|
+
* at one moment, about every 15 seconds. `addFact()` then resolves right
|
|
863
|
+
* away with `verification_status: "awaiting_question"`, and the result
|
|
864
|
+
* (`matched` or `unmatched`) arrives later on `FACT_VERIFIED`, at the latest
|
|
865
|
+
* when the call ends.
|
|
922
866
|
*/
|
|
923
867
|
evaluation?: "watch";
|
|
924
868
|
/**
|
|
@@ -217,7 +217,10 @@ type ApplicationFactInput = {
|
|
|
217
217
|
reference?: boolean;
|
|
218
218
|
/**
|
|
219
219
|
* Optional. Use `"watch"` to check the fact over the whole call instead of
|
|
220
|
-
* at one moment
|
|
220
|
+
* at one moment, about every 15 seconds. `addFact()` then resolves right
|
|
221
|
+
* away with `verification_status: "awaiting_question"`, and the result
|
|
222
|
+
* (`matched` or `unmatched`) arrives later on `FACT_VERIFIED`, at the latest
|
|
223
|
+
* when the call ends.
|
|
221
224
|
*/
|
|
222
225
|
evaluation?: "watch";
|
|
223
226
|
/**
|
|
@@ -237,9 +240,7 @@ type QuestionStatus = "searching" | "asked" | "not_asked";
|
|
|
237
240
|
* `processing`.
|
|
238
241
|
*
|
|
239
242
|
* - `processing` queued, or nothing to go on yet
|
|
240
|
-
* - `awaiting_question` the advisor hasn't asked the question yet
|
|
241
|
-
* for a watched fact, its state until the
|
|
242
|
-
* result arrives
|
|
243
|
+
* - `awaiting_question` the advisor hasn't asked the question yet
|
|
243
244
|
* - `awaiting_answer` asked, the customer hasn't answered yet
|
|
244
245
|
* - `partial` partial evidence so far (e.g. "305" of "30521")
|
|
245
246
|
* - `pending_confirmation_matched` a matching answer is held briefly in case
|
|
@@ -280,7 +281,7 @@ interface AddFactResult {
|
|
|
280
281
|
answer_type?: string;
|
|
281
282
|
agent_answer?: string;
|
|
282
283
|
ai_answer?: string;
|
|
283
|
-
/** `false` for a fact that was never verified, such as a prefilled or reference one.
|
|
284
|
+
/** `false` for a fact that was never verified, such as a prefilled or reference one. */
|
|
284
285
|
is_valid_answer: boolean;
|
|
285
286
|
question_asked?: boolean;
|
|
286
287
|
/**
|
|
@@ -295,9 +296,8 @@ interface AddFactResult {
|
|
|
295
296
|
answer_match_score?: number;
|
|
296
297
|
metadata?: Record<string, string>;
|
|
297
298
|
/**
|
|
298
|
-
* `matched` or `unmatched
|
|
299
|
-
*
|
|
300
|
-
* `FACT_VERIFIED`. If this field is missing, use `is_valid_answer`.
|
|
299
|
+
* The final state: `matched` or `unmatched` whenever it is present. Fall
|
|
300
|
+
* back to `is_valid_answer` when it is missing.
|
|
301
301
|
*/
|
|
302
302
|
verification_status?: VerificationStatus;
|
|
303
303
|
/**
|
|
@@ -313,8 +313,7 @@ interface AddFactResult {
|
|
|
313
313
|
/**
|
|
314
314
|
* Payload of the `FACT_VERIFIED` event, which fires on every state change —
|
|
315
315
|
* see `VerificationStatus`. Use it to show progress; `addFact()` resolves
|
|
316
|
-
* only once a fact is done
|
|
317
|
-
* here.
|
|
316
|
+
* only once a fact is done.
|
|
318
317
|
*/
|
|
319
318
|
interface FactVerifiedPayload {
|
|
320
319
|
factId: string;
|
package/dist/browser/browser.js
CHANGED
|
@@ -3407,7 +3407,7 @@ var compareVersions = (left, right) => {
|
|
|
3407
3407
|
// package.json
|
|
3408
3408
|
var package_default = {
|
|
3409
3409
|
name: "@aiqa/sdk",
|
|
3410
|
-
version: "3.1.0-develop.
|
|
3410
|
+
version: "3.1.0-develop.3",
|
|
3411
3411
|
main: "dist/node/node.js",
|
|
3412
3412
|
module: "dist/node/node.js",
|
|
3413
3413
|
types: "dist/node/node.d.ts",
|