Enhance Ollama class constructor to accept num_ctx parameter and include it in API request if greater than zero. see #351
This commit is contained in:
parent
71f5aaf6b2
commit
fc7854bb69
1 changed files with 4 additions and 1 deletions
|
|
@ -21,11 +21,13 @@ export class Ollama {
|
||||||
host = '';
|
host = '';
|
||||||
model = '';
|
model = '';
|
||||||
stream = false;
|
stream = false;
|
||||||
|
num_ctx = 0;
|
||||||
|
|
||||||
constructor(host, model, stream = false) {
|
constructor(host, model, stream = false, num_ctx = 0) {
|
||||||
this.host = host.trim().replace(/\/+$/, "");
|
this.host = host.trim().replace(/\/+$/, "");
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
|
this.num_ctx = num_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchModels = async () => {
|
fetchModels = async () => {
|
||||||
|
|
@ -78,6 +80,7 @@ export class Ollama {
|
||||||
model: this.model,
|
model: this.model,
|
||||||
messages: messages,
|
messages: messages,
|
||||||
stream: this.stream,
|
stream: this.stream,
|
||||||
|
...(this.num_ctx > 0 ? { num_ctx: parseInt(this.num_ctx) } : {})
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue