n3d1117 / chatgpt-telegram-bot

🤖 A Telegram bot that integrates with OpenAI's official ChatGPT APIs to provide answers, written in Python
GNU General Public License v2.0
3.08k stars 1.41k forks source link

Enabling and using plugins #537

Open onchera opened 9 months ago

onchera commented 9 months ago

Hi, I wanna use plugins, but cannot. I added strings in .env

ENABLE_FUNCTIONS=true PLUGINS=weather,ddg_web_search,ddg_translate,crypto,autotts SHOW_PLUGINS_USED=true

But it doesn't take a changes - bot answers as offline.

yurnov commented 8 months ago

Hi @onchera,

did you try to add it as separate lines?

onchera commented 8 months ago
ENABLE_FUNCTIONS=true
PLUGINS=weather,ddg_web_search,ddg_translate,crypto,autotts
SHOW_PLUGINS_USED=true

I got it.

onchera commented 8 months ago

Where is the manual about functions and plugins? Where can I find it?

yurnov commented 8 months ago

Starting from here and here

I using weather, worldtimeapi and youtube_audio_extractor plug-ins and it works fine for me

onchera commented 8 months ago

Do you edit other files, instead of .env?

Starting from here and here

I using weather, worldtimeapi and youtube_audio_extractor plug-ins and it works fine for me

yurnov commented 8 months ago

Do you edit other files, instead of .env?

no. all others are the same*. I running in the docker container

*technically not fully, I running my versions with added twp PRs, this and that, but both of them don't change anything related to plugins in general.

Please show:

 cat .env | grep -v -e "^#" -e "TOKEN" -e "KEY"

And how do you run the bot? In case if it local python, show your:

python --version
python -m pip freeze
onchera commented 8 months ago
ADMIN_USER_IDS=6320848263
ENABLE_IMAGE_GENERATION=false
ENABLE_TTS_GENERATION=false
ENABLE_TRANSCRIPTION=true
OPENAI_MODEL=gpt-4-turbo
OPENAI_BASE_URL=https://jewproxy.tech/proxy/azure/openai
ASSISTANT_PROMPT="You are assistant"
STREAM=false
BOT_LANGUAGE=ru
ENABLE_FUNCTIONS=true
PLUGINS=weather, ddg_web_search, ddg_translate, crypto, autotts
SHOW_PLUGINS_USED=true
onchera commented 8 months ago

python3 -m pip freeze


acme==2.9.0
certbot==2.9.0
certifi==2023.11.17
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.7
ConfigArgParse==1.7
configobj==5.0.8
cryptography==41.0.7
distro==1.9.0
gTTS==2.5.1
httplib2==0.20.4
idna==3.6
josepy==1.14.0
parsedatetime==2.6
pycurl==7.45.2
PyICU==2.12
pyOpenSSL==23.2.0
pyparsing==3.1.1
pyRFC3339==1.1
PySimpleSOAP==1.16.2
python-apt==2.7.6
python-debian==0.1.49
python-debianbts==4.0.2
pytube==15.0.0
pytz==2024.1
reportbug==13.0.1
requests==2.31.0
six==1.16.0
urllib3==1.26.18
vk-api==11.9.9

python3 --version

Python 3.11.8

yurnov commented 8 months ago

Most probably issue is here OPENAI_BASE_URL=https://jewproxy.tech/proxy/azure/openai, please check that Azure OpenAI support external functions

UJIbHYP commented 8 months ago

Most probably issue is here OPENAI_BASE_URL=https://jewproxy.tech/proxy/azure/openai, please check that Azure OpenAI support external functions

Thank you, I'll check.

onchera commented 8 months ago

Supports. https://techcommunity.microsoft.com/t5/microsoft-azure-netherlands/how-to-leverage-plugins-for-azure-openai-service/td-p/3863986

Most probably issue is here OPENAI_BASE_URL=https://jewproxy.tech/proxy/azure/openai, please check that Azure OpenAI support external functions

onchera commented 8 months ago

I changed proxy and now model supports plugins. How can i activate them? Prompts?

onchera commented 8 months ago

Maybe I'm stupid, but I

  1. clone repository
  2. install requirements
  3. input token, proxy, models
  4. edit .env
    ADMIN_USER_IDS=6320848263
    ENABLE_IMAGE_GENERATION=false
    ENABLE_TTS_GENERATION=false
    ENABLE_TRANSCRIPTION=true
    OPENAI_MODEL=gpt-4-turbo
    OPENAI_BASE_URL=https://jewproxy.tech/proxy/azure/openai
    ASSISTANT_PROMPT="You are assistant"
    STREAM=false
    BOT_LANGUAGE=ru
    ENABLE_FUNCTIONS=true
    PLUGINS=weather, ddg_web_search, ddg_translate, crypto, autotts
    SHOW_PLUGINS_USED=true
  5. launch bot
  6. PLUGINS DOESN't WORK

image_2024-03-07_010952124

UJIbHYP commented 8 months ago

No plugins, no context, wtf.

Maybe I'm stupid, but I

  1. clone repository
  2. install requirements
  3. input token, proxy, models
  4. edit .env
ADMIN_USER_IDS=6320848263
ENABLE_IMAGE_GENERATION=false
ENABLE_TTS_GENERATION=false
ENABLE_TRANSCRIPTION=true
OPENAI_MODEL=gpt-4-turbo
OPENAI_BASE_URL=https://jewproxy.tech/proxy/azure/openai
ASSISTANT_PROMPT="You are assistant"
STREAM=false
BOT_LANGUAGE=ru
ENABLE_FUNCTIONS=true
PLUGINS=weather, ddg_web_search, ddg_translate, crypto, autotts
SHOW_PLUGINS_USED=true
  1. launch bot
  2. PLUGINS DOESN't WORK

image_2024-03-07_010952124

I got the same.

n3d1117 commented 8 months ago

Hi @onchera, can you try removing the spaces from the plugin list?

So change this:

PLUGINS=weather, ddg_web_search, ddg_translate, crypto, autotts

to this:

PLUGINS=weather,ddg_web_search,ddg_translate,crypto,autotts
onchera commented 8 months ago

Hi @onchera, can you try removing the spaces from the plugin list?

So change this:

PLUGINS=weather, ddg_web_search, ddg_translate, crypto, autotts

to this:

PLUGINS=weather,ddg_web_search,ddg_translate,crypto,autotts

Yeap...

needhourger commented 5 months ago
ADMIN_USER_IDS=xxx

ALLOWED_TELEGRAM_USER_IDS=*

OPENAI_MODEL=gpt-4-turbo
SHOW_USAGE=true
BOT_LANGUAGE=zh-cn

ENABLE_FUNCTIONS=true
PLGUINS=weather,ddg_web_search,ddg_translate,ddg_image_search,crypto,dice,whois,webshot,auto_tts
SHOW_PLUGINS_USED=true

This is my configuration. My plugins doesn't work too. Is there anything I have missed? I am using a docker environment, here is my start script.

docker run -itd --env-file .env --name telegram --restart unless-stopped n3d1117/chatgpt-telegram-bot

图片