[FREE] ROBLOX Mistral 7b AI Chatbot Agent: Aware, Infinite Agents, 2000+ Emojis, 100+ Emotes, Memories, Wikipedia, 32k Context [Open Sourced]

Chatbot Demo.rbxl (657.1 KB)
This is a place file that is already set up, requires only that you:
Get your Free API token from Huggingface profile settings and insert it here as shown in the image!


Publish the place and make sure you have HTTP requests enabled! To Disable a feature you can set the variable to false!

You’re maybe thinking this is just another chatbot module?
All supporting modules were written by me, and held to extremely high standards of performance and organization, as well as understandability. Only code I didn’t write is the except the custom Animation Implementation that allows you to play animations created by another creator.

features={aware=true,wiki=true,music=true,emoji=true,emote=true,memory=true}

Feature Overview:

Aware : This gives the chatbot awareness of its surroundings by synthesizing Text Descriptions of the surroundings.

Wikipedia Summarization : If you say lookup or search it will attempt to inject a wikipedia page into the system message for more accurate results using a simplified Eliza chatbot ripe for improvement and inject it into the LLMs system message for one chat turn.


How it works entry from wikipedia inserted to the response when a search query is recognized.
This is the system message.

Emoji : Intelligently inserts emojis into a string. Using a Massive Emoji Dataset created by me and ChatGPT mapping 2400 emojis to over 14,000 words. Completed and designed for inference.

Emote : Using another creators module’s custom Animation implementation, over 100 animations each chosen intelligently for the input. Uses dataset of text descriptions of emotes to make decision based on the input.

Memory : Chatbots are designed to have seamless persistent memories between visits. Designed to be simple to use, Uses ROBLOX DataStores, very efficient, only load Character Memories as needed, multi-server compatible.

Multiple Agents : Have as many characters as you like each character has different context and memories and the Demo supports as many different characters as you want.

Secure : All data is processed safely on the server to prevent any impact on the client via huggingface inference API, memories are stored via ROBLOX data stores.

High-Quality Code : All the code is very performant, simple to understand and implementation using the main modules was written exclusively for this Open Source Release. All of the modules have been released as Open-Source by me and this is a culmination of those projects. Demonstrating what I would like to give other developers the insight to do.

This is a side project, my main project is private, I do use all of these modules though.


Chatbot Demo.rbxl (657.1 KB)

!DISCLAIMER!
I am not responsible for any misuse of this code. Use AI Tools ethically and responsibly follow ROBLOX’s terms and conditions.

Forgot to mention, this sample place includes my Boids library to add some birds and bees to the skies for the AI to experience via its awareness.
“Boids” Flocking Swarming Simulation Luau Algorithm - Library Animated Bird+Bats+Insects V.1.3 [Open Source] FREE MODEL - Resources / Community Resources - Developer Forum | Roblox
If you enjoy this, show your support by leaving a like!

Interesting thing to note is I asked the chatbot what does it think of its surroundings and it said it can see.

27 Likes

im Having a couple of issues.


Also how can i edit this to make it for my use like without awareness or emoji. I really only need text generation and thats all.

4 Likes

can i get like a place file of just text generation using your thing
Chatbotsetup (1).rbxm (4.8 KB)
All i really want is a baseplate and a way to interact with the chatbot thats all.

3 Likes

I really :bird: enjoy this chat-bot :star: module. I also see a :broccoli: grass under you.

7 Likes

To get a FREE huggingface token
First click the bars icon

Click Profile

image

Select Settings

image
Create your access token for read access!

Then you are done copy and paste the token to this location

.

Also in that section is the endpoint variable, to change it to use Zephyr 7b simply change it to:

local endpoint= "https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta"

You may need to disable memory feature due to Zephyrs short context window.

3 Likes

It says attempt to index nil with generated_text

3 Likes

also authorization header is invalid. it says

3 Likes

that is the problem with your syntax of your HF token

local header="Bearer "--single space.
local apiKey=header.."Insert_API_Key_Here"

‘authorization header is invalid’ is definitely your API key further question DM me.

1 Like

Oh it finally worked my api key was set to finegrained not read

3 Likes

Also, what do you mean by tools. And can i just copy the scripts into my game and it will work properly?

2 Likes

Their’s a Player script in starterplayerscripts, something in replicated storage and one thing in serverscriptservice. So yes you can copy and paste into your game. Only caveat is your have a directory names NPCS or you can replace that name with something else, this is for NPC targeting since the demo allows you to talk to multiple agents.

1 Like

Update on the description
Wikipedia Summarization : If you say lookup or search it will attempt to inject a wikipedia page into the system message for more accurate results .

Final thing hopefully. How do i change the personality of the ai and the messages it says like you know how it puts a fact about roblox at the end of each thing? I want to just make it the generrated text and change its personality from like happy to angry or something.

2 Likes

Also is the memory for every person like if 1 person tells it something and another person asks what the chatbot was just told?

1 Like

Or is it per person. Also does it save when the server is shut down.

1 Like

It uses a simple search feeature powered by Eliza it injects wikipedia article to it system message when you say search for or lookup. Also the memories are stored in folders in generated folders named the npc and grouped by keys of the player and npc. It loads in memories as they are needed given the npcs data store key. The memory handler system is pretty good ported from my main code, rewritten for a side project and simplified implementation here on this project. =]
So their should be no mixing of context windows. Also it saves whenever the data changes and loads before saving but only once every 60 seconds. by a while loop initialized by the memory.handler() function. It does this by having a table of a local data change signals along with a global signal that triggers saving. You can take a look at the code for yourself. Located in the memorymodule.

The default system message is “Your name is “…npcname…”, you are an agent in ROBLOX.” to change this you can find that line and change it or you can add a string to the end of the system_message vairable inside the query function where it processes input by getting memories, determining wether to uses the wiki and processes output

system_message..=" You are a companion who's avatar has an AI that is beside the player as their party member in a fantasy RPG game. "

It only responds to once player at a time. the user addressing it. this can be changed to allow multiple people o query the model at once.

can i get rid of eliza and wiki

and where is the system_message

features={aware=false,wiki=false,music=false,emoji=false,emote=false,memory=true}

will disable those features if you wish disable all of the features that’s fine too, it will still work, designed intentionally to be customizable. The Eliza implementation is very simple. and shouldn’t cause any issues but if you wish to disable it go ahead by setting the features inside the Server script called Chatbot to false.
System message is in the query function inside the ServerTextProcessor module where the input and output is processed. You can change it further or replace it, I recommend that you copy and paste a new function before you start messing with the old one and name the old function queryLegacy.
Also Eliza is the wiki function recognizes queries by search for or lookup helping you research various topics :slight_smile:

At least it worked for sure idk