diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index 39ed723bb..951135090 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -1,4 +1,3 @@ -import { BaseLLM } from "../index.js"; import { ChatMessage, CompletionOptions, @@ -6,6 +5,7 @@ import { ModelProvider, } from "../../index.js"; import { stripImages } from "../countTokens.js"; +import { BaseLLM } from "../index.js"; import { streamResponse } from "../stream.js"; class Ollama extends BaseLLM { @@ -23,7 +23,9 @@ class Ollama extends BaseLLM { } this.fetch(this.getEndpoint("api/show"), { method: "POST", - headers: {}, + headers: { + "Authorization": `Bearer ${this.apiKey}` + }, body: JSON.stringify({ name: this._getModel() }), }) .then(async (response) => { @@ -163,6 +165,7 @@ class Ollama extends BaseLLM { method: "POST", headers: { "Content-Type": "application/json", + "Authorization": `Bearer ${this.apiKey}` }, body: JSON.stringify(this._convertArgs(options, prompt)), }); @@ -201,6 +204,7 @@ class Ollama extends BaseLLM { method: "POST", headers: { "Content-Type": "application/json", + "Authorization": `Bearer ${this.apiKey}` }, body: JSON.stringify(this._convertArgs(options, messages)), });