@superoffice/webapi 11.1.447 → 11.3.1349
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/dist/cjs/AIAgent.d.ts +115 -0
- package/dist/cjs/AIAgent.d.ts.map +1 -1
- package/dist/cjs/AIAgent.js +243 -0
- package/dist/cjs/AIAgent.js.map +1 -1
- package/dist/cjs/Carriers.d.ts +586 -1
- package/dist/cjs/Carriers.d.ts.map +1 -1
- package/dist/cjs/ContactAgent.d.ts +33 -2
- package/dist/cjs/ContactAgent.d.ts.map +1 -1
- package/dist/cjs/ContactAgent.js +67 -0
- package/dist/cjs/ContactAgent.js.map +1 -1
- package/dist/cjs/Converters.d.ts +33 -0
- package/dist/cjs/Converters.d.ts.map +1 -1
- package/dist/cjs/Converters.js +477 -24
- package/dist/cjs/Converters.js.map +1 -1
- package/dist/cjs/DiagnosticsAgent.d.ts +7 -0
- package/dist/cjs/DiagnosticsAgent.d.ts.map +1 -1
- package/dist/cjs/DiagnosticsAgent.js +24 -0
- package/dist/cjs/DiagnosticsAgent.js.map +1 -1
- package/dist/cjs/Enums.d.ts +156 -8
- package/dist/cjs/Enums.d.ts.map +1 -1
- package/dist/cjs/Enums.js +159 -7
- package/dist/cjs/Enums.js.map +1 -1
- package/dist/cjs/ListAgent.d.ts +24 -0
- package/dist/cjs/ListAgent.d.ts.map +1 -1
- package/dist/cjs/ListAgent.js +66 -0
- package/dist/cjs/ListAgent.js.map +1 -1
- package/dist/cjs/PersonAgent.d.ts +15 -0
- package/dist/cjs/PersonAgent.d.ts.map +1 -1
- package/dist/cjs/PersonAgent.js +33 -0
- package/dist/cjs/PersonAgent.js.map +1 -1
- package/dist/cjs/PersonRestApi.d.ts.map +1 -1
- package/dist/cjs/PersonRestApi.js.map +1 -1
- package/dist/cjs/ProjectAgent.d.ts +16 -0
- package/dist/cjs/ProjectAgent.d.ts.map +1 -1
- package/dist/cjs/ProjectAgent.js +34 -0
- package/dist/cjs/ProjectAgent.js.map +1 -1
- package/dist/cjs/SelectionAgent.d.ts +76 -0
- package/dist/cjs/SelectionAgent.d.ts.map +1 -1
- package/dist/cjs/SelectionAgent.js +166 -0
- package/dist/cjs/SelectionAgent.js.map +1 -1
- package/dist/esm/AIAgent.d.ts +115 -0
- package/dist/esm/AIAgent.d.ts.map +1 -1
- package/dist/esm/AIAgent.js +243 -0
- package/dist/esm/AIAgent.js.map +1 -1
- package/dist/esm/Carriers.d.ts +586 -1
- package/dist/esm/Carriers.d.ts.map +1 -1
- package/dist/esm/ContactAgent.d.ts +33 -2
- package/dist/esm/ContactAgent.d.ts.map +1 -1
- package/dist/esm/ContactAgent.js +67 -0
- package/dist/esm/ContactAgent.js.map +1 -1
- package/dist/esm/Converters.d.ts +33 -0
- package/dist/esm/Converters.d.ts.map +1 -1
- package/dist/esm/Converters.js +419 -0
- package/dist/esm/Converters.js.map +1 -1
- package/dist/esm/DiagnosticsAgent.d.ts +7 -0
- package/dist/esm/DiagnosticsAgent.d.ts.map +1 -1
- package/dist/esm/DiagnosticsAgent.js +24 -0
- package/dist/esm/DiagnosticsAgent.js.map +1 -1
- package/dist/esm/Enums.d.ts +156 -8
- package/dist/esm/Enums.d.ts.map +1 -1
- package/dist/esm/Enums.js +156 -4
- package/dist/esm/Enums.js.map +1 -1
- package/dist/esm/ListAgent.d.ts +24 -0
- package/dist/esm/ListAgent.d.ts.map +1 -1
- package/dist/esm/ListAgent.js +66 -0
- package/dist/esm/ListAgent.js.map +1 -1
- package/dist/esm/PersonAgent.d.ts +15 -0
- package/dist/esm/PersonAgent.d.ts.map +1 -1
- package/dist/esm/PersonAgent.js +33 -0
- package/dist/esm/PersonAgent.js.map +1 -1
- package/dist/esm/PersonRestApi.d.ts.map +1 -1
- package/dist/esm/PersonRestApi.js.map +1 -1
- package/dist/esm/ProjectAgent.d.ts +16 -0
- package/dist/esm/ProjectAgent.d.ts.map +1 -1
- package/dist/esm/ProjectAgent.js +34 -0
- package/dist/esm/ProjectAgent.js.map +1 -1
- package/dist/esm/SelectionAgent.d.ts +76 -0
- package/dist/esm/SelectionAgent.d.ts.map +1 -1
- package/dist/esm/SelectionAgent.js +166 -0
- package/dist/esm/SelectionAgent.js.map +1 -1
- package/package.json +3 -3
- package/src/AIAgent.ts +413 -0
- package/src/Carriers.ts +816 -1
- package/src/ContactAgent.ts +116 -2
- package/src/Converters.ts +505 -0
- package/src/DiagnosticsAgent.ts +30 -0
- package/src/Enums.ts +160 -4
- package/src/ListAgent.ts +71 -0
- package/src/PersonAgent.ts +56 -0
- package/src/PersonRestApi.ts +2 -0
- package/src/ProjectAgent.ts +58 -0
- package/src/SelectionAgent.ts +282 -0
package/src/AIAgent.ts
CHANGED
|
@@ -35,6 +35,10 @@ export interface IAIAgent {
|
|
|
35
35
|
rephraseTextAsync(text: string, style: enums.AiTextStyle, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
36
36
|
createTextForAppointmentAsync(request: carriers.AI_CreateTextForAppointmentRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
37
37
|
createTextForAppointmentAsync(appointment: carriers.AppointmentEntity, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
38
|
+
analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
39
|
+
analyzeBizCardImageAsync(image: ArrayBuffer|string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
40
|
+
analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
41
|
+
analyzeBizCardTextAsync(text: string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
38
42
|
getTrainingStatusAsync(webapi_options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse >;
|
|
39
43
|
guessCategoryAsync(request: carriers.AI_GuessCategoryRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
40
44
|
guessCategoryAsync(ticketId: number, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
@@ -56,6 +60,16 @@ export interface IAIAgent {
|
|
|
56
60
|
translateAsync(text: string, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
57
61
|
translateEntityAsync(request: carriers.AI_TranslateEntityRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
58
62
|
translateEntityAsync(entityName: string, entityId: number, targetLanguage: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
63
|
+
answerAsync(request: carriers.AI_AnswerRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
|
|
64
|
+
answerAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
|
|
65
|
+
answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
66
|
+
answerFeedbackAsync(trackingId: string, isThumbsUp: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
67
|
+
answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
68
|
+
answerAcceptedAsync(trackingId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
69
|
+
searchAsync(request: carriers.AI_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
|
|
70
|
+
searchAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
|
|
71
|
+
startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
72
|
+
startRagIndexingAsync(namespaceName: string, sourceId: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
59
73
|
summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
60
74
|
summarizeTicketAsync(ticketId: number, numSentences: number, isoLangCode: string, webapi_options?:base.WebApiRequestOptions) : Promise< string >;
|
|
61
75
|
getSummarizeTicketPromptAsync(request: carriers.AI_GetSummarizeTicketPromptRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.ChatbotTurn >;
|
|
@@ -327,6 +341,119 @@ export class AIAgent extends base.WebApiBase implements IAIAgent {
|
|
|
327
341
|
}
|
|
328
342
|
|
|
329
343
|
|
|
344
|
+
private async _analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
|
|
345
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
346
|
+
base.WebApiBase.SetPending(options);
|
|
347
|
+
return new Promise< carriers.BizCard >(async (resolve, reject) => {
|
|
348
|
+
try {
|
|
349
|
+
config.baseURL = this._options.baseUrl;
|
|
350
|
+
const response = await this._axios.post("AnalyzeBizCardImage", request , config);
|
|
351
|
+
base.WebApiBase.SetCompleted(options);
|
|
352
|
+
const res : carriers.BizCard = converters.Create_BizCard_From( response.data );
|
|
353
|
+
resolve(res);
|
|
354
|
+
}
|
|
355
|
+
catch( err ) {
|
|
356
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
357
|
+
reject(err);
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Returns contact and person information from an image. Merges results with matching database records if merge = true
|
|
366
|
+
* @param request - Image, MergeWithDatabase
|
|
367
|
+
* @returns Returns a Contact and a Person entity.
|
|
368
|
+
*/
|
|
369
|
+
public async analyzeBizCardImageAsync(request: carriers.AI_AnalyzeBizCardImageRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Returns contact and person information from an image. Merges results with matching database records if merge = true
|
|
373
|
+
* @param image - Image data containg a business card
|
|
374
|
+
* @param mergeWithDatabase - Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.
|
|
375
|
+
* @returns Returns a Contact and a Person entity.
|
|
376
|
+
*/
|
|
377
|
+
public async analyzeBizCardImageAsync(image: ArrayBuffer|string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
378
|
+
|
|
379
|
+
public async analyzeBizCardImageAsync(image:ArrayBuffer|string|carriers.AI_AnalyzeBizCardImageRequest, mergeWithDatabase?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
|
|
380
|
+
let _request : carriers.AI_AnalyzeBizCardImageRequest = null;
|
|
381
|
+
let _options : base.WebApiRequestOptions = null;
|
|
382
|
+
const first : any = image;
|
|
383
|
+
if( typeof( first ) === "object" && first && ( typeof(first.image)!='undefined' || typeof(first.mergeWithDatabase)!='undefined' ) )
|
|
384
|
+
{
|
|
385
|
+
_request = image as carriers.AI_AnalyzeBizCardImageRequest;
|
|
386
|
+
_options = mergeWithDatabase as base.WebApiRequestOptions;
|
|
387
|
+
}
|
|
388
|
+
else
|
|
389
|
+
{
|
|
390
|
+
_request = {
|
|
391
|
+
image: image as ArrayBuffer|string,
|
|
392
|
+
mergeWithDatabase: mergeWithDatabase as boolean,
|
|
393
|
+
};
|
|
394
|
+
_options = webapi_options;
|
|
395
|
+
}
|
|
396
|
+
_request.image = ToBase64(_request.image);
|
|
397
|
+
return this._analyzeBizCardImageAsync( _request, _options );
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
private async _analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
|
|
402
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
403
|
+
base.WebApiBase.SetPending(options);
|
|
404
|
+
return new Promise< carriers.BizCard >(async (resolve, reject) => {
|
|
405
|
+
try {
|
|
406
|
+
config.baseURL = this._options.baseUrl;
|
|
407
|
+
const response = await this._axios.post("AnalyzeBizCardText", request , config);
|
|
408
|
+
base.WebApiBase.SetCompleted(options);
|
|
409
|
+
const res : carriers.BizCard = converters.Create_BizCard_From( response.data );
|
|
410
|
+
resolve(res);
|
|
411
|
+
}
|
|
412
|
+
catch( err ) {
|
|
413
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
414
|
+
reject(err);
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Extract contact and person information from text. Merge results with matching database records if merge = true
|
|
423
|
+
* @param request - Text, MergeWithDatabase
|
|
424
|
+
* @returns Returns a Contact and a Person entity.
|
|
425
|
+
*/
|
|
426
|
+
public async analyzeBizCardTextAsync(request: carriers.AI_AnalyzeBizCardTextRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Extract contact and person information from text. Merge results with matching database records if merge = true
|
|
430
|
+
* @param text - Text that contains useful contact and person information.
|
|
431
|
+
* @param mergeWithDatabase - Merge results from analysis with matching database records? True: match company/person names and set ids on returned entities.
|
|
432
|
+
* @returns Returns a Contact and a Person entity.
|
|
433
|
+
*/
|
|
434
|
+
public async analyzeBizCardTextAsync(text: string, mergeWithDatabase: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard >;
|
|
435
|
+
|
|
436
|
+
public async analyzeBizCardTextAsync(text:string|carriers.AI_AnalyzeBizCardTextRequest, mergeWithDatabase?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.BizCard > {
|
|
437
|
+
let _request : carriers.AI_AnalyzeBizCardTextRequest = null;
|
|
438
|
+
let _options : base.WebApiRequestOptions = null;
|
|
439
|
+
const first : any = text;
|
|
440
|
+
if( typeof( first ) === "object" && first && ( typeof(first.text)!='undefined' || typeof(first.mergeWithDatabase)!='undefined' ) )
|
|
441
|
+
{
|
|
442
|
+
_request = text as carriers.AI_AnalyzeBizCardTextRequest;
|
|
443
|
+
_options = mergeWithDatabase as base.WebApiRequestOptions;
|
|
444
|
+
}
|
|
445
|
+
else
|
|
446
|
+
{
|
|
447
|
+
_request = {
|
|
448
|
+
text: text as string,
|
|
449
|
+
mergeWithDatabase: mergeWithDatabase as boolean,
|
|
450
|
+
};
|
|
451
|
+
_options = webapi_options;
|
|
452
|
+
}
|
|
453
|
+
return this._analyzeBizCardTextAsync( _request, _options );
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
|
|
330
457
|
private async _getTrainingStatusAsync( options?:base.WebApiRequestOptions) : Promise< carriers.CategorizationStatusResponse > {
|
|
331
458
|
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
332
459
|
base.WebApiBase.SetPending(options);
|
|
@@ -920,6 +1047,292 @@ export class AIAgent extends base.WebApiBase implements IAIAgent {
|
|
|
920
1047
|
}
|
|
921
1048
|
|
|
922
1049
|
|
|
1050
|
+
private async _answerAsync(request: carriers.AI_AnswerRequest, options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer > {
|
|
1051
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
1052
|
+
base.WebApiBase.SetPending(options);
|
|
1053
|
+
return new Promise< carriers.RagAnswer >(async (resolve, reject) => {
|
|
1054
|
+
try {
|
|
1055
|
+
config.baseURL = this._options.baseUrl;
|
|
1056
|
+
const response = await this._axios.post("Answer", request , config);
|
|
1057
|
+
base.WebApiBase.SetCompleted(options);
|
|
1058
|
+
const res : carriers.RagAnswer = converters.Create_RagAnswer_From( response.data );
|
|
1059
|
+
resolve(res);
|
|
1060
|
+
}
|
|
1061
|
+
catch( err ) {
|
|
1062
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
1063
|
+
reject(err);
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* Returns an answer.
|
|
1072
|
+
* @param request - NamespaceName, Query, Type, Top
|
|
1073
|
+
* @returns Generated answer based on query.
|
|
1074
|
+
*/
|
|
1075
|
+
public async answerAsync(request: carriers.AI_AnswerRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* Returns an answer.
|
|
1079
|
+
* @param namespaceName - Defines the search domain used for generating answer. e.g. 'ServiceCopilot'
|
|
1080
|
+
* @param query - Question. The search query to answer.
|
|
1081
|
+
* @param type - Filter results based on content type. Default: None = no filtering
|
|
1082
|
+
* @param top - Max Number of results to use in generating answer.
|
|
1083
|
+
* @returns Generated answer based on query.
|
|
1084
|
+
*/
|
|
1085
|
+
public async answerAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer >;
|
|
1086
|
+
|
|
1087
|
+
public async answerAsync(namespaceName:string|carriers.AI_AnswerRequest, query?:string|base.WebApiRequestOptions, type?:enums.RagType, top?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagAnswer > {
|
|
1088
|
+
let _request : carriers.AI_AnswerRequest = null;
|
|
1089
|
+
let _options : base.WebApiRequestOptions = null;
|
|
1090
|
+
const first : any = namespaceName;
|
|
1091
|
+
if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.query)!='undefined' || typeof(first.type)!='undefined' || typeof(first.top)!='undefined' ) )
|
|
1092
|
+
{
|
|
1093
|
+
_request = namespaceName as carriers.AI_AnswerRequest;
|
|
1094
|
+
_options = query as base.WebApiRequestOptions;
|
|
1095
|
+
}
|
|
1096
|
+
else
|
|
1097
|
+
{
|
|
1098
|
+
_request = {
|
|
1099
|
+
namespaceName: namespaceName as string,
|
|
1100
|
+
query: query as string,
|
|
1101
|
+
type: type as enums.RagType,
|
|
1102
|
+
top: top as number,
|
|
1103
|
+
};
|
|
1104
|
+
_options = webapi_options;
|
|
1105
|
+
}
|
|
1106
|
+
return this._answerAsync( _request, _options );
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
private async _answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, options?:base.WebApiRequestOptions) : Promise< void > {
|
|
1111
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
1112
|
+
base.WebApiBase.SetPending(options);
|
|
1113
|
+
return new Promise< void >(async (resolve, reject) => {
|
|
1114
|
+
try {
|
|
1115
|
+
config.baseURL = this._options.baseUrl;
|
|
1116
|
+
const response = await this._axios.post("AnswerFeedback", request , config);
|
|
1117
|
+
base.WebApiBase.SetCompleted(options);
|
|
1118
|
+
const res = response.data;
|
|
1119
|
+
resolve(res);
|
|
1120
|
+
}
|
|
1121
|
+
catch( err ) {
|
|
1122
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
1123
|
+
reject(err);
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Send feedback on answer - feedback is logged and used to improve the answer algorithm.
|
|
1132
|
+
* @param request - TrackingId, IsThumbsUp
|
|
1133
|
+
* @returns This method has no return value
|
|
1134
|
+
*/
|
|
1135
|
+
public async answerFeedbackAsync(request: carriers.AI_AnswerFeedbackRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Send feedback on answer - feedback is logged and used to improve the answer algorithm.
|
|
1139
|
+
* @param trackingId - The id of the answer that you are giving feedback to.
|
|
1140
|
+
* @param isThumbsUp - True = Like, False = Dislike.
|
|
1141
|
+
* @returns This method has no return value
|
|
1142
|
+
*/
|
|
1143
|
+
public async answerFeedbackAsync(trackingId: string, isThumbsUp: boolean, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
1144
|
+
|
|
1145
|
+
public async answerFeedbackAsync(trackingId:string|carriers.AI_AnswerFeedbackRequest, isThumbsUp?:boolean|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
|
|
1146
|
+
let _request : carriers.AI_AnswerFeedbackRequest = null;
|
|
1147
|
+
let _options : base.WebApiRequestOptions = null;
|
|
1148
|
+
const first : any = trackingId;
|
|
1149
|
+
if( typeof( first ) === "object" && first && ( typeof(first.trackingId)!='undefined' || typeof(first.isThumbsUp)!='undefined' ) )
|
|
1150
|
+
{
|
|
1151
|
+
_request = trackingId as carriers.AI_AnswerFeedbackRequest;
|
|
1152
|
+
_options = isThumbsUp as base.WebApiRequestOptions;
|
|
1153
|
+
}
|
|
1154
|
+
else
|
|
1155
|
+
{
|
|
1156
|
+
_request = {
|
|
1157
|
+
trackingId: trackingId as string,
|
|
1158
|
+
isThumbsUp: isThumbsUp as boolean,
|
|
1159
|
+
};
|
|
1160
|
+
_options = webapi_options;
|
|
1161
|
+
}
|
|
1162
|
+
return this._answerFeedbackAsync( _request, _options );
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
private async _answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, options?:base.WebApiRequestOptions) : Promise< void > {
|
|
1167
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
1168
|
+
base.WebApiBase.SetPending(options);
|
|
1169
|
+
return new Promise< void >(async (resolve, reject) => {
|
|
1170
|
+
try {
|
|
1171
|
+
config.baseURL = this._options.baseUrl;
|
|
1172
|
+
const response = await this._axios.post("AnswerAccepted", request , config);
|
|
1173
|
+
base.WebApiBase.SetCompleted(options);
|
|
1174
|
+
const res = response.data;
|
|
1175
|
+
resolve(res);
|
|
1176
|
+
}
|
|
1177
|
+
catch( err ) {
|
|
1178
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
1179
|
+
reject(err);
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.
|
|
1188
|
+
* @param request - TrackingId
|
|
1189
|
+
* @returns This method has no return value
|
|
1190
|
+
*/
|
|
1191
|
+
public async answerAcceptedAsync(request: carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Signal that answer was inserted into response- feedback is logged and used to improve the answer algorithm.
|
|
1195
|
+
* @param trackingId - The id of the answer that you are giving feedback to.
|
|
1196
|
+
* @returns This method has no return value
|
|
1197
|
+
*/
|
|
1198
|
+
public async answerAcceptedAsync(trackingId: string, webapi_options?:base.WebApiRequestOptions) : Promise< void >;
|
|
1199
|
+
|
|
1200
|
+
public async answerAcceptedAsync(trackingId:string|carriers.AI_AnswerAcceptedRequest, webapi_options?:base.WebApiRequestOptions) : Promise< void > {
|
|
1201
|
+
let _request : carriers.AI_AnswerAcceptedRequest = null;
|
|
1202
|
+
let _options : base.WebApiRequestOptions = null;
|
|
1203
|
+
const first : any = trackingId;
|
|
1204
|
+
if( typeof( first ) === "object" && first && ( typeof(first.trackingId)!='undefined' ) )
|
|
1205
|
+
{
|
|
1206
|
+
_request = trackingId as carriers.AI_AnswerAcceptedRequest;
|
|
1207
|
+
_options = webapi_options as base.WebApiRequestOptions;
|
|
1208
|
+
}
|
|
1209
|
+
else
|
|
1210
|
+
{
|
|
1211
|
+
_request = {
|
|
1212
|
+
trackingId: trackingId as string,
|
|
1213
|
+
};
|
|
1214
|
+
_options = webapi_options;
|
|
1215
|
+
}
|
|
1216
|
+
return this._answerAcceptedAsync( _request, _options );
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
private async _searchAsync(request: carriers.AI_SearchRequest, options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] > {
|
|
1221
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
1222
|
+
base.WebApiBase.SetPending(options);
|
|
1223
|
+
return new Promise< carriers.RagResult[] >(async (resolve, reject) => {
|
|
1224
|
+
try {
|
|
1225
|
+
config.baseURL = this._options.baseUrl;
|
|
1226
|
+
const response = await this._axios.post("Search", request , config);
|
|
1227
|
+
base.WebApiBase.SetCompleted(options);
|
|
1228
|
+
const res : carriers.RagResult[] = converters.Create_RagResultArray_From( response.data );
|
|
1229
|
+
resolve(res);
|
|
1230
|
+
}
|
|
1231
|
+
catch( err ) {
|
|
1232
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
1233
|
+
reject(err);
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Returns semantic search results from vector database.
|
|
1242
|
+
* @param request - NamespaceName, Query, Type, Top
|
|
1243
|
+
* @returns Array containing vector search results
|
|
1244
|
+
*/
|
|
1245
|
+
public async searchAsync(request: carriers.AI_SearchRequest, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Returns semantic search results from vector database.
|
|
1249
|
+
* @param namespaceName - Defines the search domain. e.g. 'ServiceCopilot'.
|
|
1250
|
+
* @param query - Search query.
|
|
1251
|
+
* @param type - Filter results based on a specific content type. Default: None = no filtering
|
|
1252
|
+
* @param top - Max Number of results to return.
|
|
1253
|
+
* @returns Array containing vector search results
|
|
1254
|
+
*/
|
|
1255
|
+
public async searchAsync(namespaceName: string, query: string, type: enums.RagType, top: number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] >;
|
|
1256
|
+
|
|
1257
|
+
public async searchAsync(namespaceName:string|carriers.AI_SearchRequest, query?:string|base.WebApiRequestOptions, type?:enums.RagType, top?:number, webapi_options?:base.WebApiRequestOptions) : Promise< carriers.RagResult[] > {
|
|
1258
|
+
let _request : carriers.AI_SearchRequest = null;
|
|
1259
|
+
let _options : base.WebApiRequestOptions = null;
|
|
1260
|
+
const first : any = namespaceName;
|
|
1261
|
+
if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.query)!='undefined' || typeof(first.type)!='undefined' || typeof(first.top)!='undefined' ) )
|
|
1262
|
+
{
|
|
1263
|
+
_request = namespaceName as carriers.AI_SearchRequest;
|
|
1264
|
+
_options = query as base.WebApiRequestOptions;
|
|
1265
|
+
}
|
|
1266
|
+
else
|
|
1267
|
+
{
|
|
1268
|
+
_request = {
|
|
1269
|
+
namespaceName: namespaceName as string,
|
|
1270
|
+
query: query as string,
|
|
1271
|
+
type: type as enums.RagType,
|
|
1272
|
+
top: top as number,
|
|
1273
|
+
};
|
|
1274
|
+
_options = webapi_options;
|
|
1275
|
+
}
|
|
1276
|
+
return this._searchAsync( _request, _options );
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
private async _startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, options?:base.WebApiRequestOptions) : Promise< number > {
|
|
1281
|
+
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
1282
|
+
base.WebApiBase.SetPending(options);
|
|
1283
|
+
return new Promise< number >(async (resolve, reject) => {
|
|
1284
|
+
try {
|
|
1285
|
+
config.baseURL = this._options.baseUrl;
|
|
1286
|
+
const response = await this._axios.post("StartRagIndexing", request , config);
|
|
1287
|
+
base.WebApiBase.SetCompleted(options);
|
|
1288
|
+
const res : number = response.data as number;
|
|
1289
|
+
resolve(res);
|
|
1290
|
+
}
|
|
1291
|
+
catch( err ) {
|
|
1292
|
+
base.WebApiBase.HandleError(options, config, err);
|
|
1293
|
+
reject(err);
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
/**
|
|
1301
|
+
* Kicks off a batch task to update the RAG index
|
|
1302
|
+
* @param request - NamespaceName, SourceId
|
|
1303
|
+
* @returns The batch task id
|
|
1304
|
+
*/
|
|
1305
|
+
public async startRagIndexingAsync(request: carriers.AI_StartRagIndexingRequest, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* Kicks off a batch task to update the RAG index
|
|
1309
|
+
* @param namespaceName - Defines the search domain. e.g. 'ServiceCopilot'.
|
|
1310
|
+
* @param sourceId - (Optional) Identifies the data source to update. Blank = all sources
|
|
1311
|
+
* @returns The batch task id
|
|
1312
|
+
*/
|
|
1313
|
+
public async startRagIndexingAsync(namespaceName: string, sourceId: string, webapi_options?:base.WebApiRequestOptions) : Promise< number >;
|
|
1314
|
+
|
|
1315
|
+
public async startRagIndexingAsync(namespaceName:string|carriers.AI_StartRagIndexingRequest, sourceId?:string|base.WebApiRequestOptions, webapi_options?:base.WebApiRequestOptions) : Promise< number > {
|
|
1316
|
+
let _request : carriers.AI_StartRagIndexingRequest = null;
|
|
1317
|
+
let _options : base.WebApiRequestOptions = null;
|
|
1318
|
+
const first : any = namespaceName;
|
|
1319
|
+
if( typeof( first ) === "object" && first && ( typeof(first.namespaceName)!='undefined' || typeof(first.sourceId)!='undefined' ) )
|
|
1320
|
+
{
|
|
1321
|
+
_request = namespaceName as carriers.AI_StartRagIndexingRequest;
|
|
1322
|
+
_options = sourceId as base.WebApiRequestOptions;
|
|
1323
|
+
}
|
|
1324
|
+
else
|
|
1325
|
+
{
|
|
1326
|
+
_request = {
|
|
1327
|
+
namespaceName: namespaceName as string,
|
|
1328
|
+
sourceId: sourceId as string,
|
|
1329
|
+
};
|
|
1330
|
+
_options = webapi_options;
|
|
1331
|
+
}
|
|
1332
|
+
return this._startRagIndexingAsync( _request, _options );
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
|
|
923
1336
|
private async _summarizeTicketAsync(request: carriers.AI_SummarizeTicketRequest, options?:base.WebApiRequestOptions) : Promise< string > {
|
|
924
1337
|
const config : AxiosRequestConfig = base.WebApiBase.GetAxiosRequestConfig(options, this._options);
|
|
925
1338
|
base.WebApiBase.SetPending(options);
|