Skip to content

Commit

Permalink
fix(ollama): Remove default keepalive for Ollama models (#7337)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 authored Dec 10, 2024
1 parent 16ffbea commit 5430dd0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions libs/langchain-ollama/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export class ChatOllama

format?: string;

keepAlive?: string | number = "5m";
keepAlive?: string | number;

client: Ollama;

Expand Down Expand Up @@ -504,7 +504,7 @@ export class ChatOllama
this.penalizeNewline = fields?.penalizeNewline;
this.streaming = fields?.streaming;
this.format = fields?.format;
this.keepAlive = fields?.keepAlive ?? this.keepAlive;
this.keepAlive = fields?.keepAlive;
this.checkOrPullModel = fields?.checkOrPullModel ?? this.checkOrPullModel;
}

Expand Down
4 changes: 2 additions & 2 deletions libs/langchain-ollama/src/embeddings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class OllamaEmbeddings extends Embeddings {

baseUrl = "http://localhost:11434";

keepAlive: string | number = "5m";
keepAlive?: string | number;

requestOptions?: Partial<OllamaOptions>;

Expand All @@ -68,7 +68,7 @@ export class OllamaEmbeddings extends Embeddings {
this.baseUrl = fields?.baseUrl ?? this.baseUrl;

this.model = fields?.model ?? this.model;
this.keepAlive = fields?.keepAlive ?? this.keepAlive;
this.keepAlive = fields?.keepAlive;
this.truncate = fields?.truncate ?? this.truncate;
this.requestOptions = fields?.requestOptions
? this._convertOptions(fields?.requestOptions)
Expand Down
4 changes: 2 additions & 2 deletions libs/langchain-ollama/src/llms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Ollama extends LLM<OllamaCallOptions> implements OllamaInput {

baseUrl = "http://localhost:11434";

keepAlive: string | number = "5m";
keepAlive?: string | number;

embeddingOnly?: boolean;

Expand Down Expand Up @@ -138,7 +138,7 @@ export class Ollama extends LLM<OllamaCallOptions> implements OllamaInput {
host: this.baseUrl,
headers: fields?.headers,
});
this.keepAlive = fields?.keepAlive ?? this.keepAlive;
this.keepAlive = fields?.keepAlive;

this.embeddingOnly = fields?.embeddingOnly;
this.f16KV = fields?.f16Kv;
Expand Down

0 comments on commit 5430dd0

Please sign in to comment.