Skip to content

Commit 75baea0

Browse files
browser: add method to retrieve server version (#259)
1 parent 603df9f commit 75baea0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/browser.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,17 @@ async encodeImage(image: Uint8Array | string): Promise<string> {
327327
return (await response.json()) as ListResponse
328328
}
329329

330+
/**
331+
* Returns the Ollama server version.
332+
* @returns {Promise<{version: string}>} - The server version object.
333+
*/
334+
async version(): Promise<{ version: string }> {
335+
const response = await utils.get(this.fetch, `${this.config.host}/api/version`, {
336+
headers: this.config.headers,
337+
})
338+
return (await response.json()) as { version: string }
339+
}
340+
330341
/**
331342
* Performs web search using the Ollama web search API
332343
* @param request {WebSearchRequest} - The search request containing query and options

0 commit comments

Comments
 (0)