Documention for: ai-geteway.r
Created by: sergey
on: 7-Jul-2024
Last updated by: sergey on: 9-Jul-2024
Format: html
Downloaded on: 16-Sep-2024

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(https://github.com/aandrew-me/tgpt) 
program is launched. 
The PHP script has the following content:

<?php
if ($_GET["q"] != "")
 	$q = $_GET["q"];
else
 	if ($_POST["q"] != "")
 		$q = $_POST["q"];
	else die("no quest");
switch($_GET["p"])
{
    case 'blackboxai';
	$p = "--provider blackboxai";
	break;
    case 'koboldai';
	$p = "--provider koboldai";
	break;
    default;
        break;
}
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:

```rebol
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
reter.

>>