@microsoft/teams-ai
Version:
SDK focused on building AI based applications for Microsoft Teams.
93 lines • 3.87 kB
TypeScript
/**
* @module teams-ai
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Represents a memory.
* @remarks
* A memory is a key-value store that can be used to store and retrieve values.
*/
export interface Memory {
/**
* Deletes a value from the memory.
* @param path Path to the value to delete in the form of `[scope].property`. If scope is omitted, the value is deleted from the temporary scope.
* @throws Error if the path is invalid.
*/
deleteValue(path: string): void;
/**
* Checks if a value exists in the memory.
* @param path Path to the value to check in the form of `[scope].property`. If scope is omitted, the value is checked in the temporary scope.
* @returns True if the value exists, false otherwise.
*/
hasValue(path: string): boolean;
/**
* Retrieves a value from the memory.
* @template TValue Type of the value to retrieve.
* @param path Path to the value to retrieve in the form of `[scope].property`. If scope is omitted, the value is retrieved from the temporary scope.
* @returns The value or undefined if not found.
*/
getValue<TValue = unknown>(path: string): TValue;
/**
* Assigns a value to the memory.
* @param path Path to the value to assign in the form of `[scope].property`. If scope is omitted, the value is assigned to the temporary scope.
* @param value Value to assign.
*/
setValue(path: string, value: unknown): void;
}
/**
* Forks an existing memory.
* @remarks
* A memory fork is a memory that is a copy of another memory, but can be modified without
* affecting the original memory.
*/
export declare class MemoryFork implements Memory {
private readonly _fork;
private readonly _memory;
/**
* Creates a new `MemoryFork` instance.
* @param {Memory} memory Memory to fork.
*/
constructor(memory: Memory);
/**
* Deletes a value from the memory.
* @remarks
* Only forked values will be deleted.
* @param {string} path Path to the value to delete in the form of `[scope].property`. If scope is omitted, the value is deleted from the temporary scope.
*/
deleteValue(path: string): void;
/**
* Checks if a value exists in the memory.
* @remarks
* The forked memory is checked first, then the original memory.
* @param {string} path Path to the value to check in the form of `[scope].property`. If scope is omitted, the value is checked in the temporary scope.
* @returns {boolean} True if the value exists, false otherwise.
*/
hasValue(path: string): boolean;
/**
* Retrieves a value from the memory.
* @template TValue Type of the value to retrieve.
* @remarks
* The forked memory is checked first, then the original memory.
* @param {string} path Path to the value to retrieve in the form of `[scope].property`. If scope is omitted, the value is retrieved from the temporary scope.
* @returns {TValue | undefined} The value or undefined if not found.
*/
getValue<TValue = unknown>(path: string): TValue;
/**
* Assigns a value to the memory.
* @remarks
* The value is assigned to the forked memory.
* @param {string} path Path to the value to assign in the form of `[scope].property`. If scope is omitted, the value is assigned to the temporary scope.
* @param {unknown} value Value to assign.
*/
setValue(path: string, value: unknown): void;
/**
* @private
* @param {string} path Path to the value to check in the form of `[scope].property`. If scope is omitted, the value is checked in the temporary scope.
* @returns {Record<string, string>} Scope and name.
*/
private getScopeAndName;
}
//# sourceMappingURL=MemoryFork.d.ts.map