From e7daee247cd985cad29cfe7cc6c153308b7e0a96 Mon Sep 17 00:00:00 2001 From: stoyanov-kaloyan Date: Wed, 12 Nov 2025 01:47:04 +0200 Subject: [PATCH] browser: add method to retrieve server version --- src/browser.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/browser.ts b/src/browser.ts index 4599ab6..547849f 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -327,6 +327,17 @@ async encodeImage(image: Uint8Array | string): Promise { return (await response.json()) as ListResponse } + /** + * Returns the Ollama server version. + * @returns {Promise<{version: string}>} - The server version object. + */ + async version(): Promise<{ version: string }> { + const response = await utils.get(this.fetch, `${this.config.host}/api/version`, { + headers: this.config.headers, + }) + return (await response.json()) as { version: string } + } + /** * Performs web search using the Ollama web search API * @param request {WebSearchRequest} - The search request containing query and options