UNPKG

6.28 kBTypeScriptView Raw
1/**
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License.
4 */
5import * as CLM from '@conversationlearner/models';
6import { IActionResult } from './CLRunner';
7export interface ICLClientOptions {
8 CONVERSATION_LEARNER_SERVICE_URI: string;
9 APIM_SUBSCRIPTION_KEY: string | undefined;
10 LUIS_AUTHORING_KEY: string | undefined;
11 LUIS_SUBSCRIPTION_KEY?: string;
12}
13export declare class CLClient {
14 private options;
15 constructor(options: ICLClientOptions);
16 ValidationError(): string | null;
17 LuisAuthoringKey(): string | undefined;
18 private BuildURL;
19 private MakeURL;
20 private MakeSessionURL;
21 private send;
22 /**
23 * Retrieve information about a specific application
24 * If the app ID isn't found in the set of (non-archived) apps,
25 * returns 404 error ("not found")
26 */
27 GetApp(appId: string): Promise<CLM.AppBase>;
28 GetAppSource(appId: string, packageId: string): Promise<CLM.AppDefinition>;
29 PostAppSource(appId: string, appDefinition: CLM.AppDefinition): Promise<void>;
30 /** Retrieve a list of (active) applications */
31 GetApps(query: string): Promise<CLM.AppList>;
32 /** Create a new application */
33 CopyApps(srcUserId: string, destUserId: string, appId: string, luisSubscriptionKey: string): Promise<string>;
34 /**
35 * Archive an existing application
36 * Note: "deleting" an application doesn't destroy it, but rather archives
37 * it for a period (eg 30 days). During the archive period, the application
38 * can be restored with the next API call. At the end of the archive period,
39 * the application is destroyed.
40 */
41 ArchiveApp(appId: string): Promise<string>;
42 /**
43 * Create a new application
44 */
45 AddApp(app: CLM.AppBase, query: string): Promise<string>;
46 /** Creates a new package tag */
47 PublishApp(appId: string, tagName: string): Promise<CLM.PackageReference>;
48 /** Sets a package tags as the live version */
49 PublishProdPackage(appId: string, packageId: string): Promise<string>;
50 /**
51 * Retrieves definitions of ALL entities in the latest package
52 * (or the specified package, if provided). To retrieve just the IDs
53 * of all entities, see the GetEntityIds method
54 */
55 GetEntities(appId: string, query?: string): Promise<CLM.EntityList>;
56 /**
57 * Retrieves the contents of many/all logDialogs.
58 * To retrieve just a list of IDs of all logDialogs,
59 * see the GET GetLogDialogIds method.
60 */
61 GetLogDialogs(appId: string, packageIds: string[]): Promise<CLM.LogDialogList>;
62 /** Runs entity extraction (prediction). */
63 LogDialogExtract(appId: string, logDialogId: string, turnIndex: string, userInput: CLM.UserInput): Promise<CLM.ExtractResponse>;
64 /**
65 * Retrieves information about a specific trainDialog in the current package
66 * (or the specified package, if provided)
67 */
68 GetTrainDialog(appId: string, trainDialogId: string, includeDefinitions?: boolean): Promise<CLM.TrainDialog>;
69 /** Runs entity extraction (prediction). */
70 TrainDialogExtract(appId: string, trainDialogId: string, turnIndex: string, userInput: CLM.UserInput): Promise<CLM.ExtractResponse>;
71 /**
72 * Returns a 409 if text variation conflicts with existing labels, otherwise 200
73 * filteredDialog is dialog to ignore when checking for conflicts
74 */
75 TrainDialogValidateTextVariation(appId: string, trainDialogId: string, textVariation: CLM.TextVariation, filteredDialog: string): Promise<null>;
76 /** Creates a new session and a corresponding logDialog */
77 StartSession(appId: string, sessionCreateParams: CLM.SessionCreateParams): Promise<CLM.Session>;
78 /** Gets information about a session */
79 GetSession(appId: string, sessionId: string): Promise<CLM.Session>;
80 /** Runs entity extraction (prediction). */
81 SessionExtract(appId: string, sessionId: string, userInput: CLM.UserInput): Promise<CLM.ExtractResponse>;
82 /** Take a turn and returns chosen action */
83 SessionScore(appId: string, sessionId: string, scorerInput: CLM.ScoreInput): Promise<CLM.ScoreResponse>;
84 SessionLogicResult(appId: string, sessionId: string, actionId: string, actionResult: IActionResult): Promise<{}>;
85 /** End a session. */
86 EndSession(appId: string, sessionId: string): Promise<string>;
87 /** Creates a new teaching session and a corresponding trainDialog */
88 StartTeach(appId: string, createTeachParams: CLM.CreateTeachParams): Promise<CLM.TeachResponse>;
89 /**
90 * Runs entity extraction (prediction).
91 * If a more recent version of the package is available on
92 * the server, the session will first migrate to that newer version. This
93 * doesn't affect the trainDialog maintained.
94 */
95 TeachExtract(appId: string, teachId: string, userInput: CLM.UserInput, filteredDialog: string | null): Promise<CLM.ExtractResponse>;
96 /**
97 * Uploads a labeled entity extraction instance
98 * ie "commits" an entity extraction label, appending it to the teach session's
99 * trainDialog, and advancing the dialog. This may yield produce a new package.
100 */
101 TeachExtractFeedback(appId: string, teachId: string, extractorStep: CLM.TrainExtractorStep): Promise<CLM.TeachResponse>;
102 /**
103 * Takes a turn and return distribution over actions.
104 * If a more recent version of the package is
105 * available on the server, the session will first migrate to that newer version.
106 * This doesn't affect the trainDialog maintained by the teaching session.
107 */
108 TeachScore(appId: string, teachId: string, scorerInput: CLM.ScoreInput): Promise<CLM.ScoreResponse>;
109 /**
110 * Uploads a labeled scorer step instance
111 * – ie "commits" a scorer label, appending it to the teach session's
112 * trainDialog, and advancing the dialog. This may yield produce a new package.
113 */
114 TeachScoreFeedback(appId: string, teachId: string, scorerResponse: CLM.TrainScorerStep): Promise<CLM.TeachResponse>;
115 /**
116 * Ends a teach.
117 * For Teach sessions, does NOT delete the associated trainDialog.
118 * To delete the associated trainDialog, call DELETE on the trainDialog.
119 */
120 EndTeach(appId: string, teachId: string, save: boolean): Promise<CLM.TrainResponse>;
121}