Skip to content

Commit

Permalink
server : update readme to document the new /health endpoint (#4866)
Browse files Browse the repository at this point in the history
* added /health endpoint to the server

* added comments on the additional /health endpoint

* Better handling of server state

When the model is being loaded, the server state is `LOADING_MODEL`. If model-loading fails, the server state becomes `ERROR`, otherwise it becomes `READY`. The `/health` endpoint provides more granular messages now according to the server_state value.

* initialized server_state

* fixed a typo

* starting http server before initializing the model

* Update server.cpp

* Update server.cpp

* fixes

* fixes

* fixes

* made ServerState atomic and turned two-line spaces into one-line

* updated `server` readme to document the `/health` endpoint too
  • Loading branch information
ibehnam authored Jan 11, 2024
1 parent 5c1980d commit 7a9f75c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ node index.js
```

## API Endpoints
- **GET** `/health`: Returns the current state of the server:
- `{"status": "loading model"}` if the model is still being loaded.
- `{"status": "error"}` if the model failed to load.
- `{"status": "ok"}` if the model is successfully loaded and the server is ready for further requests mentioned below.

- **POST** `/completion`: Given a `prompt`, it returns the predicted completion.

Expand Down

0 comments on commit 7a9f75c

Please sign in to comment.