openai / gpt-discord-bot

Example Discord bot written in Python that uses the completions API to have conversations with the `text-davinci-003` model, and the moderations API to filter the messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: 'DEFAULT_MODEL'

TRexAILab opened this issue · comments

Hello! Please help, when you start the bot with the python -m src.main command, this message appears.

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/gpt-discord-bot/src/main.py", line 8, in <module>
    from src.constants import (
  File "/home/gpt-discord-bot/src/constants.py", line 25, in <module>
    DEFAULT_MODEL = os.environ["DEFAULT_MODEL"]
  File "/usr/lib/python3.10/os.py", line 680, in __getitem__
    raise KeyError(key) from None
KeyError: 'DEFAULT_MODEL'
commented

This is a simple fix. In the .env file update
MODEL=gpt-3.5-turbo
to
DEFAULT_MODEL=gpt-3.5-turbo

This is a simple fix. In the .env file update MODEL=gpt-3.5-turbo to DEFAULT_MODEL=gpt-3.5-turbo

this hasnt solved this issue for me, it still throws the error original poster had

Hi @roflcakesII can you share what your .env looks like with the sensitive tokens removed?