Chat gpt response

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
'''$generate gpt response''' is a function that 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.
  
The function uses the specified agent to generate a text response for 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 ==
 
== Parameters ==
  
'''Input Prompt:''' The prompt text that you want the agent to respond to.
+
'''Input Prompt:''' The prompt is a piece of text that the GPT agent will generate a response to.
  
'''Agent Name:''' This refers to the name of the agent that will generate the response. The default agent 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 ==
 +
This function returns a string - the response generated by the GPT agent to the input prompt.
  
A string containing the agent's response to the input prompt.
+
== Example ==
 
+
== Usage ==
+
 
+
 
<pre>
 
<pre>
$generate gpt response("Tell me a joke.", "ChatGPT")
+
ui console view
 +
config openai("your api key here")
 +
set(#first prompt,"Hey, I have some questions about tacos. Can I ask them?","Local")
 +
log("User: {#first prompt}")
 +
log("ChatGPT: {$chat gpt response(#first prompt,"ChatGPT")}")
 +
set(#second prompt,"What\'s the best salsa to use?","Local")
 +
log("User: {#second prompt}")
 +
log("ChatGPT: {$chat gpt response(#second prompt,"ChatGPT")}")
 
</pre>
 
</pre>
  
In this example, the ChatGPT agent will generate a response to the prompt "Tell me a joke." The function will then return this response as a string.
+
Do remember to replace "your api key here" with your actual API key.
 +
 
 +
The output of this script will vary each time it is run, but it might look something like:
 +
<blockquote>
 +
<p>User: Hey, I have some questions about tacos. Can I ask them?</p>
 +
<p>ChatGPT: Of course! I'd be happy to answer any questions you have about tacos. What would you like to know?</p>
 +
<p>User: What's the best salsa to use?</p>
 +
<p>ChatGPT: The best salsa for tacos is a matter of personal preference and can vary depending on the type of tacos you are making. Here are some popular options:</p>
 +
<p>1. Salsa Roja: This is a classic red salsa made with tomatoes, onions, garlic, and chili peppers. It's medium to hot in spice level and pairs well with a variety of tacos.</p>
 +
<p>2. Salsa Verde: Made with tomatillos, green chili peppers, onions, and cilantro, this tangy and slightly spicy salsa is perfect for adding a vibrant and fresh flavor to your tacos.</p>
 +
<p>3. Pico de Gallo: Also known as salsa fresca, pico de gallo is a chunky salsa made with diced tomatoes, onions, cilantro, jalapeños, and lime juice. It adds a crisp texture and a bright, tangy flavor to your tacos.</p>
 +
<p>4. Chipotle Salsa: If you like smoky and spicy flavors, chipotle salsa is a great choice. It's made with chipotle peppers, tomatoes, onions, garlic, and spices, and adds a smoky kick to your tacos.</p>
 +
<p>Ultimately, the best salsa is the one that complements the flavors in your tacos and suits your taste preferences. Feel free to experiment with different salsas to find your favorite combination!</p>
 +
</blockquote>

Latest revision as of 19:34, 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.

[edit] 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".

[edit] Return Value

This function returns a string - the response generated by the GPT agent to the input prompt.

[edit] Example

ui console view
config openai("your api key here")
set(#first prompt,"Hey, I have some questions about tacos. Can I ask them?","Local")
log("User: {#first prompt}")
log("ChatGPT: {$chat gpt response(#first prompt,"ChatGPT")}")
set(#second prompt,"What\'s the best salsa to use?","Local")
log("User: {#second prompt}")
log("ChatGPT: {$chat gpt response(#second prompt,"ChatGPT")}")

Do remember to replace "your api key here" with your actual API key.

The output of this script will vary each time it is run, but it might look something like:

User: Hey, I have some questions about tacos. Can I ask them?

ChatGPT: Of course! I'd be happy to answer any questions you have about tacos. What would you like to know?

User: What's the best salsa to use?

ChatGPT: The best salsa for tacos is a matter of personal preference and can vary depending on the type of tacos you are making. Here are some popular options:

1. Salsa Roja: This is a classic red salsa made with tomatoes, onions, garlic, and chili peppers. It's medium to hot in spice level and pairs well with a variety of tacos.

2. Salsa Verde: Made with tomatillos, green chili peppers, onions, and cilantro, this tangy and slightly spicy salsa is perfect for adding a vibrant and fresh flavor to your tacos.

3. Pico de Gallo: Also known as salsa fresca, pico de gallo is a chunky salsa made with diced tomatoes, onions, cilantro, jalapeños, and lime juice. It adds a crisp texture and a bright, tangy flavor to your tacos.

4. Chipotle Salsa: If you like smoky and spicy flavors, chipotle salsa is a great choice. It's made with chipotle peppers, tomatoes, onions, garlic, and spices, and adds a smoky kick to your tacos.

Ultimately, the best salsa is the one that complements the flavors in your tacos and suits your taste preferences. Feel free to experiment with different salsas to find your favorite combination!

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox