UNPKG

react-native-executorch

Version:

An easy way to run AI models in React Native with ExecuTorch

25 lines (24 loc) 896 B
"use strict"; /** * A context strategy that performs no filtering or trimming of the message history. * This strategy is ideal when the developer wants to manually manage the conversation * context. * @category Utils */ export class NoopContextStrategy { /** * Builds the context by prepending the system prompt to the entire unfiltered history. * @param systemPrompt - The top-level instructions for the model. * @param history - The complete conversation history. * @param _maxContextLength - Unused in this strategy. * @param _getTokenCount - Unused in this strategy. * @returns The unedited message history with the system prompt at the beginning. */ buildContext(systemPrompt, history, _maxContextLength, _getTokenCount) { return [{ content: systemPrompt, role: 'system' }, ...history]; } } //# sourceMappingURL=NoopContextStrategy.js.map