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 = '';
|
||||
model = '';
|
||||
stream = false;
|
||||
num_ctx = 0;
|
||||
|
||||
constructor(host, model, stream = false) {
|
||||
constructor(host, model, stream = false, num_ctx = 0) {
|
||||
this.host = host.trim().replace(/\/+$/, "");
|
||||
this.model = model;
|
||||
this.stream = stream;
|
||||
this.num_ctx = num_ctx;
|
||||
}
|
||||
|
||||
fetchModels = async () => {
|
||||
|
|
@ -78,6 +80,7 @@ export class Ollama {
|
|||
model: this.model,
|
||||
messages: messages,
|
||||
stream: this.stream,
|
||||
...(this.num_ctx > 0 ? { num_ctx: parseInt(this.num_ctx) } : {})
|
||||
}),
|
||||
});
|
||||
return response;
|
||||
|
|
|
|||
Loading…
Reference in a new issue