server: use proper Content-Type in curl examples
Without the header Content-Type: application/json, curl will POST with Content-Type: application/x-www-form-urlencoded Though our simple server doesn't care, the httplib.h used has a limit with CPPHTTPLIB_FORM_URL_ENCODED_PAYLOAD_MAX_LENGTH 8192 With Content-Type: application/json, we can send large json data.
This commit is contained in:
parent
a728a0d185
commit
a3b4d93285
2 changed files with 3 additions and 0 deletions
|
@ -66,6 +66,7 @@ Using [curl](https://curl.se/). On Windows `curl.exe` should be available in the
|
||||||
```sh
|
```sh
|
||||||
curl --request POST \
|
curl --request POST \
|
||||||
--url http://localhost:8080/completion \
|
--url http://localhost:8080/completion \
|
||||||
|
--header "Content-Type: application/json" \
|
||||||
--data '{"prompt": "Building a website can be done in 10 simple steps:","n_predict": 128}'
|
--data '{"prompt": "Building a website can be done in 10 simple steps:","n_predict": 128}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ tokenize() {
|
||||||
--silent \
|
--silent \
|
||||||
--request POST \
|
--request POST \
|
||||||
--url "${API_URL}/tokenize" \
|
--url "${API_URL}/tokenize" \
|
||||||
|
--header "Content-Type: application/json" \
|
||||||
--data-raw "$(jq -ns --arg content "$1" '{content:$content}')" \
|
--data-raw "$(jq -ns --arg content "$1" '{content:$content}')" \
|
||||||
| jq '.tokens[]'
|
| jq '.tokens[]'
|
||||||
}
|
}
|
||||||
|
@ -64,6 +65,7 @@ chat_completion() {
|
||||||
--no-buffer \
|
--no-buffer \
|
||||||
--request POST \
|
--request POST \
|
||||||
--url "${API_URL}/completion" \
|
--url "${API_URL}/completion" \
|
||||||
|
--header "Content-Type: application/json" \
|
||||||
--data-raw "${DATA}")
|
--data-raw "${DATA}")
|
||||||
|
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue