Add user message
Line 5: | Line 5: | ||
== Parameters == | == Parameters == | ||
− | '''User Message:''' The | + | '''User Message:''' The text input by the user to be added to the conversation. |
− | '''Agent Name:''' (optional) The name of the agent whose conversation we are adding to. Default is "ChatGPT". | + | '''Agent Name:''' (optional) The name of the agent whose conversation we are adding to. Default is "ChatGPT". This is useful when handling multiple agents within one script. |
== Example == | == Example == | ||
<pre> | <pre> | ||
− | config openai(" | + | config openai("your api key here") |
− | create chat gpt agent(" | + | create chat gpt agent("AdviceBot","You are AdviceBot, a friendly helper who's always ready to give advice.","gpt-4")add user message("I'm feeling a bit low today", "AdviceBot") |
− | add bot message("I'm | + | add bot message("I'm here for you. It's perfectly okay to have bad days. Just remember, every day is a new start. Could listening to some calming music help lift your spirits?", "AdviceBot") |
− | alert($chat gpt response("I | + | alert($chat gpt response("I'll try that, thank you","AdviceBot")) |
</pre> | </pre> | ||
− | + | In this example, we replace "your api key here" with our actual API key, and always set the '''Agent Name''' to "AdviceBot". Since some commands will default to ChatGPT, it's important to always change this parameter to our desired bot name. We could also create the bot with the name ChatGPT and then use the default bot names in the rest of the script. | |
− | + | The output of this script will be different every time, but could look something like: | |
− | + | <blockquote>AdviceBot: I'm glad I could help, even if just a bit. Enjoy the music. And remember, it's okay to reach out to others when you're feeling low. You don't have to do this alone.</blockquote> | |
− | The output of this script will be different every time, but | + | |
− | <blockquote> | + | |
− | + | ||
− | </blockquote> | + |
Revision as of 19:38, 30 June 2023
add user message command adds a user message to the conversation for a given agent.
The command helps in creating a conversation with bot agents by adding messages on behalf of the user. Combined with the add bot message, this is a powerful method to help shape the way that ChatGPT generates responses.
Parameters
User Message: The text input by the user to be added to the conversation.
Agent Name: (optional) The name of the agent whose conversation we are adding to. Default is "ChatGPT". This is useful when handling multiple agents within one script.
Example
config openai("your api key here") create chat gpt agent("AdviceBot","You are AdviceBot, a friendly helper who's always ready to give advice.","gpt-4")add user message("I'm feeling a bit low today", "AdviceBot") add bot message("I'm here for you. It's perfectly okay to have bad days. Just remember, every day is a new start. Could listening to some calming music help lift your spirits?", "AdviceBot") alert($chat gpt response("I'll try that, thank you","AdviceBot"))
In this example, we replace "your api key here" with our actual API key, and always set the Agent Name to "AdviceBot". Since some commands will default to ChatGPT, it's important to always change this parameter to our desired bot name. We could also create the bot with the name ChatGPT and then use the default bot names in the rest of the script.
The output of this script will be different every time, but could look something like:
AdviceBot: I'm glad I could help, even if just a bit. Enjoy the music. And remember, it's okay to reach out to others when you're feeling low. You don't have to do this alone.