How ServerAssistantAI Works

This section explains how ServerAssistantAI functions in-game and on Discord, providing insight into the plugin's question detection, response generation, and interaction with players.

In-game Functionality

In Minecraft, players can send a message directly in the public chat, force the bot to reply by including the AI's full name (specified in the bot_name field) within the sentence, or ask privately using the /serverassistantai ask (question) command. If the AI is forced to respond to a message when its name is included in a public message or when the '/serverassistantai ask (question)' command is used, ServerAssistantAI will always generate a response.

When a player sends a message in the Minecraft public chat without forcing the AI to respond, ServerAssistantAI first checks if the sentence is over the minimum_words threshold and if the user has not exceeded the daily_limit set in the config. If both conditions are met, the question detection system then analyzes the message to determine if it is a question. The question detection system can be set to "simple" or "advanced" mode in the config.yml file under minecraft.question_detection.provider.

  • In "simple" mode, the plugin uses a basic combination of question keywords to detect questions.

    • If only regex is set, the plugin will match the regex with the message. If the message matches, it will consider it a question.

    • If only interpersonal_regex is set, the plugin will first run a quick keyword check (what, where, when, why and how) on the message, If a keyword is included, it will run the interpersonal regex, if it matches it will not consider this a question.

    • If both regex and interpersonal_regex are set, the plugin will first run the regex, if it matches it will run the interpersonal regex. If the interpersonal regex doesn't match it will consider it a question, otherwise it is not a question.

  • In "advanced" mode, the plugin uses a custom-trained model to detect questions more accurately, reducing false positives and false negatives. This mode requires the advanced question detection addon to be installed. The model can be tested on our online interface here.

    • When the advanced mode is enabled, the interpersonal_regex field will be ignored, but the regex field will still work in conjunction with the advanced question detection model.

    • Users can configure additional settings in the question_detection section of the config.yml file, such as debug (default: false) and minimum_probability (default: '70'). These settings are optional and will use their default values if not specified.

    • The debug setting, when enabled, shows the detection result of each message written in chat, along with the time in milliseconds it took to process the message.

    • The minimum_probability setting sets the minimum probability threshold for a message to be classified as a question. Messages with a question probability below this value will not be considered as questions.

If the message is classified as a question, the plugin checks the cached embeddings generated from the content in document.txt to see if the relevant information is available.

  • The min_score setting in the config.yml file defines the minimum similarity score required for a chunk to be considered related to the question. Chunks with scores below this threshold will be excluded from the prompt.

  • The max_results determines the maximum number of chunks (relevant pieces of information) that will be included in the prompt sent to the AI model. These chunks are selected based on their similarity to the player's question.

  • If the question's information is found in the document and the relevant chunks meet the min_score requirement, or if the question is related to Minecraft, or if the bot is forced to answer by mentioning its full name, the plugin sends the question along with the relevant chunks (if any) to the chosen AI provider specified in the config.yml file. The AI assistant then generates a response and sends it to the player immediately.

  • If no relevant information is found or the chunks don't meet the min_score threshold, the question is ignored, and no response is generated.

Players can also mention the full name of the bot (configurable in the bot_name setting) in a message to force the bot to always reply, even if the message is not a question. When the bot is not forced to answer (i.e., the player hasn't mentioned the bot's name), and a question is detected with related content in the document, a specific statement is added to the end of the prompt. This statement is customizable in the ignore_question setting in the config.yml file. By default, it states that if the question is not directly related to the server or the provided context, the AI should reply with "[IGNORE]". The ignore_keyword setting in the config defines the keyword used to ignore any message containing it from being sent in-game.

Discord Functionality

In Discord, players can send a message in a channel specified in the channel_id field in the config or mention the bot in any channel where it has the necessary permissions. When a player sends a message using either method, ServerAssistantAI first checks if the sentence is over the minimum_words threshold and if the user has not exceeded the daily_limit set in the config. If both conditions are met, the bot checks the cached embeddings generated from the content in document.txt to see if any relevant information is available.

  • The min_score and max_results settings in the Discord prompt configuration section of the config.yml file works similarly to the in-game functionality, determining the minimum similarity score required for a chunk to be considered related and the maximum number of relevant chunks to include in the prompt sent to the AI model.

  • The plugin sends the question along with the relevant chunks (if any) to the chosen AI provider specified in the config.yml file. The AI assistant then generates a response and sends it to the user immediately.

If the user has the skip keyword role that is set within skip_keyword_roles in config.yml, and uses the bypass keyword set in skip_keyword within the config, the bot will not respond to that specific message. This is useful when replying to someone else's message in the question channel.

Players can also mention the bot in other channels where it has the necessary permissions, and it will respond only to the specific message in which it was tagged. The max_history setting in the config determines the number of previous messages in the channel that will be sent along with the question to provide further context for the conversation, if needed.

By understanding how ServerAssistantAI works, server owners and administrators can better configure and customize the plugin to suit their specific needs and provide an enhanced experience for their players.

Last updated