diff --git a/README.md b/README.md index 76b688a..e037295 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,14 @@ ollama.embeddings(request) - `options` ``: (Optional) Options to configure the runtime. - Returns: `` +### ps + +```javascript +ollama.ps() +``` + +- Returns: `` + ## Custom client A custom client can be created with the following fields: diff --git a/src/browser.ts b/src/browser.ts index 81ce484..759d5ce 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -278,6 +278,16 @@ export class Ollama { }) return (await response.json()) as EmbeddingsResponse } + + /** + * Lists the running models on the server + * @returns {Promise} - The response object. + * @throws {Error} - If the response body is missing. + */ + async ps(): Promise { + const response = await utils.get(this.fetch, `${this.config.host}/api/ps`) + return (await response.json()) as ListResponse + } } export default new Ollama() diff --git a/src/interfaces.ts b/src/interfaces.ts index 786bcc5..71f5eea 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -166,6 +166,8 @@ export interface ModelResponse { size: number digest: string details: ModelDetails + expires_at: Date + size_vram: number } export interface ModelDetails {