fix: assign to contextLength basellm getter

This commit is contained in:
Dallin Romney 2025-07-19 19:47:01 +02:00
parent 194b802ed3
commit 32911c0779
4 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ class HuggingFaceTGI extends BaseLLM {
}
const json = await response.json();
this.model = json.model_id;
this.contextLength = Number.parseInt(json.max_input_length);
this._contextLength = Number.parseInt(json.max_input_length);
})
.catch((e) => {
console.log(`Failed to list models for HuggingFace TGI: ${e.message}`);

View file

@ -184,7 +184,7 @@ class Ollama extends BaseLLM implements ModelInstaller {
let value = parts[2];
switch (key) {
case "num_ctx":
this.contextLength =
this._contextLength =
options.contextLength ?? Number.parseInt(value);
break;
case "stop":

View file

@ -72,7 +72,7 @@ class Vllm extends OpenAI {
const json = await response.json();
const data = json.data[0];
this.model = data.id;
this.contextLength = Number.parseInt(data.max_model_len);
this._contextLength = Number.parseInt(data.max_model_len);
})
.catch((e) => {
console.log(`Failed to list models for vLLM: ${e.message}`);

View file

@ -55,7 +55,7 @@ describe.skip("generateRepoMap", () => {
});
// Set testLLM properties
testLLM.contextLength = 2048;
testLLM._contextLength = 2048;
testLLM.countTokens = jest.fn().mockReturnValue(10);
// Act
@ -115,7 +115,7 @@ describe.skip("generateRepoMap", () => {
});
// Set testLLM properties
testLLM.contextLength = 2048;
testLLM._contextLength = 2048;
testLLM.countTokens = jest.fn().mockReturnValue(10);
// Act
@ -184,7 +184,7 @@ describe.skip("generateRepoMap", () => {
.mockImplementation(() => {});
// Set testLLM properties
testLLM.contextLength = 2048;
testLLM._contextLength = 2048;
testLLM.countTokens = jest.fn().mockReturnValue(10);
// Act