Introduction
The ChatGPT object provides a simple interface for sending prompts to an integrated ChatGPT service and receiving generated responses directly within YASS.
Internally, this object communicates with the ZPE ChatGPT core component and returns the model's response as a string.
The typical workflow is:
- Create a new ChatGPT instance
- Call
send_messagewith a prompt - Receive the generated response as a string
All functions exposed by this object require a permission level of 0.
ChatGPT object functions
The following is a list of internal functions the ChatGPT object exposes. All functions are ZPEObjectNativeFunctions therefore run in native code.
-
send_message(string message) ⇒ string | boolean - Sends a message (prompt) to the ChatGPT service and returns the generated response as a string. If an error occurs, the function returns false.
Examples
The following example sends a simple prompt and prints the response:
$ai = new ChatGPT() $response = $ai->send_message("Explain Ohm's law in one sentence.") if ($response != false) print($response) else print("An error occurred while contacting ChatGPT.") end
This example shows how it might be used to generate code dynamically:
$ai = new ChatGPT() $code = $ai->send_message("Write a function to calculate factorial in YASS.") print($code)
Notes:
- Return type: On success, a string is returned. On failure, the function returns false.
- Error handling: Always check the return value before using it.
- Use cases: This object can be used for generating explanations, code, documentation, summaries, or other AI-assisted tasks directly inside ZPE.

There are no comments on this page.
Comments are welcome and encouraged, including disagreement and critique. However, this is not a space for abuse. Disagreement is welcome; personal attacks, harassment, or hate will be removed instantly. This site reflects personal opinions, not universal truths. If you can’t distinguish between the two, this probably isn’t the place for you. The system temporarily stores IP addresses and browser user agents for the purposes of spam prevention, moderation, and safeguarding. This data is automatically removed after fourteen days. Your email address is stored so that replies can be sent to your email address.
Comments powered by BalfComment