![](/web/img/chatgpt-telegram.webp)
Chat GTP Telegram
Update: 4/5/20204
Un año después, es posible que una instancia de ChatGPT ya no sea tan atractiva como parecía antes. En este momento, optaría por Mistral o Llama 7B, alojados localmente o en algún servicio en la nube como AWS, Google Cloud, entre otros.
He creado un bot para utilizar ChatGPT en Telegram, y lo he alojado en AWS.
-> Repositorio
ChatGPT Telegram Bot with AWS Lambda
ChatGPT on Telegram by utilizing the services of AWS Lambda, S3, and API Gateway.
Features
- API support
- Memory
Initial Setup
- Create an OpenAI account and get an API Key.
- Create an AWS account.
- Setup your Telegram bot. You can follow this instructions to get your token.
- Create your Lambda service, choose Python 3.9
- Create a env and install requirements.txt
- put all content of lib/site-packages in a zip file with lambda_funtion.py
- Create a S3 bucket
- Create a Create a REST API and deploy
- Connect Telegram to your API Gateway
$ curl --data "url=<INVOKE_URL>" "https://api.telegram.org/bot<ACCESS_TOKEN>/setWebhook"
- Replace
<ACCESS_TOKEN>
with your Telegram HTTP API access token obtained in the first step - Replace
<INVOKE_URL>
with your endpoint You should get back a response similar to this:
$ {"ok":true,"result":true,"description":"Webhook was set"}
- Replace
- setup the environment variables:
- BUCKET_TOKEN: bucket name
- OPENIA_KEY: OpenAI key
- PERSINALITY: the system message for the AI
- TELEGRAM_TOKEN: Telegram bot token
- USER_ID: your telegram user ID
- upload the zip file to your Lambda service
I skipped a thousand steps, you have to give permissions to lambda to be able to write files and some other things that I missed :sweat:. soon I will add what is missing