diff --git a/src/complete/completers/ollama/model_settings.tsx b/src/complete/completers/ollama/model_settings.tsx index 6c38d56..ee79365 100644 --- a/src/complete/completers/ollama/model_settings.tsx +++ b/src/complete/completers/ollama/model_settings.tsx @@ -7,6 +7,7 @@ export const settings_schema = z.object({ user_prompt: z.string(), temperature: z.number().optional(), prompt_length: z.number().optional(), + context_window_size: z.number().min(1).optional(), }); export type Settings = z.infer; @@ -84,6 +85,25 @@ export function SettingsUI({ } /> + + + saveSettings( + JSON.stringify({ + ...parsed_settings, + context_window_size: parseInt(e.target.value), + }) + ) + } + /> + ); } diff --git a/src/complete/completers/ollama/ollama.tsx b/src/complete/completers/ollama/ollama.tsx index a376b1f..ac92c1f 100644 --- a/src/complete/completers/ollama/ollama.tsx +++ b/src/complete/completers/ollama/ollama.tsx @@ -145,6 +145,9 @@ export default class OllamaModel implements Model { stream: true, options: { temp: model_settings.temperature, + ...(model_settings.context_window_size && { + num_ctx: model_settings.context_window_size, + }), }, }); request.write(body);