使用兼容vLLM 0.6.4版本接口
本章节以文本推理接口和流式推理接口为例介绍接口调用,其他接口的调用方法请参见兼容vLLM 0.6.4版本接口章节。
文本推理接口
接口名 |
文本推理接口 |
---|---|
URL |
https://{服务IP地址}:{端口号}/generate |
请求类型 |
POST |
请求示例 |
curl -H "Accept: application/json" -H "Content-type: application/json" --cacert ca.pem --cert client.pem --key client.key.pem -X POST -d '{ "prompt": "My name is Olivier and I", "max_tokens": 20, "repetition_penalty": 1.03, "presence_penalty": 1.2, "frequency_penalty": 1.2, "temperature": 0.5, "top_p": 0.95, "top_k": 10, "seed": null, "stream": false, "stop": null, "stop_token_ids": null, "model": "None", "include_stop_str_in_output": false, "skip_special_tokens": true, "ignore_eos": false, "best_of": 2, "n": 2 }' https://127.0.0.1:1025/generate |
返回示例 |
{"text":["My name is Olivier and I am a French photographer based in London. I have been photographing weddings and portraits for the last ","My name is Olivier and I am a French photographer based in Paris. I have been shooting weddings for the last 10 years and"]} |
流式推理接口
接口名 |
流式推理接口 |
---|---|
URL |
https://{服务IP地址}:{端口号}/generate |
请求类型 |
POST |
请求示例 |
curl -H "Accept: application/json" -H "Content-type: application/json" --cacert ca.pem --cert client.pem --key client.key.pem -X POST -d '{ "prompt": "My name is Olivier and I", "max_tokens": 20, "repetition_penalty": 1.03, "presence_penalty": 1.2, "frequency_penalty": 1.2, "temperature": 0.5, "top_p": 0.95, "top_k": 10, "seed": null, "stream": true, "stop": null, "stop_token_ids": null, "model": "None", "include_stop_str_in_output": false, "skip_special_tokens": true, "ignore_eos": false, "best_of": 2, "n": 2 }' https://127.0.0.1:1025/generate |
返回示例 |
{"text":["’m","’m"]}{"text":[" the"," "]}{"text":[" founder","22"]}{"text":[" of"," years"]}{"text":[" The"," old"]}{"text":[" Good","."]}{"text":[" Life"," I"]}{"text":[" Experience"," was"]}{"text":["."," born"]}{"text":[" I"," in"]}{"text":["’ve"," France"]}{"text":[" been"," but"]}{"text":[" a"," my"]}{"text":[" festival"," parents"]}{"text":[" producer"," are"]}{"text":[" for"," from"]}{"text":[" over"," the"]}{"text":[" "," Ivory"]}{"text":["15"," Coast"]}{"text":[" years",".\n"]} |
父主题: 服务化接口调用