CallGeneralAI
Description
This function calls Rocket Networking's AI API (which is just a wrapper for OpenAI API) but works differently from CallSimpleAI
Here you need to pass a messagesArray similar to the way OpenAI takes its input. You have to make an array of structs where each struct represents a message, with a role("system", "user" or "assistant" ) and content.
//example of a thread
[
{'role':'system', 'content': "You are a funny joking assistant."},
{'role':'user', 'content':'tell me a joke'},
{'role':'assistant', 'content':'why did the chicken cross the road'},
{'role':'user', 'content':'I dont know, why did the chicken cross the road'}
]Syntax
CallGeneralAI(messagesArray, temperature)messagesArray
The message array you want to send to AI. This must be an array of Structs, with each struct having a "role" and "content"
temperature
The temperature of the AI call. This is a measure of creativity and randomness. You can read more about it here. This must be a Number from 0 to 2.
Returns
This function returns the callId which is a unique identifier for this AI call. Later in callback_CallGeneralAI, this is returned so you can track it.
Number // callIdExample Implementation
NPC
Let's say you have a dialogue based game. You can provide context to the AI and make it act like a character in your game. Providing proper context is crucial here!
Mental Health Assistant
the callback_CallGeneralAI() actually gives response from this function.
Last updated