UNPKG

2.66 kBTypeScriptView Raw
1/**
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License.
4 */
5import * as BB from 'botbuilder';
6import { CLRunner, EntityDetectionCallback, OnSessionStartCallback, OnSessionEndCallback, ICallbackInput } from './CLRunner';
7import { ICLOptions } from './CLOptions';
8import { CLClient } from './CLClient';
9import { CLRecognizerResult } from './CLRecognizeResult';
10import * as express from 'express';
11export declare class ConversationLearner {
12 static options: ICLOptions | null;
13 static clClient: CLClient;
14 clRunner: CLRunner;
15 static Init(options: ICLOptions, storage?: BB.Storage | null): express.Router;
16 constructor(modelId: string | undefined, maxTimeout?: number);
17 recognize(turnContext: BB.TurnContext, force?: boolean): Promise<CLRecognizerResult | null>;
18 /**
19 * OPTIONAL: Sessions are started automatically, StartSession call is only needed if bot needs
20 * to start Conversation Learner Session with initial entity values.
21 * Results in clearing of existing Entity values, and a call to the OnSessionStartCallback
22 * @param turnContext BotBuilder Context
23 */
24 StartSession(turnContext: BB.TurnContext): Promise<void>;
25 /**
26 * Provide an callback that will be invoked whenever a Session is started
27 * @param target Callback of the form (context: BB.TurnContext, memoryManager: ClientMemoryManager) => Promise<void>
28 */
29 OnSessionStartCallback(target: OnSessionStartCallback): void;
30 /**
31 * Provide a callback that will be invoked whenever a Session ends. Sessions
32 * can end because of a timeout or the selection of an EndSession activity
33 * @param target Callback of the form (context: BB.TurnContext, memoryManager: ClientMemoryManager, sessionEndState: CLM.SessionEndState, data: string | undefined) => Promise<string[] | undefined>
34 */
35 OnSessionEndCallback(target: OnSessionEndCallback): void;
36 SendResult(result: CLRecognizerResult): Promise<void>;
37 /** Returns true is bot is running in the Training UI
38 * @param turnContext BotBuilder Context
39 */
40 InTrainingUI(turnContext: BB.TurnContext): Promise<boolean>;
41 /**
42 * Define an API callback that can be used by the Model
43 * @param callback Object with callback name, optional logic function, and optional render function.
44 */
45 AddCallback<T>(callback: ICallbackInput<T>): void;
46 /** Define an Callback that will be called after Entity Detection
47 * @param target Callback of the form (text: string, memoryManager: ClientMemoryManager) => Promise<void>
48 */
49 EntityDetectionCallback(target: EntityDetectionCallback): void;
50}