#Basic Discord Bot to chat with text-davinci-003 with mod api support

636 messages · Page 1 of 1 (latest)

solar marsh
#

Project help channel for the code on github!

THE BOT ISN'T HERE. Please don't try to prompt it (I will be deleting them to clean up)
Also please don't advertise your own HOSTED project here. If you made a fork with more features, feel free to post the link to your github 🙂

If you're here from github, say hi!

https://github.com/openai/gpt-discord-bot

You connect your openai account by inserting your api key. Your account will be billed for token use. See https://openai.com/api/pricing/

GitHub

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. - GitHub - openai/gpt-di...

OpenAI

OpenAI is an AI research and deployment company. Our mission is to ensure that artificial general intelligence benefits all of humanity.

uneven birch
warm shore
#

namaste ai

ebon plover
#

Congrats on the release :D

odd star
#

Hi

open pivot
#

What if users feed malicious input to it? Does that risk getting my account banned?

solar marsh
#

Feel free to fork and add your own features catNekoHeart

stray flax
#

is it paid?

solar marsh
#

It uses your openai account to bill for token use

stray flax
solar marsh
#

Yes you are billed for token use

snow fulcrum
#

stop=["<|endoftext|>"],
what does this do exactly? Wouldn't the bot normally stop at <|endoftext|> anyway?

solar marsh
#

I think that prevents it from returning the token

#

I was seeing it return conversations and like fill in what you would say lol

gritty shadow
#

Hi

snow fulcrum
#

you might also consider giving \n as a stop sequence to prevent the AI from giving multi-paragraph responses

solar marsh
#

Human in this case is your username and there can be many people

#

I think you need beeline

#

Newline

#

Like if you want a story or code

#

Feel free to fork

snow fulcrum
#

but hey as long as it's working, all roads lead to Rome

exotic saffron
#

Isn't "engine" deprecated ?

solar marsh
austere sky
#

Hi

calm shoal
#

Hi

fervent wharf
#

Hi! Interesting work, congrats.
How is this different from talking to davinci-003 on the OpenAI playground, though?

exotic saffron
#

In one of yours script

#

I'll tell you

dense jewel
#

is the discord bot down

#

is the discord bot down sad

exotic saffron
#

This work like a ping

#

Dont ban me 😱😱

solar marsh
solar marsh
solar marsh
fervent wharf
#

Just the convenience of Discord?

solar marsh
#

So you can talk to it instead of just having it complete things

fervent wharf
#

Gotcha

solar marsh
#

Yeah convenice and it’s fun to have multiplayer conversations!

#

Friends can join in talking to the bot

exotic saffron
#

May I ask you some questions Moxi about fine tuning ? I'm learning on the subject before starting to develop my project

solar marsh
#

Yes! Please ask here

#

Though I don’t know much, I mostly work on dalle, but I can ask around for you

dense jewel
solar marsh
#

There isn’t a bot hosted here for the public

exotic saffron
#

ChatGPT discord bot would break the internet

#

Would be fun

exotic saffron
#

thanks!

dense jewel
solar marsh
#

I don’t know what you’re talking about

dense jewel
solar marsh
#

I can’t help you with that, you are hosting it yourself

#

Unless it crashed or has an error message, then share it

solar marsh
exotic saffron
#

Is chatgpt using code davinci 02?

solar marsh
#

No

exotic saffron
#

So when you ask to write a script, it doesnt switch of model.

drowsy prawn
#

HEI

still jay
#

Hi

fast heart
#

hi

sharp ibex
#

Can't for the life of me confirm if I have a user profile setup in discord. Trying to make the bot keep track of all my conversations with it. Doesn't seem to know what we spoke about in other chats. I'm not a discord n00b but I'm not advanced by any stretch. Anyone have ideas?

astral rain
#

Vb

ebon plover
royal lance
#

Hello I have experience on discord bot development.
Can we have an interview for discussions of your project?

solar marsh
#

Sure, what are your questions?

royal lance
#

Could you give me detailed requirements?

#

hi

#

I am waiting your detailed requirements

near kindle
ebon plover
royal lance
#

SRS

#

If there is no SRS, you can explain me functional requirements

ebon plover
royal lance
#

Software Requirements Specefication

#

I mean your project's requirements

subtle hornet
#

you can add discord stuff there.
like if i command it to delete text, kick user, it will do it

stuck mesa
#

Playing catch-up, have created the discord bot, Git let's you create a docker and it works fine for testing a playing around. My question is one of context - each chat seems detached from the previous, so the model is fine but history is not - is that only available through the web ChatGPT instance?

near kindle
stuck mesa
sweet gorge
wind crest
#

It's amazing to me how little attention GPT3 got compared to ChatGPT because of the puny less amount of work you have to do to get a response with ChatGPT

#

People are asking me how I generated 28,000 item lists with ChatGPT

#

uhhhhh I didn't use ChatGPT

#

Don't know why it bothers me so much, definitely silly on my end

#

It's just like, this amazing technology has been available for like two years and because it took slightly more work and thought than "Give me ai image prompts!!" people completely ignored it.

solar marsh
#

What is pm2

near kindle
solar marsh
#

But the bot is in python and uses pip…

near kindle
tropic anchor
solar marsh
#

Cool I’ve never used it

sharp palm
#

I've never set up a discord bot before. Is it a simple process?

acoustic delta
#

hello

cloud dune
#

I followed the steps and got to number 7. My env file is saved and ready to go but when I ran:
"pip install -r requirements.txt
python -m src.main"

I got the message 'command not found: pip"

Any idea how to resolve? Thanks.

#

I think I have to install dependencies but those commands were not provided.

cloud dune
#

nvm I had python in command but it needed to be python3

#

Bot is in the server but every command returns, "The application did not respond". Any ideas what I did wrong?

#

I checked permissions fyi

#

nvm I fixed it it needed channel permissions (not listed in github as one of the required permissions)

ocean pumice
#

hey hi every one I was just working on chatgpt bot for discord but i have encountered this

openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.
#

can anyone help me with this?

#

how can I buy more limit?

remote crest
#

hi

stiff kraken
#

hi

ebon plover
lucid shuttle
#

Just to confirm if I use https://chat.openai.com/chat that is free correct, but if I want to add a discord bot to my server I use that $0.0004 / 1K tokens?

solar marsh
cloud dune
#

Also, is there a way to not have it respond to certain messages? I trained it to respond to messages appended with 'itb' with a . which is better but ideally would not respond at all but it's no response was (Empty Message). This would be useful in multiperson chats where not every message is directed at the bot.

solar marsh
#

Context limit is a model thing, it can’t get bigger

solar marsh
cloud dune
solar marsh
#

Yeah you can drop earlier messages if you want

worldly marsh
#

any plans to port over to slack too?

#

im too novice to do it myself, but trying to get there

solar marsh
#

No plans

languid crescent
#

Hi

gusty plaza
#

is this the right place to ask gpt-discord-bot questions?

cursive hemlock
#

hey im getting an error when trying to start it, it says no module named "discord" exists

gusty plaza
#

this is somewhere between a question and a statement - how on earth does the config.yaml work in terms of naming the bot, and the conversation structure? the line for instructions: is totes obvious, but i'm drawing blanks on name: and messages: 😄

dense dragon
#

hello

gusty plaza
#

what files are in that directory?

hoary veldt
#

im using external libraries in pycharm, that may be my reason.

#

Package containing module 'discord' is not listed in the project requirements

near kindle
#

You can't use external libraries in pycharm to get this bot to work, install the requirements with pip install -r requirements.txt (double check the README though)

solar marsh
gusty plaza
near kindle
gusty plaza
near kindle
#

Oops! Sorry I misread

gusty plaza
#

Ok thanks, I will check it out. 🙂

tight ivy
#

So you cant do this with a free account? payment method must be entered?

finite parrot
#

it uses whatever name your discord bot has as client.user.name ... in the config.yaml you wanna keep the name as Lenard, that will be exchanged when the bot starts and loads up the yaml file

gusty plaza
finite parrot
#

the name in the config.yaml matters, if you replace it there you also need to replace the hardcoded name there in main.py

#

as its hardcoded to search for "Lenard"

solar marsh
#

yeah sorry i got lazy there

gusty plaza
#

I don’t feel so silly asking about the file now

azure knot
#

just added a gpt-discord-bot to me server and its responding properly, i thought you had to pay to get chat tokens, but is it that im just limited to a certain amount of chats per hour?

azure knot
eternal marsh
#

u get a free amount of credits

azure knot
eternal marsh
finite parrot
azure knot
#

Here's to hoping openai eventually provides a flatrate subscription model

solar marsh
errant ferry
errant ferry
#

still unsure what the benefits of using it over the webpage chat but will see

exotic saffron
#

That made my discord crash...

#

Hey Moxi,

I just started an internship in a web agency and they are asking me to develop a tool using OpenAI API in the upcoming weeks. I heard of a GPT 3.5 API that will be released in the future. Am I wrong? Should I wait for the next API to drop before developing my tool?

#

Here (to ping you)

near kindle
exotic saffron
#

Moxi told me that I can ask him questions here a few months ago

#

And that it was ok

#

I understand and thanks for the information

near kindle
#

Ah i see, my bad!

exotic saffron
#

I was using answer to ping that day and he said that was ok so I don't get censored by openai bot lol

exotic saffron
solar marsh
#

Just use the completions api it’s already public

#

What kaveen said is correct

#

If your questions aren’t related to my bot please post in the other channels

errant ferry
#

wait so there's a difference between chatgpt api and gpt3 api? Is that why using https://chat.openai.com/ seems better for technical questions than using the bot

bleak flume
#

hoLA

solar marsh
#

And the bot has a preprompt that it’s human

errant ferry
solar marsh
# errant ferry is there a resource where I can see the overview of the differences?

Not sure, there’s this blurb here https://openai.com/blog/chatgpt/

OpenAI

We’ve trained a model called ChatGPT which interacts in a conversational way. The dialogue format makes it possible for ChatGPT to answer followup questions, admit its mistakes, challenge incorrect premises, and reject inappropriate requests. ChatGPT is a sibling model to InstructGPT, which is trained to follow an instruction in

#

And the link to instructgpt

#

For technical questions I think it’s just the preprompt

#

Try changing the bot preprompt?

errant ferry
#

oh interesting, I'll play around with it for sure

rain acorn
prisma kettle
#

shouldn't the openai calls be wrapped with a thread executor?

#

or else it's blocking the asyncio event loop (therefore the bot is dead while it is making an openai api call)

finite parrot
pearl sun
#

hello

solar marsh
hollow egret
#

Failed to start chat No API key provided. You can set your API key in code using 'openai.api_key = <API-KEY>', or you can set the environment variable OPENAI_API_KEY=<API-KEY>). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = <PATH>'. You can generate API keys in the OpenAI web interface. See https://onboard.openai.com/ for details, or email support@openai.com if you have any questions.

why this error appeared? i'm confused. i already specify the openai_api_key in constant.py

solar marsh
#

This is erroring from the openai api

#

I am unsure as it’s not my error

#

Make sure your key is passed to the api

tribal elm
#

Hi there, I was talking with YufeiG on GitHub about an error I was having with getting the Discord Bot running in Python. was told to come here for more direct help. (I am a novice and am probably making some simple mistake I bet)

solar marsh
#

Hello

#

Can you pull main and try again

#

Also share your command that you’re running

tribal elm
#

I have to admit I have no idea what that means 😅

solar marsh
#

Download the code again and run it again

#

What command are you using to run it

near kindle
#

Download it again the same way that you did originally, and save it into a new folder, and then you can try running the bot again with the new changes that Moxi has put in, it may have fixed your previous issue

tribal elm
#

Oh I see, Okay, I can totally do that.

near kindle
tribal elm
#

Maybe I should ask what command should I be using? Because it sounds like probably am doing this all wrong, with how little I know. I did fill out all the pertinent information and had all the python files present as it was outlined in the project, But I don't know if there's a specific way to run it, I would just try executing the main file, and it sounds like that is probably very wrong xD

near kindle
#

Ah I see, how were you executing the main file? By just right clicking and running it with python?

tribal elm
#

hehe yep

near kindle
#

Can you try it again, after downloading the files again?

tribal elm
#

absolutely 👌

near kindle
#

Let me know with a ping what happens

tribal elm
#

Thanks! and ty for the help! 🙂

#

@near kindle Same result!

near kindle
#

I want you to open a command prompt window in the folder that contains the files for this bot, are you able to do that?

tribal elm
#

sure thing ✅

near kindle
#

Then, inside that folder try running the command python src/main.py

solar marsh
#

python -m src.main

tribal elm
#

I got this back:

balmy estuary
#

Can you try moving main to the previous folder (outside of SRC) and then try running it like you were before?

tribal elm
balmy estuary
#

That's because it's running correctly

#

Now, using CMD prompt, with it inside the directory

tribal elm
#

command prompt from the folder where Main.py is currently? or do I return Main.py to where it came from and do this?

balmy estuary
#

As it is

tribal elm
#

okies

balmy estuary
#

Where main py is

tribal elm
balmy estuary
#

Type pip install discord

near kindle
#

oh do pip install -r requirements.txt

tribal elm
#

That's done now, thanks! So now when I try the command again I get:

near kindle
tribal elm
#

ty for putting up with my noobness! Appreciate it!

near kindle
#

No worries at all, it is definitely confusing on windows

balmy estuary
#

It helps make the program bulletproof

tribal elm
#

This is good, yea?

balmy estuary
#

Auyy

#

Yup

tribal elm
#

woohoo 😄

near kindle
#

perfect!

#

So yeah, you can't really run python files with right click in most cases, we have to use terminal 🙂

tribal elm
#

eyyy, it joined my server, thank you so much ❤️ ^_^

tribal elm
#

yay it's working. Thank you again all of you, I really appreciate the help ^_^

tribal elm
#

Is there any trick to get it to adhere to the Config file on how to speak? I've noticed it doesn't seem to be aware of whats in there

solar marsh
#

It should be using it, what do you mean it’s not aware

tribal elm
#

Okay, it took me some time, but ChatGPT helped me fix the config.yaml file's formatting errors I had made though my inexperience, and now it is working perfectly. 👌 ✅

fluid dove
#

Idk why I can't chat

#

How do I fix it?

solar marsh
#

What is the error message

celest sedge
#

When i ask the bot to write some code for me it tells me that it will do it in few hours. The code i have asked to write is pretty basic

#

How can i modify it to actually start doing something?

solar marsh
#

This is a chat bot. For casual conversation. Change the prompt in config.yaml to be ai assistant if you want an ai assistant

celest sedge
#

Can you help a little bit on how I can achive that? With a sample config that could somehow fit my purpose? Thank you

solar marsh
#

Just change the prompt in the config to what you want

celest sedge
#

You are talking about this config ?

solar marsh
#

Like instead of you are discord user change it to you are an ai assistant

#

Config.yaml yeah

#

That tells the bot how to act

celest sedge
#

oh 😄

#

I made the following config

#

here is the result

#

basically i have to give him all the possible answers that someone will ask?

solar marsh
#

no, the examples just tells the bot how to talk

#

like if you want them to use slang or something

#

its not that necessary

celest sedge
#

For example if i would like the bot to help with configuration from a specific api that is probably not present on the open ai website, could i add it here? or where should i add it?

#

Also getting this error pretty often

fluid dove
#

How do I enable moderation

solar marsh
solar marsh
# celest sedge

sorry i cant see the error in your screenshot. what is the crash reason

celest sedge
#

Btw I have build a very big dataset and now discord doesnt let me even start /chat :)))

#

Is this limitation only from discord or if i switch the client i should be fine?

solar marsh
#

what is a dataset

celest sedge
#

I have parsed a whole html documentation and made the headers as user bob text and the paragrphas under that header as user ai text 😄

#

now my prompt has 9000 tokens, i think its a little bit too much 😦

solar marsh
#

i think model max is 4k something?

#

you can just test your prompt on playground first

tribal elm
#

Hey sorry another question, is it only able to be set to reply in Threaded conversations, or is it possible to have it be in a regular chat channel(s) instead/too?

solar marsh
#

you can change the code to work in regular channels

#

its just discord api

#

like theres a thread check in on messages, if you just remove that

#

should work

#

maybe

#

lol

fluid dove
#

Im getting this error message

finite parrot
# fluid dove

That's an answer from the OpenAI API not sure if there are still problems, for me it all works fine, did you give it another try?

eternal marsh
#

WHY DO i need to add ALLOWED_SERVER_IDS?
can't i just leave it blank so anyone can add the bot
why do i need to add it manually for every server?

finite parrot
solar marsh
#

I had the issue where people I didn’t know kept adding it to their server

umbral merlin
#

hi

#

i am having this error

#

Error - You exceeded your current quota, please check your plan and billing details.

#

While chatting with my discord bot

#

please help

finite parrot
#

Its not related to this Bot at all.

umbral merlin
#

I just created my account around 1 hour ago

#

How can it run out of it if I haven't even used it?

orchid nacelle
#

This isnt the place for this

#

Try API Support. And instead of posting a log of messages

#

Try asking for help

umbral merlin
finite parrot
orchid nacelle
solar marsh
umbral merlin
solar marsh
#

But yes this is a general api issue question, I just happen to have an interest in server issues but please also post in api support

solar marsh
#

Post in api support I’ll go there

prime ermine
#

Hey can we run this bot in our own server?

solar marsh
#

Yes, just read the readme

tribal elm
fluid dove
#

How can I remove the prompt

finite parrot
#

config.yaml to modify it, for removing it completly you need to modify completion.py

kind mulch
#

im stuck on step 7 install dependencies... the code isnt working for me... anyone have a solution?

eternal marsh
fossil sleet
#

Hey

#

can anyone tell how to add chat gpt bot

near kindle
sharp raptor
#

/chat hello, i'm Tien

solar marsh
#

i checked and I did explicitly say that in my post message

carmine lance
#

does anyone know how to solve it?

finite parrot
#

Try python instead of NodeJS. The Bot isn't written in Javascript.

#

Check the Setup Part in the Readme

carmine lance
#

and how does it run in python?

near kindle
fluid dove
#

This bot generates only short answers how can I increase it?

finite parrot
#

Modify the config.yaml with own Example Conversations and modify the Instructions.

fluid dove
#

Ok

#

What should I do to get codes as responses

solar marsh
#

its short because max_tokens is low

#

if you want to use it like chatgpt change the preprompt to be AI assistant

fluid dove
#

Okay

fluid dove
fluid dove
fluid dove
#

Alright thx

finite parrot
#

Change Instructions to something that goes in this direction:

You're a virtual assistant designed to help with coding tasks. You have knowledge of programming languages, software development frameworks, and best practices in software engineering. You're capable of writing code, debugging, and optimizing performance. You communicate in a professional manner, using proper grammar and technical terminology. You have a passion for technology and enjoy collaborating with developers to create high-quality software. Use markdown syntax for readability.
#

The default 512 max_tokens should be fine, Discord has max 2000 Characters per message.

fluid dove
#

I'm always getting responses like this

ebon plover
#

Try asking for a code example in a
specific language

fluid dove
#

How

ebon plover
#

For example "show me a code example in Java for Arduino to detect a Bluetooth connection to a mobile"

fluid dove
#

Okay

#

Tnx it's working

ebon plover
#

:)

fluid dove
#

How can I get response codes in code block

ebon plover
#

You ask it to use triple backticks like discord markdown

#

And use language suffix

Give it an example like

fluid dove
#

Okay

fluid dove
#

How can I increase the typing status

ebon plover
#

What do you mean by increase?

fluid dove
#

I can't increase the typing status?

#

Increase the time

blazing gust
#

Pushed a PR, check it out.

ebon plover
fluid dove
#

Ok

fluid dove
#

Does anyone have dalle discord bot

solar marsh
#

Yes, check the openai GitHub for Dallify

fluid dove
#

Is there any project post

fluid dove
#

Thx

fluid dove
#

How do I add multiple servers

tribal elm
#

heya, is there a way to remove the context limit so a thread can go on for much longer?

finite parrot
#

The Context Limit is the limit of the Model itself which is 4096 Tokens.

#

You can modify the completion.py File to have only the last n Messages in the Context, which allows for a bit longer Threads.

#

But it will lose the context of the first messages.

safe turtle
#

Ples Help me,
I can't run this project 😦
It's notice: KeyError: 'DISCORD_BOT_TOKEN' 😦

finite parrot
#

Looks like an issue with your .env File not being loaded at runtime and those Variables not being used.

fluid dove
safe turtle
safe turtle
finite parrot
#

Problem is you running main.py directly from the folder src. Which makes it impossible to import src.otherfiles, try to launch it like the Readme suggests:

python -m src.main
#

You can do this via the terminal in your IDE i think.

fluid dove
#

Is it possible to upgrade into chatGPT api

latent frost
#

how to make an ai image

fluid dove
eternal marsh
#

Why is my GPT chat bot on discord not working properly and giving irrelevant responses?

blazing gust
#

What are your prompts?

eternal marsh
eternal marsh
#

It worked but the bot didn't respond to anything

fluid dove
eternal marsh
fluid dove
eternal marsh
#

I used the /chat command and it worked. Before I just directly chat my bad

fluid dove
#

GG

eternal marsh
fluid dove
#

You're welcome

plain igloo
#

Will this be updated to the chatgpt API?

fluid dove
plain igloo
fluid dove
#

Pull request

#

On GitHub

plain igloo
#

the one for model flexibility?

#

Will that work?

fluid dove
#

Working for me

fluid dove
plain igloo
#

Thanks

fluid dove
#

yw

blazing gust
#

@fluid dove I made that PR, You have tested the model flexibility pr? And it works?

fluid dove
#

Yes

#

Good job

blazing gust
#

It wouldnt work for turbo though, right? As that requires a little more adjustments on the completition side of things, right?

#

Leave feed back on the PR so it can get merged.

finite parrot
#
For PRs: only bug fix PRs wil be accepted. If you are implementing a new feature, please fork this repo.
blazing gust
#

I read that, but cant imagine why they are doing that? Whats the point in open source, if not to improve the software.

finite parrot
#

Looks to me like the Chat PR is fine on the first glance, here is how i changed it:

            convo=Conversation(messages + [Message(MY_BOT_NAME)]),
        )
        # Start the butchering again
        # Create a Custom ChatML based ChatLog instead of using the Rendered Prompt
        chat_log = []
        chat_log.append({"role": "user", "content":BOT_INSTRUCTIONS})
        example_messages = MY_BOT_EXAMPLE_CONVOS[0].messages
        for message in example_messages:
            if message.user == MY_BOT_NAME:
                chat_log.append({"role": "assistant", "content": message.text})
            else:
                chat_log.append({"role": "user", "content": message.text})
        for message in messages:
            if message.user == MY_BOT_NAME:
                chat_log.append({"role": "assistant", "name": MY_BOT_NAME, "content": message.text})
            else:
                chat_log.append({"role": "user", "content": message.text})
        print(chat_log)
        # Use ChatGPT API to Answer Chatmessages
        MODEL = "gpt-3.5-turbo"
        response = openai.ChatCompletion.create(
            model=MODEL,
            messages=chat_log,
            temperature=0,
        )
        reply = response['choices'][0]['message']['content']
        # End of butchering
        rendered = prompt.render()
finite parrot
#

If you blow it up in features it will be hard to use it as educational foundation to learn.

blazing gust
#

I can understand that, but chosing a different model isnt exactly earth shattering feature overload.

finite parrot
#

But it would normally require a full refactor really, the hack i did is the same hack that happened in the PR.

#

Just that the PR even ignores the BOT_INSTRUCTIONS and EXAMPLES

blazing gust
#

turbo would require a refactor, for sure.

#

Damnit, guess Ill do it at some point.

finite parrot
#

The other issue is its not really gonna be Lenard anymore what showcased in #gpt-discord-bot

#

At least for now, maybe later personas with turbo gonna be easier.

blazing gust
#

I have some other things going on ATM, but will revisit this.

solar marsh
#

i made it for fun

#

the point is you fork it to add on to it, if you want to add more features. base sample should be simple

#

we can make a chatgpt discord bot sample though

#

maybe if i get time

supple torrent
#

how to make Open AI create something for me?

dim epoch
olive mistBOT
#

@fluid dove

Image generation is not available in this server.
To start generating images, click here.

upbeat kayak
#

hi

humble prawn
#

GPT -4 is open or subscription-based?

ebon plover
#

Subscription

foggy wing
#

hi

lilac tulip
#

Thats really awesome, did you ever think about adding voice to it?

tired vine
#

It looks like it require more permission than the followings?
I set these on and get a permission error, not the case if I set it to Admin.

Send Messages Send Messages in Threads Create Public Threads Manage Messages Manage Threads Read Message History Use Application Commands

#

Ok found it, it's the embed link permission

tall lagoon
#

I've tried (I think) everything to get this to run - I've Manage Server permissions myself, given the correct Guild IDs to ALLOWED_SERVER_IDS, even given the bot "8" permission (Admin) when adding to server. Bot appears to be added to server correctly, but then triggers the should_block function suggesting the guild.id is not in ALLOWED_SERVER_IDS. I've tried kicking the bot, reworking .env repeatedly and can't sort it. Any tips please?

tall lagoon
ashen warren
#

How do i make the bot gpt-3.5-turbo?

finite parrot
#

But in general this is not the right place to discuss it really.

ashen warren
finite parrot
drifting dawn
#

Why my code report such error? Anyone can help?

fluid dove
versed hill
#

helpp.. no link show in console

fluid dove
#

Check if your server id is correct

versed hill
fluid dove
#

Are you using replit?

versed hill
fluid dove
#

Where did you put your server id?

#

In secrets?

versed hill
#

all in .env.example i put in secrets

fluid dove
#

You don't need to put in .env

#

Go to secret and add key DISCORD_CLIENT_ID

#

And add your client id in value

versed hill
fluid dove
#

Did you do
pip install -r requirements.txt python -m src.main

versed hill
versed hill
near kindle
#

Put in a valid server ID and it'll work

#

right click the server and click Copy ID

versed hill
brisk oriole
#

after using "python -m src.main" it says "ModuleNotFoundError: No module named 'dacite'"

#

any fix for this?

#

I have Dacite installed.

tiny canyon
#
  • gives warning: the file "AutoGpt.json" does not exist .Local memory would not be saved
#

Requirements.txt gives this after pip

tiny canyon
tiny canyon
clear arch
#

ccccccvklekblketlhrbhihckhtfukhvrtkbnbrubvdv

versed hill
tiny canyon
#

do u know anyone who can help

tiny canyon
versed hill
tiny canyon
fluid dove
#

Whats your issue

tiny canyon
fluid dove
#

Okay

idle lagoon
#

/go

drifting dawn
#

How did this happen? Anybody know how to solve the problem?

#

It worked but the bot didn't respond to anything

fluid dove
drifting dawn
fluid dove
#

Ok

drifting dawn
#

Even after granting administrator privileges and agreeing to all gateway intents, my bot still does not respond. Does anyone know how to solve this issue?

ebon plover
#

you need to allow your guild @drifting dawn , scroll up and look for ALLOWED_SERVER_IDS

drifting dawn
#

One more question, do I need an OpenAI Plus account to gain API usage in order to use this bot?

clever grove
#

I really need a api... In Macao Theres No Api Access

fluid dove
#

?

forest sierra
#

Hi I really appreciate this sample code, and I got it working, so THANK YOU! My question is around the end of life announcement for text-davinci-003 on 2024-01-04. Will the code in the repo be updated or will it be obsolete? Would love to see a gpt-4 bot on discord sample code. I saw the messages above regarding gpt-3.5-turbo, and would try that if nothing else is coming out. Thanks again!

subtle osprey
#

can someone help me with this error please

fluid dove
narrow moon
devout lily
#

Is it works with chatGPT4-Turbo?

heady anchor
#

Will feeding in inappropriate content for antiraid / spam protection with this bot get your account disabled for submitting inappropriate things through the API?

I feel like there needs to be some type of exception given based upon use case. I would be careful and work with support before using this in production. As you probably need to be granted some type of exception to use it on a public discord where inappropriate messages will likely be submitted.

Be careful using this on a public discord server. Without an additional chat filter API that prevents inappropriate things making it to the API you risk your account without permission.

An account ban is a lot easier to appeal if you use a third party LLM to filter prompts before they get to the API. As far to my knowledge it's a best effort clause that makes that appealable.

#

I don't fancy getting banned without this transaction layer in place so won't be using for now.

I suggest adding langchain to do this easily with an additional LLM as the spam prevention filter. This adds delay but will lower your risk.

#

I am happy to offer a commit that does this, and submit a PR.

heady anchor
#

Update: I wrote this on the road and totally didn't find this....but now I have!

https://platform.openai.com/docs/guides/moderation

This is that exact thing. message contexts should be classified with the moderation endpoint before being submitted to the API. Though the moderation endpoint model has a token limit of 2,000 characters, the documentation recommends text splitting and summerization to receive back accurate results for spam/harmful message detection. Your discord bot should include moderation endpoint classification because its made available to a public discord server (in this case) It should block the user from being able to recieve any response if the prompt they send is not in accordance with the user policy. Using the moderation endpoint is a good way to lower this risk for yourself.

Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform.

#

The specific model name is: ext-moderation-005

Example curl for testing:

curl https://api.openai.com/v1/moderations \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{"input": "Hello, world!"}'
heady anchor
#

Here's the relevant section of the code.

#

Very nice that the template includes these to protect developers.

near kindle
#

and yes, if you repeatedly abuse the API with malicious input / disallowed input there is a risk of your account being deactivated

#

Side update-- This bot has been updated to use gpt-3.5-turbo (and other chat models) and the Chat Completions endpoint

near kindle
#

Another update -- bot has been updated to allow for changing the model, temperature, max tokens when starting a chat with /chat

buoyant sinew
#

ayo, i couldnt find any solution, so anyone can help me with my bot? i did try follow the instructions, and to my knowledge i did fine, however as u can see there is KeyError: 'DEFAULT_MODEL'...

near kindle
#

like
DEFAULT_MODEL=gpt-3.5-turbo

buoyant sinew
#

i didnt change anything there

buoyant sinew
#

im blind ngl

buoyant sinew
#

but now new problem guys

#

gpt 4 on playground site didnt help me

near kindle
raw gull
#

Getting this same error as Gustavo

raw gull
#

I have found 3 errors this afternoon since updating my fork to the latest release. I will be submitting a PR

raw gull
#

They should just feed the entirety of the bot into gpt4 turbo like I did 😉

near kindle
#

that's wrong, its related to the name of the bot

raw gull
#

Read the message

near kindle
#

the error code is exactly due to the name of the bot

#

the name of the message

#

because there are special characters in the name for the bot

raw gull
#

It's not related to the name of the bot, its related to the name of the user

near kindle
#

(which you cannot have)

#

oops you're 100% right

raw gull
#

Yes I know

near kindle
#

I'll flatten the name and push an update

raw gull
#

😉

near kindle
#

what's wrong with the .env?

raw gull
#

Eating dinner rn

#

DEFAULT_MODEL vs MODEL I think

#

And prompt render_json produces funny output

near kindle
raw gull
#

Sure I'd be happy to 😃

#

Sorry for being silly a minute ago. Didn't think I'd get an immediate reply

#

I'll bump the channel here after I open an issue

near kindle
#

Sounds good! I have a change out for fixing the model .env default, will look into the prompt render_json after you put the details on an issue

near kindle
raw gull
#

User roflcakesII reports that it doesn't work for them, but it worked for me

near kindle
#

yeah dw I already put in a change for the env issue moxi will merge it in later

near kindle
#

I'll follow up with that user

raw gull
#

i have a user with two spaces in their new-style discord name

#

but at any rate base.py has some strangeness in how it renders the Prompt i think

near kindle
#

It happens upstream within the endpoint yeah

#

the regex stuff for the name field

#

The name has to be flattened to unicode and special characters stripped before sent to the API

#

so in that user's example

#

we'd keep their egnlish characters

#

but remove all the special weird stuff, spaces, etc

raw gull
#

i thought it was a gpt-4-turbo issue at first but going back to the older version of the bot worked

near kindle
#

The older version of the bot was using text-davinci-003 as the endpoint for completions

#

and how that worked was, the conversation didn't have a messages array

#

it was 1 big string

#

so we were able to use special names and etc with special characters

raw gull
#

oh. i had written my own chat completions code

#

it was a wild weekend in may lol

near kindle
#

lol

raw gull
#

and now we want the bot in a server i'm in

#

it was working great on the old version with my changes, except that it's not using the async open ai client and i was getting heartbeat interrupted errors

#

i am going to mess with it this weekend

near kindle
#

yeah async client is definitely important for heartbeat interrupted errors

#

I'm planning on a revamp to this bot in the next week, as well as an upgrade for the dallify bot to dalle-3

#

so be on the lookout for that, I'll fix a lot of the issues with names, stability, etc

raw gull
#

So as I am looking through my old code and the new code I do recall that I had issues with the Prompt render methods. i know it's friday night and i think this is your job if i am judging the openai repo correctly so I will leave you alone for now

#

i will be happy to share any changes i make this weekend

#

🙂

near kindle
#

I'm not really sure what the issue with those are

raw gull
#

So modifying base.py line 81 to "name": message.user.replace(" ", "-"), works but is not imo ideal

#

once i was full caffeinated and compared my chat completions code to yours i realized yours was not the issue

#

🙂

raw gull
#

The ultimate issue is that the name field in the chat completions ai message object has that regex that doesn't support spaces. I can replicate this issue by changing my server name to anything with a space in it and trying to chat with the bot. The issue was a little muddled by the fact that my friend who's been helping me test had not updated his account to the new username, and so discord.py doesn't provide all of the info that I expected

#

I don't know how i would go about creating an issue for the chat completions endpoint

#

Open to advice there

near kindle
#

This is expected behaviour, the name field can't have special characters and spaces

#

But it's an issue for the discord bot since we don't remove special characters in a username when we send their username to the endpoint, so we need toe dit the bot to simplify the user's username string to only letters and numbers, etc, so if you open an issue on the github for the discord bot we can track that and I'll get that in

#

@raw gull does that make sense?

raw gull
#

Yes, I understand. However, I do not see this constraint in any of the documentation for the chat completions endpoint.

The completions API will refer to a user by the string in the "name" field, which should have spaces if their user has spaces in their name, so this still feels kind of like an issue with the completions api. One of my users is "Ben Queen Mineral" and having the bot respond with "Hi BenQueenMineral" or "Hi Ben-Queen-Mineral" or whatever the 'simplification' would be looks weird

#

I had already worked around it by modifying Prompt render_messages to remove the spaces

near kindle
#

There doesnt seem to be a real official way to raise an issue with the upstream API itself, just the libraries (e.g the python library) but that's not what you need since the library doesn't actually control the behaviour of the endpoint, so I would say you should create a forum post on the openai forums for this issue and start a discussion about this

warm kiln
#

hello