UNPKG

@microsoft/teams-ai

Version:

SDK focused on building AI based applications for Microsoft Teams.

57 lines 1.94 kB
"use strict"; /** * @module teams-ai */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.TestModel = void 0; /** * A test model that can be used to test the prompt completion system. */ class TestModel { /** * * @param {PromptResponseStatus} status Optional. Status of the prompt response. Defaults to `success`. * @param {Message} response Optional. Response to the prompt. Defaults to `{ role: 'assistant', content: 'Hello World' }`. * @param {Error} error Optional. Error to return. Defaults to `undefined`. */ constructor(status = 'success', response = { role: 'assistant', content: 'Hello World' }, error) { this.status = status; this.response = response; this.error = error; } /** * Status of the prompt response. */ status; /** * Response to the prompt. */ response; /** * Error to return. */ error; /** * Completes a prompt. * @param {TurnContext} context Current turn context. * @param {Memory} memory An interface for accessing state values. * @param {PromptFunctions} functions Functions to use when rendering the prompt. * @param {Tokenizer} tokenizer Tokenizer to use when rendering the prompt. * @param {PromptTemplate} template Prompt template to complete. * @returns {Promise<PromptResponse<string>>} A `PromptResponse` with the status and message. */ async completePrompt(context, memory, functions, tokenizer, template) { if (this.error) { return { status: this.status, input: undefined, error: this.error }; } else { return { status: this.status, input: undefined, message: this.response }; } } } exports.TestModel = TestModel; //# sourceMappingURL=TestModel.js.map