@microsoft/teams-ai
Version:
SDK focused on building AI based applications for Microsoft Teams.
52 lines • 2.42 kB
TypeScript
import { TurnContext } from 'botbuilder';
import { Memory } from '../MemoryFork';
import { ChatCompletionAction } from '../models';
import { Tokenizer } from '../tokenizers';
import { PromptResponse } from '../types';
import { PromptResponseValidator, Validation } from './PromptResponseValidator';
/**
* A validated action call.
*/
export interface ValidatedChatCompletionAction {
/**
* Name of the action to call.
*/
name: string;
/**
* Arguments to pass to the action.
*/
parameters: Record<string, any>;
}
/**
* Validates action calls returned by the model.
*/
export declare class ActionResponseValidator implements PromptResponseValidator<ValidatedChatCompletionAction> {
private readonly _actions;
private readonly _isRequired;
private readonly _noun;
private readonly _Noun;
/**
* Creates a new `ActionResponseValidator` instance.
* @param {ChatCompletionAction[]} actions List of supported actions.
* @param {boolean} isRequired Whether the response is required to call an action.
* @param {string} noun Optional. Name of the action to use in feedback messages. Defaults to `action`.
* @param {string} Noun Optional. Name of the action to use in feedback messages. Defaults to `Action`.
*/
constructor(actions: ChatCompletionAction[], isRequired: boolean, noun?: string, Noun?: string);
/**
* Gets a list of the actions configured for the validator.
* @returns {ChatCompletionAction[]} A list of the actions configured for the validator.
*/
get actions(): ChatCompletionAction[];
/**
* Validates a response to a prompt.
* @param {TurnContext} context Context for the current turn of conversation with the user.
* @param {Memory} memory An interface for accessing state values.
* @param {Tokenizer} tokenizer Tokenizer to use for encoding and decoding text.
* @param {PromptResponse} response Response to validate.
* @param {number} remaining_attempts Number of remaining attempts to validate the response.
* @returns {Promise<Validation<ValidatedChatCompletionAction>>} A `Validation` object.
*/
validateResponse(context: TurnContext, memory: Memory, tokenizer: Tokenizer, response: PromptResponse<string>, remaining_attempts: number): Promise<Validation<ValidatedChatCompletionAction>>;
}
//# sourceMappingURL=ActionResponseValidator.d.ts.map