wow this was such a good to follow tutorial, any plans for another one that shows how to incorporate a seperate database like an obsidian vault that the AI can use for thread pointers? im really excited to implement this into my server but im so scared to have everyone bond with it only to lose its context every reload/reboot
Thank you so much! That is a good point - and I've heard other concerns too which relate to not being able to send multiple messages at the same time. I didn't have plans to make a second one yet, but will have to think about it :)
@@VoloBuilds right! We've been experimenting on that other problem by including something like "# user:name" in every message a human sends in the server but that's not a long term solution anyway unless that's automated. Anyway I appreciate your response and am keeping my eye on your channel for updates on this and your other projects c:
@@VoloBuilds some progress was made and since this tutorial started the whole endeavour i figured id give a little update: for longterm context we now have the bot write locally to a thread pointer file, which contains the id for the discord channel and links it to specific threads.! It works really well and its now reboot and crash proof 🙏 thanks again volo. I really appreciate what you tought us!
Hey that's a really good idea@@Suushidesu! Yeah I think a local file is a perfectly good solution - especially if you don't have like thousands of users or something. If it got too high, you could start to use a distributed database, but I love that you chose a less complicated solution first! Glad to hear your project is going well!
Thanks a lot! Followed all your instructions to the T after failing and wasting time checking out other blogs and tutorials. You Rock! I have my own custom bot installed now. Wondering if you made a video on the sessions / user / thread database storage? I would love to be able to accomplish that now. Thanks again!
That's awesome! Glad it was helpful! :) I haven't made that follow-up and probably won't at this point so it's a good opportunity to challenge your skills and expand on this code!
That might be fun to revisit at some point! The assistants API is still unmatched in terms of developer experience and friendliness - so I would still use it but could rebuild with Cursor :)
@volo Great tutorial, thank you! Can you provide an update in the Git for the V2. For some reason I don't get it to work using the V2 header for example. That would be amazing!
Hey! Thanks for watching - I haven't played around with V2 just yet. I am not very active in maintaining (sorry, just too much stuff going on 😅) but if you make a small PR that addresses the specific issue I am happy to merge
@@VoloBuilds Hey, great video thankyou so much! Just to popup about the question that was asked by @illlilllilllill409, you will need to remove the older openai module from the package lock file and allow updated packages for it to work with V2 header, alternative to that would be using axios and following the v2 documentation on openai documentation, works both ways!
Great tutorial!! My assistant works great on my server! idk ANYTHING about coding and was able to get it up and running! That being said, i am now stuck on something 😂Im running this out of vscode on my desktop and was wondering if theres a way to have it work without my pc being on.
That's awesome!! Glad you were able to get it working! I would look into Replit as a potential platform for more or less easily deploying/hosting a bot like this!
Is Replit better than Google Cloud? I am also a newbie and don't know much about this. I want to create a database for the sessions and threads as well. @@VoloBuilds
Nice!! I'd love to see an open source version of these abstractions. They make a lot of sense to me. Perhaps LangChain will pivot towards this? Or perhaps someone will build something new? Good opportunity here
This was working great for me, but I changed the OpenAI API key, and the program isn't seeing the new key. It tries to use the old one, which is rejected every time because it's been deleted. Any idea how to fix this?
Hey there - where are you running the code? If you deployed it to a cloud service or something make sure the env change is present there as well. Either way, make sure to restart the application after making .env changes for them to take effect
@@VoloBuilds Awesome I can't wait! I have files uploaded to the Assistant ID I used for this bot, but for some reason every time I create a prompt to access the files, the bot can't access all of the files and it takes forever to respond. I did manage to create split messages in my code tho which is pretty cool, when the bot gets close to a 2000 characters it's splits the message in 2
@@dylanbritz1333 Sounds like I'm in for some deep exploration working with the files then lol! Hey that's a brilliant idea with the message split! Would be happy to merge into my repo if you want to make a PR ;)
@@VoloBuildsI'd be honored to! But by implementing that solution I encountered another problem, every time I give the bot a message it responds with 2 messages 🥲 I'm still pretty much a rookie when it comes to coding but ChatGPT has been a massive help 😂
Hey! So I was able to get a discord bot going real quick, but the bot shuts down if there are two requests sent before it answers the first one. Is there an easy way to fix this?
Oh that's interesting - I wonder why that would happen.. If you don't mind, could you open an issue on GitHub with the details of what you're seeing? I could take a look then and see if I can reproduce it!
Hi! thanks for the tutorial, I got the bot working! I didn't implement the changes after 17:20, but the bot seems to be working fine without it. am I missing something?
I think the bot can work without those changes but depending on what you wrote, you might be missing the relevant context of the full thread. I linked the code in the description, so you could check it out there if you're still not sure!
You would need to implement this in your backend server logic - probably by adding a token counter and then tracking overall usage in your DB. OpenAI has been improving this side of things though so I wouldn't be surprised if they add a native feature to do this in their platform at some point!
Absolutely! OpenAI actually unlocked custom GPT creation for everyone yesterday so (even though the store doesn't exist yet) so I'll be building a custom GPT in one of my next couple of videos! Thanks for watching!
Hi Volo, I have create a discord bot, and used your openAI assistant code. Also I upload my knowledge base for it. But it seems have a large usage, just 2~3 questions, 1 $ used....Is that normal?
That seems likely to be related to the knowledge base size. They have the cost for that published and it's kind of confusing. $1 for 2-3 questions seems high unless you have this thing pumping out a huge amount of output
@@VoloBuilds thanks for your feedback! Very helpful! I did upload a huge knowledge base, even in ppt and picture formats, and I thought I should simplify them? Because every question means searching this huge knowledge base, right?
@@CanuteTang Cleaning up the data before loading is definitely recommended! Both for accuracy and cost purposes. It'll make it easier for the model to find what it needs to use it. The entire knowledge base is not passed into each prompt and the specifics of OpenAI's retrieval approach are not public, but the simple way to think about it is -> more data = more cost, messier data = more cost
Yep, I do! ua-cam.com/video/JzxUW0ZT4to/v-deo.html the intro is a bit quirky as I got carried away being creative 😅 but I go over the files API in there!
@@VoloBuilds thanks for your help! i am trying to develop a billing system for my Assistant, but I can't figure out how to get a cost breakdown per Assistant, it just shows a cost breakdown per model. It does show the number of queries per assistant, but not the number of tokens. this seems rather deficient! how would you approach this problem Volo?
@@mracing369 I think this is a limitation of what OpenAI makes available unfortunately. The closest work around I can think of is to add your own logic to count tokens in your code - maybe using something like this: www.npmjs.com/package/@dqbd/tiktoken It's not perfect though because you then have to count input/output separately and do the math on the rate, and you have no visibility into how many tokens it used for retrieving data and such. Maybe it's in the API response json? Not trivial for sure! Let me know if you figure something good out
will do@@VoloBuilds! thanks for the response. i am actually looking at mistral ai as a cheaper alternative. also changing to the cgpt 3.5 1160 model helps to save money.
Hi thank fo the tutorial but you can not folow this tutorial. at the poin that create the bot on discord, there is a missing step and you cannot get the url. Solution that i tried is to add aa Redirect URL in the AUTH 2 to a localhost url but then when you try to link the bot with the server the link does not exist so the not never goes into the server, any solution ?
Not sure what you mean exactly. Will try to clarify the steps: 1. Go to discord.com/developers/applications/ 2. Create app (assuming you got this already done) 3. Check all 3 "Privileged Gateway Intents" boxes in the Bot tab 4. Go to Oauth2 > URL Generator 5. Check the "bot" box (perhaps this is most likely the step you missed?) 6. URL should appear at the bottom of the page. This URL is the URL you can use to invite the bot to your server 7. Go to that URL in the browser and add the bot to your server Where specifically in this flow are you encountering the issue?
@@VoloBuilds thanks for the responce. I am doing exactly that but at least in my discord the lest step where getting the URL does not give a url and you cannot press the save button .
@@kordouHmm that is strange indeed. Seems like a discord problem, maybe with your account? I don't have turbo or anything so I don't think it's that.. Maybe some weird ad block thing? If you want me to take a closer look, please open a github issue with a video attached of what you see when trying to create the discord URL!
If you're talking about a discord server, you need to create one first - those servers are basically communities you can create. If you're talking about the code shown in this tutorial, you would be running it on your local computer which is effectively acting as a server, but to make it work "in production" you'd need to deploy the code somewhere like Replit
I actually have not used flowise myself, just seen tutorials on it from other creators. This tutorial is working with discord directly, so no need to involve flowise. Looks like this tutorial connects discord and Flowise though: ua-cam.com/video/2advCQg3Tcc/v-deo.html&ab_channel=DerekCheung
Sorry to hear that - what seems to be the issue? Since I can't troubleshoot directly, I've found ChatGPT pretty good at pointing me in the right direction with error messages and such, so I would suggest that
I'm not sure how you have it configured, but perhaps you are using some simplified version of the code without the assistants API hooked up to it? The code posted here (github.com/VoloBuilds/openai-assistants-discord-bot/blob/main/bot.js) should not do that, unless your assistant is configured to repeat whatever is said to it!
🌟🌟🌟🌟🌟 Hey buddy Make more exploration in the application of threads and on placing assistants api calls within code when each assistant can run separate parallel threads to completion of any given task and thus Enhance a current simple architectural design of any utility applications around ❤ Note 🌀🌀🌀 Threads videos are not much in UA-cam for the people to explore and learn And you are amazing teacher too 🫵🫡🫡🫡🖖 🌍
Just discovered your channel and subscribed - Will be going through your example myself to connect an Agent to Discord.
Thanks for watching! Best of luck with your implementation!
wow this was such a good to follow tutorial, any plans for another one that shows how to incorporate a seperate database like an obsidian vault that the AI can use for thread pointers? im really excited to implement this into my server but im so scared to have everyone bond with it only to lose its context every reload/reboot
Thank you so much! That is a good point - and I've heard other concerns too which relate to not being able to send multiple messages at the same time. I didn't have plans to make a second one yet, but will have to think about it :)
@@VoloBuilds right! We've been experimenting on that other problem by including something like "# user:name" in every message a human sends in the server but that's not a long term solution anyway unless that's automated.
Anyway I appreciate your response and am keeping my eye on your channel for updates on this and your other projects c:
@@VoloBuilds some progress was made and since this tutorial started the whole endeavour i figured id give a little update: for longterm context we now have the bot write locally to a thread pointer file, which contains the id for the discord channel and links it to specific threads.! It works really well and its now reboot and crash proof 🙏 thanks again volo. I really appreciate what you tought us!
Hey that's a really good idea@@Suushidesu! Yeah I think a local file is a perfectly good solution - especially if you don't have like thousands of users or something. If it got too high, you could start to use a distributed database, but I love that you chose a less complicated solution first! Glad to hear your project is going well!
Thanks a lot! Followed all your instructions to the T after failing and wasting time checking out other blogs and tutorials. You Rock! I have my own custom bot installed now. Wondering if you made a video on the sessions / user / thread database storage? I would love to be able to accomplish that now.
Thanks again!
That's awesome! Glad it was helpful! :) I haven't made that follow-up and probably won't at this point so it's a good opportunity to challenge your skills and expand on this code!
This is a great video! Have you considered maybe making another discord bot using Cursor? Thanks again for all the tutorials!
That might be fun to revisit at some point! The assistants API is still unmatched in terms of developer experience and friendliness - so I would still use it but could rebuild with Cursor :)
@@VoloBuilds A tutorial using Cursor to build the Discord bot with the assistants API would be amazing and super helpful! Thanks for everything!!
I've been waiting for someone to make a video like this!! do you have a discord server?
Glad you enjoyed it! I don't but that's a great idea, so I'll be making one in the coming weeks! :)
@volo Great tutorial, thank you! Can you provide an update in the Git for the V2. For some reason I don't get it to work using the V2 header for example. That would be amazing!
Hey! Thanks for watching - I haven't played around with V2 just yet. I am not very active in maintaining (sorry, just too much stuff going on 😅) but if you make a small PR that addresses the specific issue I am happy to merge
@@VoloBuilds Hey, great video thankyou so much! Just to popup about the question that was asked by @illlilllilllill409, you will need to remove the older openai module from the package lock file and allow updated packages for it to work with V2 header, alternative to that would be using axios and following the v2 documentation on openai documentation, works both ways!
Great tutorial!! My assistant works great on my server! idk ANYTHING about coding and was able to get it up and running!
That being said, i am now stuck on something 😂Im running this out of vscode on my desktop and was wondering if theres a way to have it work without my pc being on.
That's awesome!! Glad you were able to get it working! I would look into Replit as a potential platform for more or less easily deploying/hosting a bot like this!
Is Replit better than Google Cloud? I am also a newbie and don't know much about this. I want to create a database for the sessions and threads as well. @@VoloBuilds
I made a discord bot with mistral 7B (using a drop in for the open ai code) yes this makes it so much easier with the threads
Nice!! I'd love to see an open source version of these abstractions. They make a lot of sense to me. Perhaps LangChain will pivot towards this? Or perhaps someone will build something new? Good opportunity here
I'm not sure I get how Discord accesses your bot which, from what I understand, is running on your local machine. Could you please clarify this point?
Got it - your bot keeps opened connection with the Discord server - this way it can handle requests.
This was working great for me, but I changed the OpenAI API key, and the program isn't seeing the new key. It tries to use the old one, which is rejected every time because it's been deleted. Any idea how to fix this?
Hey there - where are you running the code? If you deployed it to a cloud service or something make sure the env change is present there as well. Either way, make sure to restart the application after making .env changes for them to take effect
GREAT +1 SUB
Thanks for watching!
This video helped a lot thanks man! Can you make a tutorial on how to upload files and access them as well?
Glad it was helpful!! Yes! This is one of the videos I plan to create in the near future :)
@@VoloBuilds Awesome I can't wait! I have files uploaded to the Assistant ID I used for this bot, but for some reason every time I create a prompt to access the files, the bot can't access all of the files and it takes forever to respond. I did manage to create split messages in my code tho which is pretty cool, when the bot gets close to a 2000 characters it's splits the message in 2
@@dylanbritz1333 Sounds like I'm in for some deep exploration working with the files then lol! Hey that's a brilliant idea with the message split! Would be happy to merge into my repo if you want to make a PR ;)
@@VoloBuildsI'd be honored to! But by implementing that solution I encountered another problem, every time I give the bot a message it responds with 2 messages 🥲 I'm still pretty much a rookie when it comes to coding but ChatGPT has been a massive help 😂
Haha yes ChatGPT can be such a great way to learn this stuff! If you do get it working, feel free to open that PR!
fire tutorial, thank you
Thank you!! 😄
Hey! So I was able to get a discord bot going real quick, but the bot shuts down if there are two requests sent before it answers the first one. Is there an easy way to fix this?
Oh that's interesting - I wonder why that would happen.. If you don't mind, could you open an issue on GitHub with the details of what you're seeing? I could take a look then and see if I can reproduce it!
Hi! thanks for the tutorial, I got the bot working! I didn't implement the changes after 17:20, but the bot seems to be working fine without it. am I missing something?
I think the bot can work without those changes but depending on what you wrote, you might be missing the relevant context of the full thread. I linked the code in the description, so you could check it out there if you're still not sure!
your github code worked straight away so i ended up using that anyway :) @@VoloBuilds
Is there any way to limit the amount of token usage?
You would need to implement this in your backend server logic - probably by adding a token counter and then tracking overall usage in your DB. OpenAI has been improving this side of things though so I wouldn't be surprised if they add a native feature to do this in their platform at some point!
Once GPT store is live please make a video on GPT store and how to create custom GPT, love from india
Absolutely! OpenAI actually unlocked custom GPT creation for everyone yesterday so (even though the store doesn't exist yet) so I'll be building a custom GPT in one of my next couple of videos! Thanks for watching!
Could do a similar video or plugin for Slack?
This was a great tutorial. Thank you!
Great suggestion - I got a few more videos planned out currently but will add this to the idea list! Thanks for watching!
@@VoloBuilds I'm gonna second this comment. A slack integration would be extremely helpful within the business!
Hi Volo, I have create a discord bot, and used your openAI assistant code. Also I upload my knowledge base for it. But it seems have a large usage, just 2~3 questions, 1 $ used....Is that normal?
That seems likely to be related to the knowledge base size. They have the cost for that published and it's kind of confusing. $1 for 2-3 questions seems high unless you have this thing pumping out a huge amount of output
@@VoloBuilds thanks for your feedback! Very helpful! I did upload a huge knowledge base, even in ppt and picture formats, and I thought I should simplify them? Because every question means searching this huge knowledge base, right?
@@CanuteTang Cleaning up the data before loading is definitely recommended! Both for accuracy and cost purposes. It'll make it easier for the model to find what it needs to use it. The entire knowledge base is not passed into each prompt and the specifics of OpenAI's retrieval approach are not public, but the simple way to think about it is -> more data = more cost, messier data = more cost
One more question, do you have a tutorial to upload files to my assistance API and train it that way?
Yep, I do! ua-cam.com/video/JzxUW0ZT4to/v-deo.html the intro is a bit quirky as I got carried away being creative 😅 but I go over the files API in there!
@@VoloBuilds thanks for your help! i am trying to develop a billing system for my Assistant, but I can't figure out how to get a cost breakdown per Assistant, it just shows a cost breakdown per model. It does show the number of queries per assistant, but not the number of tokens. this seems rather deficient! how would you approach this problem Volo?
@@mracing369 I think this is a limitation of what OpenAI makes available unfortunately. The closest work around I can think of is to add your own logic to count tokens in your code - maybe using something like this: www.npmjs.com/package/@dqbd/tiktoken
It's not perfect though because you then have to count input/output separately and do the math on the rate, and you have no visibility into how many tokens it used for retrieving data and such. Maybe it's in the API response json? Not trivial for sure! Let me know if you figure something good out
will do@@VoloBuilds! thanks for the response. i am actually looking at mistral ai as a cheaper alternative. also changing to the cgpt 3.5 1160 model helps to save money.
Hi thank fo the tutorial but you can not folow this tutorial. at the poin that create the bot on discord, there is a missing step and you cannot get the url.
Solution that i tried is to add aa Redirect URL in the AUTH 2 to a localhost url but then when you try to link the bot with the server the link does not exist so the not never goes into the server,
any solution ?
Not sure what you mean exactly. Will try to clarify the steps:
1. Go to discord.com/developers/applications/
2. Create app (assuming you got this already done)
3. Check all 3 "Privileged Gateway Intents" boxes in the Bot tab
4. Go to Oauth2 > URL Generator
5. Check the "bot" box (perhaps this is most likely the step you missed?)
6. URL should appear at the bottom of the page. This URL is the URL you can use to invite the bot to your server
7. Go to that URL in the browser and add the bot to your server
Where specifically in this flow are you encountering the issue?
@@VoloBuilds thanks for the responce. I am doing exactly that but at least in my discord the lest step where getting the URL does not give a url and you cannot press the save button .
@@kordouHmm that is strange indeed. Seems like a discord problem, maybe with your account? I don't have turbo or anything so I don't think it's that.. Maybe some weird ad block thing? If you want me to take a closer look, please open a github issue with a video attached of what you see when trying to create the discord URL!
why i am not seeing any server while creating a bot in discord??
If you're talking about a discord server, you need to create one first - those servers are basically communities you can create. If you're talking about the code shown in this tutorial, you would be running it on your local computer which is effectively acting as a server, but to make it work "in production" you'd need to deploy the code somewhere like Replit
Hi Volo, do you do custom work? Freelancing
I do! Send me an email at volobuilds1 @ gmail and we can talk details
how do i go from flowise to discord
I actually have not used flowise myself, just seen tutorials on it from other creators. This tutorial is working with discord directly, so no need to involve flowise. Looks like this tutorial connects discord and Flowise though: ua-cam.com/video/2advCQg3Tcc/v-deo.html&ab_channel=DerekCheung
🔥🔥🔥🔥🔥
😄 Thank you and glad you enjoyed!
@@VoloBuilds Thank you!!!
nodemon bot command does not work
Sorry to hear that - what seems to be the issue? Since I can't troubleshoot directly, I've found ChatGPT pretty good at pointing me in the right direction with error messages and such, so I would suggest that
Yo bud, why is the bot echoing (repeats what I say)
I'm not sure how you have it configured, but perhaps you are using some simplified version of the code without the assistants API hooked up to it? The code posted here (github.com/VoloBuilds/openai-assistants-discord-bot/blob/main/bot.js) should not do that, unless your assistant is configured to repeat whatever is said to it!
Very nice. Thank you for sharing. I send you an email from Getz AI. Look forward to speaking with you.
Glad you enjoyed the video and thanks for reaching out!!
gm Volo I would like to have your help for a role game on the metaverse :D, how can I contact you? Love what you do
Hey there Pablo! Sounds pretty cool :) you can get my email on my channel about page: www.youtube.com/@VoloBuilds/about
@@VoloBuildsI can't see your email on that page.
🌟🌟🌟🌟🌟
Hey buddy
Make more exploration in the application of threads and on placing assistants api calls within code when each assistant can run separate parallel threads to completion of any given task and thus
Enhance a current simple architectural design of any utility applications around ❤
Note 🌀🌀🌀
Threads videos are not much in UA-cam for the people to explore and learn
And you are amazing teacher too
🫵🫡🫡🫡🖖
🌍
Thank you so much!! Really appreciate your ideas!