Chat gpt response
Line 1: | Line 1: | ||
− | '''$chat gpt response''' function generates a response from the specified GPT Agent with the given prompt. | + | '''$chat gpt response''' is a function that generates a response from the specified GPT Agent with the given prompt. |
− | This function | + | This function will keep track of the ongoing conversation, so that every response will contain the full context of what was said before. |
== Parameters == | == Parameters == | ||
Line 7: | Line 7: | ||
'''Input Prompt:''' The prompt is a piece of text that the GPT agent will generate a response to. | '''Input Prompt:''' The prompt is a piece of text that the GPT agent will generate a response to. | ||
− | '''Agent Name:''' (optional) This is the name of the agent who will generate the response. The default is "ChatGPT" | + | '''Agent Name:''' (optional) This is the name of the agent who will generate the response. The default is "ChatGPT". |
== Return Value == | == Return Value == |
Revision as of 17:07, 30 June 2023
$chat gpt response is a function that generates a response from the specified GPT Agent with the given prompt.
This function will keep track of the ongoing conversation, so that every response will contain the full context of what was said before.
Parameters
Input Prompt: The prompt is a piece of text that the GPT agent will generate a response to.
Agent Name: (optional) This is the name of the agent who will generate the response. The default is "ChatGPT".
Return Value
This function returns a string - the response generated by the GPT agent to the input prompt.
Example
config openai("your api key here") create chat gpt agent("MotivationBot","You are MotivationBot, an AI designed to provide motivational insights.","gpt-4") add user message("I find it hard to stay motivated, how can I improve this?", "MotivationBot") alert($chat gpt response("Remember that motivation comes from within. Start with small daily goals and celebrate your achievements!", "MotivationBot"))
Do remember to replace "your api key here" with your actual API key.
Also note that in this example, we always set the Agent Name to "MotivationBot". Since some commands will default to ChatGPT, it's important to always change this parameter to your desired bot name. Alternatively, you can name the bot as ChatGPT during creation and then use the default bot names in the rest of the script.
The output of this script will vary each time it is run, but it might say something like: "Remember that motivation comes from within. Start with small daily goals and celebrate your achievements!"