Explorar o código

decrease default context window size of ollama

alexchenzl hai 5 meses
pai
achega
6615eb9967
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      chrome-extension/src/background/agent/helper.ts

+ 5 - 1
chrome-extension/src/background/agent/helper.ts

@@ -117,7 +117,11 @@ export function createChatModel(providerConfig: ProviderConfig, modelConfig: Mod
         topP,
         topP,
         temperature,
         temperature,
         maxTokens,
         maxTokens,
-        numCtx: 128000,
+        // ollama usually has a very small context window, so we need to set a large number for agent to work
+        // It was set to 128000 in the original code, but it will cause ollama reload the models frequently if you have multiple models working together
+        // not sure why, but setting it to 64000 seems to work fine
+        // TODO: configure the context window size in model config
+        numCtx: 64000,
       };
       };
       return new ChatOllama(args);
       return new ChatOllama(args);
     }
     }