@aiqa/sdk 1.2.0 → 1.3.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 +28 -0
- package/dist/browser/browser.d.ts +8 -1
- package/dist/browser/browser.js +8 -1
- package/dist/browser/browser.js.map +1 -1
- package/dist/node/node.d.ts +8 -1
- package/dist/node/node.js +8 -1
- package/dist/node/node.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ A TypeScript/JavaScript SDK for interacting with the AIQA WebSocket service. Thi
|
|
|
14
14
|
- [Fact Management](#fact-management)
|
|
15
15
|
- [Event Handling](#event-handling)
|
|
16
16
|
- [Types](#types)
|
|
17
|
+
- [FlagFactResult](#flagfactresult)
|
|
17
18
|
- [Examples](#examples)
|
|
18
19
|
- [Error Handling](#error-handling)
|
|
19
20
|
- [Semantic Versioning](#semantic-versioning)
|
|
@@ -175,6 +176,23 @@ facts.forEach((fact) => {
|
|
|
175
176
|
});
|
|
176
177
|
```
|
|
177
178
|
|
|
179
|
+
#### `flagFact(factId)`
|
|
180
|
+
|
|
181
|
+
Flags a fact for human review. Creates a signal that allow AIQA to improve review quality.
|
|
182
|
+
|
|
183
|
+
**Parameters:**
|
|
184
|
+
|
|
185
|
+
- `factId: string` - the `id` of the fact to flag (must match the `id` used in `addFact()`)
|
|
186
|
+
|
|
187
|
+
**Returns:**
|
|
188
|
+
|
|
189
|
+
- `Promise<FlagFactResult>` — `{ success: boolean }`
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
const result = await sdk.flagFact("fact-123");
|
|
193
|
+
console.log(result.success); // true
|
|
194
|
+
```
|
|
195
|
+
|
|
178
196
|
### Recording Management
|
|
179
197
|
|
|
180
198
|
#### `startRecording()`
|
|
@@ -309,6 +327,16 @@ type ApplicationFactInput = {
|
|
|
309
327
|
};
|
|
310
328
|
```
|
|
311
329
|
|
|
330
|
+
### FlagFactResult
|
|
331
|
+
|
|
332
|
+
Returned by `flagFact()`.
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
type FlagFactResult = {
|
|
336
|
+
success: boolean;
|
|
337
|
+
};
|
|
338
|
+
```
|
|
339
|
+
|
|
312
340
|
### ConversationLanguage
|
|
313
341
|
|
|
314
342
|
```typescript
|
|
@@ -15,6 +15,7 @@ declare enum Methods {
|
|
|
15
15
|
STOP_RECORDING = "STOP_RECORDING",
|
|
16
16
|
IS_RECORDING = "IS_RECORDING",
|
|
17
17
|
ADD_FACT = "ADD_FACT",
|
|
18
|
+
FLAG_FACT = "FLAG_FACT",
|
|
18
19
|
SET_CONVERSATION_PRODUCT = "SET_CONVERSATION_PRODUCT",
|
|
19
20
|
SET_CONVERSATION_LANGUAGE = "SET_CONVERSATION_LANGUAGE"
|
|
20
21
|
}
|
|
@@ -75,7 +76,11 @@ interface AddFactResult {
|
|
|
75
76
|
ai_answer?: string;
|
|
76
77
|
is_valid_answer: boolean;
|
|
77
78
|
question_asked?: boolean;
|
|
79
|
+
metadata?: Record<string, string>;
|
|
78
80
|
}
|
|
81
|
+
type FlagFactResult = {
|
|
82
|
+
success: boolean;
|
|
83
|
+
};
|
|
79
84
|
type SdkError = {
|
|
80
85
|
code: "INVALID_CONFIG" | "CONNECTION_ERROR" | "TIMEOUT" | "SERVER_ERROR" | "UNEXPECTED_RESPONSE";
|
|
81
86
|
message: string;
|
|
@@ -88,6 +93,7 @@ declare abstract class IAiqaSdk {
|
|
|
88
93
|
abstract off(eventName: string): void;
|
|
89
94
|
abstract getApplication(): Promise<Application>;
|
|
90
95
|
abstract addFact(fact: ApplicationFactInput): Promise<AddFactResult>;
|
|
96
|
+
abstract flagFact(factId: string): Promise<FlagFactResult>;
|
|
91
97
|
abstract getFacts(): Promise<ApplicationFact[]>;
|
|
92
98
|
abstract setConversationProduct(product: string): Promise<SetConversationProductResult>;
|
|
93
99
|
abstract setConversationLanguage(language: ConversationLanguage): Promise<SetConversationLanguageResult>;
|
|
@@ -110,6 +116,7 @@ declare class AiQaSdk implements IAiqaSdk {
|
|
|
110
116
|
getApplication(): Promise<Application>;
|
|
111
117
|
getFacts(): Promise<ApplicationFact[]>;
|
|
112
118
|
addFact(fact: ApplicationFactInput): Promise<AddFactResult>;
|
|
119
|
+
flagFact(factId: string): Promise<FlagFactResult>;
|
|
113
120
|
setConversationProduct(product: string): Promise<SetConversationProductResult>;
|
|
114
121
|
setConversationLanguage(language: ConversationLanguage): Promise<SetConversationLanguageResult>;
|
|
115
122
|
authenticate(): Promise<void>;
|
|
@@ -121,4 +128,4 @@ declare class AiQaSdk implements IAiqaSdk {
|
|
|
121
128
|
private isManagerEvent;
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, ConversationLanguage, FactAnswerFormatType, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationLanguageResult, type SetConversationProductResult, type VerificationStatus };
|
|
131
|
+
export { type AddFactResult, AiQaSdk, type Application, type ApplicationFact, type ApplicationFactAnswerChoice, type ApplicationFactAnswerFormat, type ApplicationFactInput, ConversationLanguage, FactAnswerFormatType, type FlagFactResult, IAiqaSdk, Methods, type QuestionStatus, type SdkError, type SdkEvent, type SetConversationLanguageResult, type SetConversationProductResult, type VerificationStatus };
|
package/dist/browser/browser.js
CHANGED
|
@@ -3345,6 +3345,7 @@ var Methods = /* @__PURE__ */ ((Methods2) => {
|
|
|
3345
3345
|
Methods2["STOP_RECORDING"] = "STOP_RECORDING";
|
|
3346
3346
|
Methods2["IS_RECORDING"] = "IS_RECORDING";
|
|
3347
3347
|
Methods2["ADD_FACT"] = "ADD_FACT";
|
|
3348
|
+
Methods2["FLAG_FACT"] = "FLAG_FACT";
|
|
3348
3349
|
Methods2["SET_CONVERSATION_PRODUCT"] = "SET_CONVERSATION_PRODUCT";
|
|
3349
3350
|
Methods2["SET_CONVERSATION_LANGUAGE"] = "SET_CONVERSATION_LANGUAGE";
|
|
3350
3351
|
return Methods2;
|
|
@@ -3395,7 +3396,7 @@ var compareVersions = (left, right) => {
|
|
|
3395
3396
|
// package.json
|
|
3396
3397
|
var package_default = {
|
|
3397
3398
|
name: "@aiqa/sdk",
|
|
3398
|
-
version: "1.
|
|
3399
|
+
version: "1.2.0",
|
|
3399
3400
|
main: "dist/node/node.js",
|
|
3400
3401
|
module: "dist/node/node.js",
|
|
3401
3402
|
types: "dist/node/node.d.ts",
|
|
@@ -3630,6 +3631,12 @@ var AiQaSdk = class {
|
|
|
3630
3631
|
const result = await this.sendMessage("ADD_FACT" /* ADD_FACT */, payload);
|
|
3631
3632
|
return result && result.data !== void 0 ? result.data : result;
|
|
3632
3633
|
}
|
|
3634
|
+
async flagFact(factId) {
|
|
3635
|
+
const result = await this.sendMessage("FLAG_FACT" /* FLAG_FACT */, {
|
|
3636
|
+
factId
|
|
3637
|
+
});
|
|
3638
|
+
return result && result.data !== void 0 ? result.data : result;
|
|
3639
|
+
}
|
|
3633
3640
|
async setConversationProduct(product) {
|
|
3634
3641
|
const result = await this.sendMessage("SET_CONVERSATION_PRODUCT" /* SET_CONVERSATION_PRODUCT */, {
|
|
3635
3642
|
product
|