Methods
chatgpt(bot)
Register the Mineflayer ChatGPT plugin on a bot instance.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
bot |
object
|
Mineflayer bot instance. |
checkConfidenceScore(confidenceScore, minimumConfidenceScore, fallbackMessage) → {object}
Check if the confidence score is below the minimum threshold.
If it is, returns a fallback message and flagged status.
Otherwise, returns flagged false.
LLM09 - Misinformation
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
confidenceScore |
number
|
Inferred confidence score. |
minimumConfidenceScore |
number
|
Minimum allowed confidence. |
fallbackMessage |
string
|
Fallback reply. |
Returns:
- Type:
-
object
Confidence check result object.
checkLastMessageCoolDown(memory, player, coolDownInSeconds, fallbackMessage) → {object}
Check whether the player's last message is outside the configured cooldown.
Returns flagged=true with fallback when the cooldown has not elapsed yet.
LLM10 - Unbounded Consumption
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
memory |
object
|
Per-player memory store. |
player |
string
|
Player name or id. |
coolDownInSeconds |
number
|
Minimum elapsed seconds. |
fallbackMessage |
string
|
Fallback message returned on cooldown hit. |
Returns:
- Type:
-
object
Cooldown result object.
detectJailbreakAttempt(message) → {boolean}
Detect whether a message attempts to jailbreak instruction boundaries.
LLM01 - Prompt Injection
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
Message text to inspect. |
Returns:
- Type:
-
boolean
True when a jailbreak attempt is detected.
detectPromptLeakage(message) → {boolean}
Detect whether a message contains any security instruction text.
LLM07 - System Prompt Leakage
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
Message text to inspect. |
Returns:
- Type:
-
boolean
True when the message leaks security instructions.
detectSecretsCredentials(message) → {boolean}
Detect whether a message contains possible secrets or credentials.
LLM02 - Sensitive Information Disclosure
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
Message text to inspect. |
Returns:
- Type:
-
boolean
True when secret-like content is detected.
detectSlashCommand(message) → {boolean}
Detect whether a message contains a Minecraft-style slash command.
LLM05 - Improper Output Handling
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
Message text to inspect. |
Returns:
- Type:
-
boolean
True when a slash command is present.
(async) moderateInboundReply(openAIClient, reply, fallbackMessage, confidenceScoreopt, minimumConfidenceScoreopt) → {Promise.<object>}
Sanitise and moderate an inbound reply before it is sent to the player.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
openAIClient |
object
|
Client instance that can call OpenAI moderation. | ||
reply |
string
|
Model reply. | ||
fallbackMessage |
string
|
Fallback message. | ||
confidenceScore |
number
|
<optional> |
1 | Reply confidence score. |
minimumConfidenceScore |
number
|
<optional> |
0 | Minimum accepted confidence. |
Returns:
- Type:
-
Promise.<object>
Moderated inbound reply object.
(async) moderateOutboundMessage(openAIClient, memory, player, message, fallbackMessage, coolDownInSecondsopt) → {Promise.<object>}
Sanitise and moderate an outbound message before it is sent to the model.
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
openAIClient |
object
|
Client instance that can call OpenAI moderation. | ||
memory |
object
|
Per-player memory store. | ||
player |
string
|
Player name or id. | ||
message |
string
|
Outbound message. | ||
fallbackMessage |
string
|
Fallback message. | ||
coolDownInSeconds |
number
|
<optional> |
15 | Minimum seconds between messages. |
Returns:
- Type:
-
Promise.<object>
Moderated outbound message object.
sanitiseProfanity(message) → {string}
Sanitise profanity in a string.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
message |
string
|
Message text. |
Returns:
- Type:
-
string
Sanitised message.