From e430da8c6a09b254b7277fd7ff145db1c543273b Mon Sep 17 00:00:00 2001 From: NolanTrem <34580718+NolanTrem@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:56:12 -0700 Subject: [PATCH] Add server stats command --- __tests__/r2rClientIntegrationSuperUser.test.ts | 4 ++++ package-lock.json | 2 +- package.json | 2 +- src/r2rClient.ts | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/__tests__/r2rClientIntegrationSuperUser.test.ts b/__tests__/r2rClientIntegrationSuperUser.test.ts index 8cca3e8..91a226a 100644 --- a/__tests__/r2rClientIntegrationSuperUser.test.ts +++ b/__tests__/r2rClientIntegrationSuperUser.test.ts @@ -21,6 +21,10 @@ describe("r2rClient Integration Tests", () => { ).resolves.not.toThrow(); }); + test("Server stats", async () => { + await expect(client.serverStats()).resolves.not.toThrow(); + }); + test("Ingest file", async () => { const files = [ { path: "examples/data/raskolnikov.txt", name: "raskolnikov.txt" }, diff --git a/package-lock.json b/package-lock.json index 8b61ed7..da833f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "r2r-js", - "version": "1.2.13", + "version": "1.2.14", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 8f85abe..5fd23a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "r2r-js", - "version": "1.2.13", + "version": "1.2.14", "description": "", "main": "dist/index.js", "browser": "dist/index.browser.js", diff --git a/src/r2rClient.ts b/src/r2rClient.ts index a24684c..0928460 100644 --- a/src/r2rClient.ts +++ b/src/r2rClient.ts @@ -240,6 +240,11 @@ export class r2rClient { return await this._makeRequest("GET", "health"); } + async serverStats(): Promise { + this._ensureAuthenticated(); + return await this._makeRequest("GET", "server_stats"); + } + @feature("updatePrompt") async updatePrompt( name: string = "default_system",