Skip to content

Commit 11d5a77

Browse files
longregenakawrykow
authored andcommitted
examples : skip unnecessary external lib in server README.md how-to (ggml-org#2804)
1 parent 7253a69 commit 11d5a77

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

examples/server/README.md

+10-13
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,31 @@ You need to have [Node.js](https://nodejs.org/en) installed.
7777
```bash
7878
mkdir llama-client
7979
cd llama-client
80-
npm init
81-
npm install axios
8280
```
8381

8482
Create a index.js file and put inside this:
8583

8684
```javascript
87-
const axios = require("axios");
88-
8985
const prompt = `Building a website can be done in 10 simple steps:`;
9086

9187
async function Test() {
92-
let result = await axios.post("http://127.0.0.1:8080/completion", {
93-
prompt,
94-
n_predict: 512,
95-
});
96-
97-
// the response is received until completion finish
98-
console.log(result.data.content);
88+
let response = await fetch("http://127.0.0.1:8080/completion", {
89+
method: 'POST',
90+
body: JSON.stringify({
91+
prompt,
92+
n_predict: 512,
93+
})
94+
})
95+
console.log((await response.json()).content)
9996
}
10097

101-
Test();
98+
Test()
10299
```
103100

104101
And run it:
105102

106103
```bash
107-
node .
104+
node index.js
108105
```
109106

110107
## API Endpoints

0 commit comments

Comments
 (0)