Script Library: 1240 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: sergey

Documentation for: ai-geteway.r

This feature is designed to allow programs to send requests to artificial 
intelligence (AI) and receive a response from it. The following three 
AI models are available for use: 'BlackBox', 'koboldcpp/HF_SPACE_Tiefighter-13B', 
and 'Phind'. Default uses Phind model.

On the server side, the tGPT( 
program is launched. 
The PHP script has the following content:

if ($_GET["q"] != "")
 	$q = $_GET["q"];
 	if ($_POST["q"] != "")
 		$q = $_POST["q"];
	else die("no quest");
    case 'blackboxai';
	$p = "--provider blackboxai";
    case 'koboldai';
	$p = "--provider koboldai";
system("./tgpt -w -q  ".$p."  '".$q."'>a");
echo file_get_contents("a"); 

Example request:

>> print ai "How to invert a string in Rebol"

To invert a string in Rebol, meaning to reverse its order, you can 
use the `reverse` function. Here's how you can do it:

string-to-invert: "Here is text for the context:"
inverted-string: reverse string-to-invert

print inverted-string

This code snippet defines a string `string-to-invert` with the value 
`"Here is text for the context:"`, then uses the `rever

se` function to create a new string `inverted-string` which is the 
reversed version of the original string. Finally, it prin
ts out the inverted string.

If you want to see this in action within your VSCode environment, 
make sure you have Rebol installed and configured correctl

y in your development setup. Then, you can simply paste this code 
into a `.r` script file and run it using your Rebol interp