From a3dbcf3c2a4b42f7a49c72eed7b6a4ff8ad002f4 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 24 Jun 2024 03:48:34 +0300 Subject: [PATCH] Fix context and response size not being passed to Ollama --- public/scripts/textgen-settings.js | 6 ++++-- src/constants.js | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/scripts/textgen-settings.js b/public/scripts/textgen-settings.js index 329cb5d0f..bb40d2871 100644 --- a/public/scripts/textgen-settings.js +++ b/public/scripts/textgen-settings.js @@ -861,7 +861,7 @@ async function generateTextGenWithStreaming(generate_data, signal) { return async function* streamData() { let text = ''; - /** @type {import('logprobs.js').TokenLogprobs | null} */ + /** @type {import('./logprobs.js').TokenLogprobs | null} */ let logprobs = null; const swipes = []; while (true) { @@ -893,7 +893,7 @@ async function generateTextGenWithStreaming(generate_data, signal) { * Probabilities feature. * @param {string} token - the text of the token that the logprobs are for * @param {Object} logprobs - logprobs object returned from the API - * @returns {import('logprobs.js').TokenLogprobs | null} - converted logprobs + * @returns {import('./logprobs.js').TokenLogprobs | null} - converted logprobs */ export function parseTextgenLogprobs(token, logprobs) { if (!logprobs) { @@ -1112,6 +1112,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate, 'tfs_z': settings.tfs, 'repeat_last_n': settings.rep_pen_range, 'n_predict': maxTokens, + 'num_predict': maxTokens, + 'num_ctx': max_context, 'mirostat': settings.mirostat_mode, 'ignore_eos': settings.ban_eos_token, 'n_probs': power_user.request_token_probabilities ? 10 : undefined, diff --git a/src/constants.js b/src/constants.js index b4945fa6f..157f198d1 100644 --- a/src/constants.js +++ b/src/constants.js @@ -259,6 +259,7 @@ const TOGETHERAI_KEYS = [ // https://github.com/jmorganca/ollama/blob/main/docs/api.md#request-with-options const OLLAMA_KEYS = [ 'num_predict', + 'num_ctx', 'stop', 'temperature', 'repeat_penalty',