InfoGPT - Make large language models such as ChatGPT/Wenxin Yiyan easier to use

   outside_default.png        outside_default.png  

InfoGPT is ChatGPTa model developed by the author in the process of learning and other large language models 开源软件. As of version v0.0.14, it supports three platforms: openai api proxy, telegram robot, and WeChat official account. WeChat official account integration is more troublesome, so I will make a special introduction.

Project address: https://github.com/alwqx/infogpt

Welcome everyone to try and raise demand

for individual users

  1. OpenAI API delegate

  2. Shared API Key

b7c8f1d62a9f2ba3d729a2239ad51573.gif

Telegram Bot

0a620346268b6e059ca4c642eea03257.gif

binary run

  1. Go to the releases [1] webpage to download the latest version of the compressed package. Here we take the Apple M2 chip compressed package infogpt-v0.0.14-darwin-arm64.tar.gzas an example .

$ tar xzvf infogpt-v0.0.14-darwin-arm64.tar.gz
x README.md
x configs/
x configs/config.yaml
x infogpt
  1. Modify the configuration fileconfigs/config.yaml

server:
  http:
    addr: 0.0.0.0:6060
    timeout: 300s
  grpc:
    addr: 0.0.0.0:6061
    timeout: 2s
admin:
  openai_api_key: ""
  proxy_url: ""
  gin_ratelimit: "20-D"
  telegram:
    token: ""
    # 机器人的请求限制,原则上应该比 user_ratelimit 大,为空则不进行限制
    ratelimit: ""
    # 每个用户的请求限制,为空则不进行限制
    user_ratelimit: "20-D"
    exclude_keys: ["foo", "bar"]
  wechat:
    app_id: ""
    app_secret: ""
    token: ""
    encoding_aes_key: ""
    # 机器人的请求限制,原则上应该比 user_ratelimit 大,为空则不进行限制
    ratelimit: ""
    # 每个用户的请求限制,为空则不进行限制
    user_ratelimit: "20-D"
    exclude_keys: ["foo", "bar"]
    auto_replay:
      "001": "infogpt infogpt1"
  1. run the binary

# geek @ geekdeMBP in ~/Downloads/infogptlab [22:18:36]
$ ./infogpt -conf configs
2023/04/18 22:18:54 maxprocs: Leaving GOMAXPROCS=12: CPU quota undefined
DEBUG msg=config loaded: config.yaml format: yaml
INFO module=service/admin ts=2023-04-18T22:18:54+08:00 caller=service.go:71 service.id=geekdeMBP.lan service.name= service.version= trace.id= span.id= msg=[NewAdminService] no proxy_url, use http.DefaultClient
WARN msg=[NewAdminService] not enable telegram bot, skip

[GIN-debug] GET    /hello                    --> infogpt/internal/server.ginHello (5 handlers)
[GIN-debug] GET    /openaiproxy/*path        --> infogpt/internal/server.openaiProxy (5 handlers)
WARN msg=not enable wechat, skip

Note : By default, there is only the proxy function, that is, the request sent to infogpt is forwarded to OpenAI's API server.

  1. Background process

nohup ./infogpt -conf configs > infogpt.log 2>&1 &
  1. request a demo

$ curl --location 'localhost:6060/openaiproxy/v1/completions' \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
    "model": "text-davinci-003",
    "prompt": "你好",
    "max_tokens": 1024,
    "temperature": 0
  }'
{
  "id": "cmpl-76grTMyULgpL8MT8iAyqR9ZChwyqX",
  "object": "text_completion",
  "created": 1681829083,
  "model": "text-davinci-003",
  "choices": [
    {
      "text": "\n\n 你好!",
      "index": 0,
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 4,
    "completion_tokens": 9,
    "total_tokens": 13
  }
}

For details, refer to the document deploy [2]

Docker run

docker run -d --name infogpt --rm -p 6060:6060 -p 6061:6061 -v </path/to/your/configs>:/data/conf infogpt:latest

All

  • [x] Support OpenAI Proxy

  • [x] REST/gRPC interface

    • [x] chat

    • [x] Generate web article summaries

    • [x] Generate book content summaries

  • [x] Telegram

    • [x] /chat /url /book three commands

    • [x] use frequency limit

  • [x] WeChat official account limited support

    • [x] use frequency limit

    • [x] Timeout caching Q&A

  • [ ] Support ChatGPT Proxy

  • [ ] Slack

  • [ ] Generate a summary of the contents of the file

thank you

The development of this open source project is inseparable from the support of these open source projects:

  • go-kratos[3]

References

[1]

releases: https://github.com/alwqx/infogpt/releases

[2]

deploy: docs/deploy.md

[3]

go-kratos: https://github.com/go-kratos/kratos

Guess you like

Origin blog.csdn.net/u011387521/article/details/130234794