zylon-ai / privategpt-ts

PrivateGPT Typescript SDK
Apache License 2.0
20 stars 5 forks source link

Bug Report: Health Check Failure with PrivateGPT API #1

Closed Andymendez100 closed 2 months ago

Andymendez100 commented 2 months ago

I am experiencing an error when using the node SDK to connect to my PrivateGPT FastAPI server. The health check endpoint is failing with the error: _PrivategptApiError: fetch failed.

Error Details:

_PrivategptApiError: fetch failed
    at Health.health (\location\of\project\.next\server\chunks\ssr\node_modules_privategpt-sdk-node_index_05eba4.js:5443:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async setUpAI (\location\of\project\\.next\server\chunks\ssr\[root of the server]__bdde60._.js:1347:17) {
  statusCode: undefined,
  body: undefined
}
Connection String:

Copy code

const client = new PrivategptApiClient({
  environment: "http://localhost:8001",
});

Code to Check Health:

console.log(await client.health.health());

Steps to Reproduce:

  1. Set up the connection string as shown above.
  2. Attempt to check the health of the client using console.log(await client.health.health()).
  3. Observe the error message.

Expected Behavior: The command should successfully return the health status of the client without any errors.

Actual Behavior: The command fails with _PrivategptApiError: fetch failed, and the statusCode and body are undefined.

Environment:

PrivateGPT SDK Version: 0.1.2 Operating System: Windows 10 Node.js Version: 20.15.0 PrivateGPT Version: v0.5.0 PrivateGPT running with ollama

Andymendez100 commented 2 months ago

Nevermind, I was able to fix the issue. Apparently, using localhost causes an error. The following update fixed it for me:

const client = new PrivategptApiClient({
  environment: "http://127.0.0.1:8001",
});