Skip to content

Commit

Permalink
examples : skip unnecessary external lib in server README.md how-to (g…
Browse files Browse the repository at this point in the history
  • Loading branch information
longregen authored and akawrykow committed Aug 29, 2023
1 parent 7253a69 commit 11d5a77
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions examples/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,31 @@ You need to have [Node.js](https://nodejs.org/en) installed.
```bash
mkdir llama-client
cd llama-client
npm init
npm install axios
```

Create a index.js file and put inside this:

```javascript
const axios = require("axios");

const prompt = `Building a website can be done in 10 simple steps:`;

async function Test() {
let result = await axios.post("http://127.0.0.1:8080/completion", {
prompt,
n_predict: 512,
});

// the response is received until completion finish
console.log(result.data.content);
let response = await fetch("http://127.0.0.1:8080/completion", {
method: 'POST',
body: JSON.stringify({
prompt,
n_predict: 512,
})
})
console.log((await response.json()).content)
}

Test();
Test()
```

And run it:

```bash
node .
node index.js
```

## API Endpoints
Expand Down

0 comments on commit 11d5a77

Please sign in to comment.