feat: Add Ollama model settings for tfsZ, numKeep, numThread, and useMlock

This commit is contained in:
n4ze3m
2025-01-05 15:11:43 +05:30
parent 0af69a3be8
commit 9674b842ef
10 changed files with 232 additions and 18 deletions

View File

@@ -103,6 +103,8 @@ export class ChatOllama
useMMap?: boolean;
useMlock?: boolean;
vocabOnly?: boolean;
seed?: number;
@@ -148,6 +150,7 @@ export class ChatOllama
this.typicalP = fields.typicalP;
this.useMLock = fields.useMLock;
this.useMMap = fields.useMMap;
this.useMlock = fields.useMlock;
this.vocabOnly = fields.vocabOnly;
this.format = fields.format;
this.seed = fields.seed;
@@ -210,7 +213,7 @@ export class ChatOllama
top_p: this.topP,
min_p: this.minP,
typical_p: this.typicalP,
use_mlock: this.useMLock,
use_mlock: this.useMlock,
use_mmap: this.useMMap,
vocab_only: this.vocabOnly,
seed: this.seed,

View File

@@ -20,7 +20,11 @@ export const pageAssistModel = async ({
useMMap,
minP,
repeatLastN,
repeatPenalty
repeatPenalty,
tfsZ,
numKeep,
numThread,
useMlock,
}: {
model: string
baseUrl: string
@@ -36,6 +40,10 @@ export const pageAssistModel = async ({
minP?: number
repeatPenalty?: number
repeatLastN?: number
tfsZ?: number,
numKeep?: number,
numThread?: number,
useMlock?: boolean,
}) => {
if (model === "chrome::gemini-nano::page-assist") {
return new ChatChromeAI({
@@ -80,7 +88,7 @@ export const pageAssistModel = async ({
}
}) as any
}
console.log('useMlock', useMlock)
return new ChatOllama({
baseUrl,
keepAlive,
@@ -96,5 +104,9 @@ export const pageAssistModel = async ({
minP: minP,
repeatPenalty: repeatPenalty,
repeatLastN: repeatLastN,
tfsZ,
numKeep,
numThread,
useMlock
})
}

View File

@@ -40,6 +40,7 @@ export interface OllamaInput {
useMLock?: boolean
useMMap?: boolean
vocabOnly?: boolean
useMlock?: boolean
seed?: number
format?: StringWithAutocomplete<"json">
}