✨ send Bearer token to Ollama if apiKey set
This commit is contained in:
parent
6e9a56ba70
commit
034754c5f4
1 changed files with 6 additions and 2 deletions
|
|
@ -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)),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue