File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,11 @@ export const parseOllamaModel = (rawModel: OllamaModelInfoResponse): ModelInfo =
4848 const contextLengthFromModelInfo =
4949 contextKey && typeof rawModel . model_info [ contextKey ] === "number" ? rawModel . model_info [ contextKey ] : undefined
5050
51- const contextWindow = contextLengthFromModelParameters ?? contextLengthFromModelInfo
51+ let contextWindow = contextLengthFromModelParameters ?? contextLengthFromModelInfo
52+
53+ if ( contextWindow == 40960 && ! contextLengthFromModelParameters ) {
54+ contextWindow = 4096 // For some unknown reason, Ollama returns an undefind context as "40960" rather than 4096, which is what it actually enforces.
55+ }
5256 // kilocode_change end
5357
5458 const modelInfo : ModelInfo = Object . assign ( { } , ollamaDefaultModelInfo , {
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ export class NativeOllamaHandler extends BaseProvider implements SingleCompletio
155155 if ( this . isInitialized ) {
156156 return
157157 }
158- await this . fetchModels ( )
158+ await this . fetchModel ( )
159159 this . isInitialized = true
160160 }
161161
@@ -287,7 +287,7 @@ export class NativeOllamaHandler extends BaseProvider implements SingleCompletio
287287 }
288288 }
289289
290- async fetchModels ( ) {
290+ async fetchModel ( ) {
291291 this . models = await getOllamaModels ( this . options . ollamaBaseUrl )
292292 return this . models
293293 }
You can’t perform that action at this time.
0 commit comments