File tree 1 file changed +10
-13
lines changed
1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -77,34 +77,31 @@ You need to have [Node.js](https://nodejs.org/en) installed.
77
77
``` bash
78
78
mkdir llama-client
79
79
cd llama-client
80
- npm init
81
- npm install axios
82
80
```
83
81
84
82
Create a index.js file and put inside this:
85
83
86
84
``` javascript
87
- const axios = require (" axios" );
88
-
89
85
const prompt = ` Building a website can be done in 10 simple steps:` ;
90
86
91
87
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 )
99
96
}
100
97
101
- Test ();
98
+ Test ()
102
99
```
103
100
104
101
And run it:
105
102
106
103
``` bash
107
- node .
104
+ node index.js
108
105
```
109
106
110
107
## API Endpoints
You can’t perform that action at this time.
0 commit comments