this provides a lightweight and plug-and-play http server component for utilizing gpt models!
first you want to run the server. if you want to use docker see the docs for docker.
otherwise, you want to run the aitg.srv
module.
for example:
KEY=secret MODEL=/tmp/PT_GPTNEO125_ATG python -m aitg.srv gpt --host 127.0.0.1 --port 6000
a very simple api that provides various methods.
- either GET or POST can be used
- file extension on the request path specifies the return data type
.json
= JSON.mp
= MsgPack.mpz
= LZ4(MsgPack)
- request body is always json data
info
- get info about the server and modelencode
- tokenize text to stringdecode
- turn a token sequence to a stringgen_gpt
- generate text
give it a try with curl:
curl --request GET \
--url http://localhost:6000/gen_gpt.json \
--header 'Content-Type: application/json' \
--data '{
"key": "secret",
"prompt": "I like elephants because",
"max_length": 24
}'