Difference between revisions of "Bot Playground/AI/Conversation.chat"
From SmartBots Developers Docs
								| (5 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}}  | {{DISPLAYTITLE:{{SUBPAGENAME}}}}  | ||
| − | <onlyinclude>  | + | <onlyinclude>Sends a chat message request to bot AI within a conversation with a specific resident.</onlyinclude>  | 
<syntaxhighlight lang="javascript">  | <syntaxhighlight lang="javascript">  | ||
Conversation.chat(message[, options])  | Conversation.chat(message[, options])  | ||
| Line 12: | Line 12: | ||
{{API Variable|message|yes}} chat message to the bot  | {{API Variable|message|yes}} chat message to the bot  | ||
{{API Variable|options|optional}} configuration directives for the AI engine. Example:  | {{API Variable|options|optional}} configuration directives for the AI engine. Example:  | ||
| − | <  | + | <syntaxhighlight lang="javascript">  | 
{  | {  | ||
      // Main configuration instructions for the AI: role, behavior, response rules etc.  |       // Main configuration instructions for the AI: role, behavior, response rules etc.  | ||
| Line 19: | Line 19: | ||
      // Maximum number of tokens to generate in response  |       // Maximum number of tokens to generate in response  | ||
      maxResponseTokens?: number;  |       maxResponseTokens?: number;  | ||
| + | |||
| + |      // Max number of response in bytes. SL IM has a max limit of 1023bytes.  | ||
| + |      maxResponseBytes?: number;  | ||
}  | }  | ||
| − | </  | + | </syntaxhighlight>  | 
{{API Variable Group|Output}}  | {{API Variable Group|Output}}  | ||
{{API Variable|same value as Bot.AI.chat(...)}} This command returns the same value as Bot.AI.chat(...)  | {{API Variable|same value as Bot.AI.chat(...)}} This command returns the same value as Bot.AI.chat(...)  | ||
{{API Variables Table End}}  | {{API Variables Table End}}  | ||
| + | |||
| + | <blockquote>  | ||
| + | *Note: The `instructions` and `maxResponseTokens` settings are hard-coded in user settings. They do not need to be explicitly created for user settings. Instead, these values should be fetched from `userSettings.instructions` and `userSettings.maxResponseTokens` and included in the configuration.  | ||
| + | </blockquote>  | ||
{{NavMenu}}  | {{NavMenu}}  | ||
Latest revision as of 11:16, 22 January 2025
Sends a chat message request to bot AI within a conversation with a specific resident.
Conversation.chat(message[, options])
Reference
This command accepts the following parameters:
| Variable | Required |  Description
 
  | |
|---|---|---|---|
| Input: | |||
| message | yes | chat message to the bot | |
| options | optional |  configuration directives for the AI engine. Example:
{
     // Main configuration instructions for the AI: role, behavior, response rules etc.
     instructions?: string;
     
     // Maximum number of tokens to generate in response
     maxResponseTokens?: number;
     // Max number of response in bytes. SL IM has a max limit of 1023bytes.
     maxResponseBytes?: number;
}
 | |
| Output: | |||
| same value as Bot.AI.chat(...) | This command returns the same value as Bot.AI.chat(...) | ||
- Note: The `instructions` and `maxResponseTokens` settings are hard-coded in user settings. They do not need to be explicitly created for user settings. Instead, these values should be fetched from `userSettings.instructions` and `userSettings.maxResponseTokens` and included in the configuration.