GPT stands for Generative Pre-trained Transformer. It is a deep learning model based on the Transformer architecture that has been pre-trained on a large corpus of text data. GPT is used for natural language processing tasks such as language modeling, text generation, and question answering.
ChatGPT is an AI-based chatbot developed by OpenAI that can be used in various ways across many industries.
First you need an account:

Second, you need to register an Open AI account,(Note: This is required). Then open website, Log in first. After the login is completed, it is still at the previous website
Then you can use a maXbox script to get access to the server:

Due to the limitation of OpenAI’s official server, the ChatGPT model cannot be used temporarily. So the plugin accesses the GPT3 model. It’s a relatively old model and not very smart. But it can be used normally.
Thats how the code look likes in maXbox or Python:
function TALHTTPClient2_AskChatGPT(feedstream:string;
aResponseHeader:TALHTTPResponseHeader2):string;
Var
poststrm: TStream;
JPostdata, aturl: string;
jo: TJSON;
begin
JPostData:= '{' +
'"model": "text-davinci-003",'+
'"prompt": "%s",'+
'"max_tokens": 2048,'+
'"temperature": 0.3'+
'}';
with TALWininetHttpClient2.create do begin
atUrl:= 'https://api.openai.com/v1/completions';
//RequestHeader.UserAgent:= UAGENT;
RequestHeader.ContentType:= 'application/json';
RequestHeader.Authorization:= 'Bearer '+ CHATGPT_APIKEY2;
try
poststrm:= TStringStream.create(format(JPostData,[feedstream]));
jo:= TJSON.Create();
jo.parse(Post3(atUrl, poststrm, []))
result:=jo.values['choices'].asarray[0].asobject['text'].asstring;
finally
Free;
postStrm.Free;
jo.Free;
end;
end; //with
end;
The ChatGPT API allows developers to integrate ChatGPT into their own applications, products, or services as a result of JSON. The API endpoint for making POST requests is api.openai.com/v1/chat/completions
One important thing is the temperature. Temperature is a hyperparameter used in some natural language processing models, including ChatGPT, to control the level of randomness or “creativity” in the generated text. Higher temperatures result in more diverse and unpredictable output. Conversely, lower temperatures result in more conservative and predictable output.
const genfunc =
'def generate_response(prompt): '+LF+
' response = openai.Completion.create( '+LF+
' engine="text-davinci-002", '+LF+
' prompt=prompt, '+LF+
' max_tokens=60, '+LF+
' n=1, '+LF+
' stop=None, '+LF+
' temperature=0.5, '+LF+
' ) '+LF+
' return response.choices[0].text.strip()';
function Python32_AskChatGPT(feedstream: string): string;
begin
with TPythonEngine.Create(Nil) do begin
pythonhome:= PYHOME;
try
loadDLL;
execStr('import openai');
//https://github.com/sknetwork-team/scikit-network/issues/498
execstr('openai.api_key = "sk-your-api-key"');
execStr(genfunc);
//execStr('connection.request("GET","api.parse.com/echo")');
println(evalStr('openai.version'));
println(evalStr('generate_response("What is the capital of France?")'));
except
raiseError;
finally
unloadDLL;
free;
end;
end;
end;
You can sign up using your email address or Google/Microsoft account.
- After signing up, you will receive a verification email in your provided email address.
- You will also need to verify your account with a mobile number.
- Once you have verified your account, you can generate an API key.
- To generate an API key, log in to your OpenAI account and visit the API keys page.
- Click on your profile in the top-right corner and select “View API Key” to get your key.
- Click on “Create new secret key” to generate a new key. The API key is used to authenticate requests made to the OpenAI API.

procedure PYdemo32;
var frm: TForm; mem: TMemo;
begin
with TPythonEngine.Create(Nil) do begin
pythonhome:= 'C:\Users\breitsch\AppData\Local\Programs\Python\Python37-32\';
try
loadDLL;
execStr('love="ILovemaXbox"');
frm:= TForm.create(self);
mem:= TMemo.Create(frm);
mem.parent:= frm;
mem.color:= clblack;
mem.font.name:= 'Courier'; //a fixed font size.
mem.font.size:= 12;
mem.font.color:= clred;
mem.Align:= alClient;
with frm do begin
position:= poScreenCenter;
caption:= 'PyHeart2';
width:= 600; height:= 500;
//canvas.brush.bitmap
mem.text:=StringReplace(evalStr('"n".join(["".join([(love[(x-y)%len(love)] if((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3<=0 else" ")for x in range(-30,30 )])for y in range(15,-15,-1)])'),'n',
CRLF,[rfReplaceAll, rfIgnoreCase]);
Showmodal;
end;
except
raiseError;
finally
free;
frm.Free;
end;
end;
end;
Conclusion
Natural Language Processing (NLP) has become increasingly popular over the years, and ChatGPT API is one of the most powerful tools to implement NLP. The API provides access to OpenAI’s GPT-3 language model, allowing you to generate natural language responses to any input text. In this blog, we will go through a step-by-step guide on how to use OpenAI’s ChatGPT API in Python and maXbox, along with code examples.
Example: writeln(‘answer6: ‘+TALHTTPClient2_AskChatGPT(‘Why is cold fusion not possible?’, nil));
answer6: Cold fusion is not possible because it is not supported by the laws of physics. Cold fusion would require a reaction to occur at room temperature, which is not possible according to the laws of thermodynamics. In addition, the amount of energy required to initiate a cold fusion reaction is far greater than what is available in the environment.
Limitations
While the world is certainly over the moon for the wonders of ChatGPT, there are certain limitations to what ChatGPT can and cannot do. It is certainly a breakthrough in AI, but the journey to “singularity” may only be in its initial phase. ChatGPT is far from creating human-like intelligence, let alone replacing it.
ChatGPT, Generative Pre-trained transformer, is based on Natural language processing (NLP) which has its own limitations. For example, language models cannot adequately process contextual words, phrases, homonyms, sarcasm, and ambiguity, to name a few. ChatGPT, likewise, performs poorly when inputs are ambiguous or beyond the language model’s processing capabilities.
ChatGPT cannot also process overly complex inputs, slang, or excessive abbreviations.
The problem with false questions: writeln(‘answer6: ‘+TALHTTPClient2_AskChatGPT(‘Why is earth bigger than the sun?’, nil));
answer6: Earth is bigger than the sun because the sun is a star, and stars are much smaller than planets. The sun is about 1.3 million times larger than Earth in terms of volume, but Earth is much more massive than the sun. Earth has a mass of 5.972 x 10^24 kg, while the sun has a mass of 1.989 x 10^30 kg.
Test of Leakage
[maxkleiner/maXbox4] OpenAI API Key exposed on …
Hi there,
Your OpenAI API key was determined to have been leaked, which has triggered a key disable and this friendly notification email.
| AIGuardian has detected the following OpenAI API Key exposed within your … account. Details – Secret type: OpenAI API Key – Repository: maxkleiner/maXbox4 – Pushed date: April 3rd 2023, 14:18:45 UTC |
TRestClient
A Delphi REST client API to consume REST services written in any programming language. The API it is designed to work with Delphi 7 or later. Newer versions takes advantage of Generics Methods.
function TRestResource3_AskChatGPT(askstream: string;
aResponseHeader:TRestResponseHandler):string;
var pstrm: TStream;
JPostdat: string;
jo: TJSON; arest: TRestResource;
begin
JPostDat:= '{'+
'"model": "text-davinci-003",'+
'"prompt": "%s",'+
'"max_tokens": 2048,'+
'"temperature": 0.15}';
with TRestClient.create(self) do begin
arest:= Resource('https://api.openai.com/v1/completions');
arest.ContentType('application/json');
arest.Authorization('Bearer '+CHATGPT_APIKEY2);
ConnectionType:= hctWinInet;
try
pstrm:= TStringStream.create(format(JPostDat,[askstream]));
jo:= TJSON.Create();
jo.parse(arest.Post(pstrm));
writeln('responsecode: '+itoa(responsecode)+' verifycert: '+botostr(verifycert));
result:= jo.values['choices'].asarray[0].asobject['text'].asstring;
finally
Free;
jo.Free;
pStrm.Free;
end;
end; //with
end;
//https://github.com/fabriciocolombo/delphi-rest-client-api/blob/master/src/RestClient.pas

API Types
procedure SIRegister_RestClient(CL: TPSPascalCompiler);
begin
CL.AddConstantN('DEFAULT_COOKIE_VERSION','LongInt').SetInt( 1);
CL.AddTypeS('TRestRequestMethod', '( METHOD_GET, METHOD_POST, METHOD_PUT, METHOD_'
+'PATCH, METHOD_DELETE )');
CL.AddTypeS('TRestResponseHandler', 'Procedure ( ResponseContent : TStream)');
CL.AddClassN(CL.FindClass('TOBJECT'),'TRestResource');
CL.AddTypeS('TCustomCreateConnection', 'Procedure ( Sender : TObject; AConnec'
+'tionType : THttpConnectionType; out AConnection : IHttpConnection)');
SIRegister_TJsonListAdapter(CL);
CL.AddClassN(CL.FindClass('TOBJECT'),'TRestClient');
CL.AddTypeS('TRestOnRequestEvent', 'Procedure ( ARestClient : TRestClient; AR'
+'esource : TRestResource; AMethod : TRestRequestMethod)');
CL.AddTypeS('TRestOnResponseEvent', 'Procedure ( ARestClient : TRestClient; R'
+'esponseCode : Integer; const ResponseContent : string)');
CL.AddTypeS('THTTPErrorEvent', 'Procedure ( ARestClient : TRestClient; AResou'
+'rce : TRestResource; AMethod : TRestRequestMethod; AHTTPError : EHTTPError; var ARetryMode : THTTPRetryMode)');
SIRegister_TRestClient(CL);
SIRegister_TRestCookie(CL);
SIRegister_TRestResource(CL);
//SIRegister_TMultiPartFormAttachment(CL);
//SIRegister_TMultiPartFormData(CL);
end;
Produce a formatted 12×12 multiplication table of the kind memorized by rote when in primary (or elementary) school.
program MultiplicationTables;
//https://rosettacode.org/wiki/Multiplication_tables
const
MAX_COUNT = 12;
var
lRow, lCol: Integer;
begin //@main
maxform1.orangestyle1click(self);
memo2.font.name:= 'courier';
memo1.font.size:= 12;
Write(' | ');
for lRow := 1 to MAX_COUNT do
Write(Format('%4d', [lRow]));
Writeln('');
Writeln('--+-' + StringOfChar('-', MAX_COUNT * 4));
for lRow := 1 to MAX_COUNT do begin
Write(Format('%2d', [lRow]));
Write('| ');
for lCol := 1 to MAX_COUNT do begin
if lCol < lRow then
Write(' ')
else
Write(Format('%4d', [lRow * lCol]));
end;
Writeln('');
end;
end.
_od#HMM6&*MMMH::-_
_dHMMMR??MMM? ""| `"'-?Hb_
.~HMMMMMMMMHMMM#M? `*HMb.
./?HMMMMMMMMMMM"*""" &MHb.
/'|MMMMMMMMMMM' - `*MHM\
/ |MMMMMMHHM'' .MMMHb
| 9HMMP .Hq, TMMMMMH
/ |MM\,H-""&&6\__ `MMMMMMb
| `""HH#, \ - MMMMMMM|
| `HoodHMM###. `9MMMMMH
| .MMMMMMMM##\ `*"?HM
| .. ,HMMMMMMMMMMMo\. |M
| |MMMMMMMMMMMMMMMMHo |M
| ?MMMMMMMMMMMMMMMM* |H
|. `#MMMMMMMMMMMMM' .M|
\ `MMMMMMMMMMM* |P
`\ MMMMMMMMT"' ,H
`\ `MMMMMMH? ./
\. |MMMH#" ,/
`\. |MMP' ./'
`~\ `HM:.- . ,/'
"-\_ '_\ . _.-"
"-\-#odMM\_,oo==-"
maXbox4 1203_multiplicationtable.txt Compiled done: 06/04/2023 20:51:38
| 1 2 3 4 5 6 7 8 9 10 11 12
–+————————————————-
1| 1 2 3 4 5 6 7 8 9 10 11 12
2| 4 6 8 10 12 14 16 18 20 22 24
3| 9 12 15 18 21 24 27 30 33 36
4| 16 20 24 28 32 36 40 44 48
5| 25 30 35 40 45 50 55 60
6| 36 42 48 54 60 66 72
7| 49 56 63 70 77 84
8| 64 72 80 88 96
9| 81 90 99 108
10| 100 110 120
11| 121 132
12| 144
mX4 executed: 06/04/2023 20:51:39 Runtime: 0:0:1.178 Memload: 49% use
Exception Handling
When you send an invalid sign like Produce a formatted 12 × 12 multiplication table of the kind memorized… you get:
Exception: Bad Request (400) - 'https://api.openai.com/v1/completions'.
the invalid sign is the 12 × 12 which we fix with 12 x 12 as x not ×
with TRestClient you can resolve the event-handler with:
procedure TRestOnResponseEvent2(ARestClient: TRestClient; ResponseCode: Integer;
const ResponseContent: string);
begin
writeln(objtostr(arestclient));
writeln('on response '+responsecontent)
writeln('on response '+itoa(responsecode));
writeln('enabled compression '+botostr(arestclient.EnabledCompression));
end;
Then you get a more accurate error:
TRestClient@046E1E00
on response {
"error": {
"message": "Your request contained invalid JSON: 'utf-8' codec can't decode byte 0xd7 in position 65: invalid continuation byte",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
on response 400
enabled compression TRUE
aquest:= ' Produce a formatted 12 x 12 multiplication table of the kind memorized by rote when in primary (or elementary) school in Pascal. ';
writeln('Answer9: '+TRestClient3_AskChatGPT(aquest, Nil));
Answer9:
program MultiplicationTable;
uses crt;
var
i, j : Integer;
begin
clrscr;
writeln(' | 1 2 3 4 5 6 7 8 9 10 11 12');
writeln('--+-----------------------------------');
for i := 1 to 12 do
begin
write(i, ' |');
for j := 1 to 12 do
begin
write(Format('%3d', [i * j]));
end;
writeln;
end;
readln;
end.
The HTTP headers Accepts-Encoding is usually a comparison algorithm of request header. All the HTTP client used to tell the server which encoding or encoding it supports. Then the server will respond in any of the supporting encoding formats. The server selects any one of the proposals, uses it and informs the client of its choice with the Content-Encoding response header.
function TRestClient3_AskChatGPT(askstream: string;
aResponseHeader:TRestResponseHandler):string;
var pstrm: TStream;
JPostdat: string;
jo: TJSON; arest: TRestResource; ahint: IHttpConnection2;
begin
JPostDat:= '{'+
'"model": "text-davinci-003",'+
'"prompt": "%s",'+
'"max_tokens": 2048,'+
'"temperature": 0.15}';
with TRestClient.create(self) do begin
arest:= Resource('https://api.openai.com/v1/completions');
arest.ContentType('application/json');
arest.Authorization('Bearer '+CHATGPT_APIKEY2);
ConnectionType:= hctWinInet;
try
pstrm:= TStringStream.create(format(JPostDat,[askstream]));
jo:= TJSON.Create();
OnafterRequest:= @TRestOnRequestEvent2;
OnResponse:= @TRestOnResponseEvent2;
jo.parse(arest.Post(pstrm));
writeln('respcode: '+itoa(responsecode)+' verifycert: '+botostr(verifycert));
writeln('responseheader: '+responseheader['Date']);
writeln('content-encoding:'+responseheader['Content-Encoding']);
result:= jo.values['choices'].asarray[0].asobject['text'].asstring;
//OnResponse:= @TRestOnResponseEvent2;
//OnafterRequest:= @TRestOnRequestEvent2;
except
onError:= @THTTPErrorEvent21;
OnConnectionLost:= @THTTPConnectionLostEvent2;
finally
//Function UnWrapConnection: IHttpConnection2');
//ahint:= UnWrapConnection;
Free;
jo.Free;
pStrm.Free;
end;
end; //with
end;
Syntax:
Accept-Encoding: gzip | compress | deflate | br| identity| *
Note: Multiple algorithm are also can be applicable.
The HTTP Location header is a response header that is used under 2 circumstances to ask a browser to redirect a URL (status code 3xx) or provide information about the location of a newly created resource (status code of 201). Its usage is often confused with another HTTP Header which is HTTP Content-Location header. The main difference between them is that Location gives the URL of the resource where the redirection of the page happens while HTTP Content-Location is used to indicate the URL of a transmitted resource.
https://www.geeksforgeeks.org/http-headers-location/?ref=rp
maXbox4 1202_chatgpt_API37tester.txt Compiled done: 07/04/2023 10:17:21
TRestClient@046E2228
on response {“id”:”cmpl-72bZZ7n4OfQco41zWqcO1TaBMeiG7″,”object”:”text_completion”,”created”:1680855441,”model”:”text-davinci-003″,”choices”:[{“text”:”\n\nprogram MultiplicationTable;\n\n{This program prints a 12×12 multiplication table}\n\nvar\n i, j : Integer;\n\nbegin\n Writeln(‘ | 1 2 3 4 5 6 7 8 9 10 11 12’);\n Writeln(‘–+———————————–‘);\n for i := 1 to 12 do\n begin\n Write(i, ‘ |’);\n for j := 1 to 12 do\n begin\n Write(Format(‘%3d’, [i * j]));\n end;\n Writeln;\n end;\nend.”,”index”:0,”logprobs”:null,”finish_reason”:”stop”}],”usage”:{“prompt_tokens”:29,”completion_tokens”:138,”total_tokens”:167}}on response 200
enabled compression TRUE
content-encoding:
on request method 1
responsecode: 200 verifycert: TRUE
responseheader: Fri, 07 Apr 2023 08:17:25 GMT
content-encoding:
Answer9:program MultiplicationTable;
{This program prints a 12×12 multiplication table}
var
i, j : Integer;begin
Writeln(‘ | 1 2 3 4 5 6 7 8 9 10 11 12’);
Writeln(‘–+———————————–‘);
for i := 1 to 12 do
begin
Write(i, ‘ |’);
for j := 1 to 12 do
begin
Write(Format(‘%3d’, [i * j]));
end;
Writeln;
end;
end.
mX4 executed: 07/04/2023 10:17:25 Runtime: 0:0:4.658 Memload: 48% use
Version 32 with onResponse Exception Event
{$I .\OPENAIAPIKEY.INC}
procedure TRestOnResponseEvent2(ARestClient: TRestClient; ResponseCode:Integer;
const ResponseContent: string);
begin
print('@addr:'+objtostr(arestclient));
print('response cont: '+responsecontent)
print('response code: '+itoa(responsecode));
print('enabled compression '+botostr(arestclient.EnabledCompression));
print('content-encoding:'+arestclient.responseheader['Content-Encoding']);
print('verifycert: '+botostr(arestclient.verifycert));
end;
function TRestClient3_AskChatGPT(askstream: string;
aResponseHeader:TRestResponseHandler):string;
var JPostdat: string;
jo: TJSON; rest: TRestResource;
begin
JPostDat:= '{'+
'"model": "text-davinci-003",'+
'"prompt": "%s",'+
'"max_tokens": 2048,'+
'"temperature": 0.15}';
with TRestClient.create(self) do begin
rest:= Resource('https://api.openai.com/v1/completions');
println('@addr:'+objtostr(rest))
rest.ContentType('application/json');
rest.Authorization('Bearer '+CHATGPT_APIKEY2);
ConnectionType:= hctWinInet;
OnResponse:= @TRestOnResponseEvent2;
try
jo:= TJSON.Create();
jo.parse(rest.Post(TStringStream.create(format(JPostDat,[askstream]))));
result:= jo.values['choices'].asarray[0].asobject['text'].asstring;
finally
Free;
jo.Free;
except
writeln('EWI_Exc:'+ExceptiontoString(exceptiontype,exceptionparam));
end;
end; //with
end;
http://softwareschule.ch/examples/chatgpt32.txt
//'Q: Write a Pascal program to list all prime numbers up to a user-input upper number';
var i,j,upper_numb: integer;
upper_numb:= 20;
writeln('Prime numbers up to '+itoa(upper_numb)+' are:');
for i:= 2 to upper_numb do begin
for j:= 2 to (i - 1) do begin
if (i mod j = 0) then
break;
end;
if (i = j) then
writeln(itoa(i));
end;



Test Bing Chat
What can I do with maXbox4 ?
maXbox4 is a script tool engine, compiler and source lib all in one exe to design and code your scripts in a shellbook1. It supports object scripting with Pascal syntax and has over 360000 functions and procedures1. You can use maXbox4 to learn programming, create applications, games, simulations, web services, and more2. You can also download maXbox4 from GitHub3 or Internet Archive4 and try it online on Replit2.
There are many examples of maXbox4 scripts available online. You can find some of them on the following sources:
A Medium blog post by maXbox that shows how to use Python code in maXbox4 scripts 1.
A list of all examples and tutorials included in the maXbox4 package 2.
A GitHub repository that contains the source code and documentation of maXbox4 ³.
A Replit page that allows you to run maXbox4 scripts online 4.
A SourceForge page that hosts some examples of maXbox4 scripts 5.
You can also create your own scripts using the Pascal syntax and the built-in functions and objects of maXbox4. You can use the editor, compiler, debugger, and code explorer features of maXbox4 to design and code your scripts in a shellbook.
Received message. There are many examples of maXbox4 scripts available online. You can find some of them on the following sources: – A Medium blog post by maXbox that shows how to use Python code in maXbox4 scripts. – A list of all examples and tutorials included in the maXbox4 package. – A GitHub repository that contains the source code and documentation of maXbox4. – A Replit page that allows you to run maXbox4 scripts online. – A SourceForge page that hosts some examples of maXbox4 scripts. You can also create your own scripts using the Pascal syntax and the built-in functions and objects of maXbox4. You can use the editor, compiler, debugger, and code explorer features of maXbox4 to design and code your scripts in a shellbook.
Learn more:
- maxbox4.wordpress.com
- softwareschule.ch
- github.com
- replit.com
- sourceforge.net
+2 more
How do I use Python code in maXbox4 scripts?
To use Python code in maXbox4 scripts, you need to use the PythonEngine component that allows you to evaluate or execute Python code from Pascal. You also need to have a Python DLL that matches your system architecture and load it with the OpenDll method. You can install Python from the official website1 or use the DLL provided by maXbox42. You can also check for registered Python versions with the GetRegisteredPythonVersions function2. Once you have the PythonEngine and the DLL ready, you can use the EvalStr or ExecStr methods to run Python code from a string or a file. For example, you can write something like this in your maXbox4 script2:
with TPythonEngine.create(self) do begin
Dllpath:= ‘C:\Users\max\AppData\Local\Programs\Python\Python36-32\’;
Dllname:= ‘python37_32.dll’;
LoadDll;
writeln(pythonhome);
writeln(ExecModule);
pypara:= ‘https://en.wikipedia.org/wiki/WoW64’;
try
writeln(evalstr(‘import(“math”).sqrt(45)’));
writeln(evalstr(‘import(“hashlib”).sha1(b”https://en.wikipedia.org/wiki/WoW64″).hexdigest()’));
writeln(evalstr(‘import(“hashlib”).sha1(b”‘+pypara+'”).hexdigest().upper()’));
writeln(evalstr(‘import(“hashlib”).sha256(b”‘+pypara+'”).hexdigest().upper()’));
except
on E: Exception do
writeln(E.ClassName, ‘: ‘, E.Message);
end;
end;
This will run some Python code that imports math and hashlib modules and performs some calculations and hashing operations. You can also use other methods of the PythonEngine component to access Python objects, variables, functions, and modules. For more information, you can refer to the documentation of Python4Delphi3, which is the library that maXbox4 uses to integrate with Python.
Received message. To use Python code in maXbox4 scripts, you need to use the PythonEngine component that allows you to evaluate or execute Python code from Pascal. You also need to have a Python DLL that matches your system architecture and load it with the OpenDll method. You can install Python from the official website or use the DLL provided by maXbox4. You can also check for registered Python versions with the GetRegisteredPythonVersions function. Once you have the PythonEngine and the DLL ready, you can use the EvalStr or ExecStr methods to run Python code from a string or a file. For example, you can write something like this in your maXbox4 script:
pascal with TPythonEngine.create(self) do begin Dllpath:= 'C:\\Users\\max\\AppData\\Local\\Programs\\Python\\Python36-32\\'; Dllname:= 'python37_32.dll'; LoadDll; writeln(pythonhome); writeln(ExecModule); pypara:= 'https://en.wikipedia.org/wiki/WoW64'; try writeln(evalstr('__import__("math").sqrt(45)')); writeln(evalstr('__import__("hashlib").sha1(b"https://en.wikipedia.org/wiki/WoW64").hexdigest()')); writeln(evalstr('__import__("hashlib").sha1(b"'+pypara+'").hexdigest().upper()')); writeln(evalstr('__import__("hashlib").sha256(b"'+pypara+'").hexdigest().upper()')); except on E: Exception do writeln(E.ClassName, ': ', E.Message); end; end; This will run some Python code that imports math and hashlib modules and performs some calculations and hashing operations. You can also use other methods of the PythonEngine component to access Python objects, variables, functions, and modules. For more information, you can refer to the documentation of Python4Delphi, which is the library that maXbox4 uses to integrate with Python.
Learn more:
- softwareschule.ch
- maxbox4.wordpress.com
- github.com
- stackoverflow.com
- realpython.com
+2 more
How do I use other languages or tools in maXbox4 scripts?
There are different ways to use other languages or tools in maXbox4 scripts, depending on what you want to achieve. Some of the possible methods are:
- Using the ExecuteShell function to run external commands or programs from your maXbox4 script. For example, you can write something like this to run a Python script from your maXbox4 script¹:
println(getDosOutput('py examples\\httpheader1.py --url "https://www.ipso.ch/ibz"',exePath));
- Using the TProcess component to create and control a child process from your maXbox4 script. For example, you can write something like this to run a Java program from your maXbox4 script²:
with TProcess.create(nil) do begin
Executable:= 'java';
Parameters.Add('-jar');
Parameters.Add('examples\\HelloWorld.jar');
Options:= Options + [poWaitOnExit];
Execute;
end;
- Using the TWebBrowser component to embed a web browser in your maXbox4 script and load web pages or web applications that use other languages or tools. For example, you can write something like this to load a Replit page that runs a JavaScript program from your maXbox4 script³:
with TWebBrowser.create(nil) do begin
Parent:= form1;
Align:= alClient;
Navigate('https://replit.com/@maxbox/maXbox4-code-compiler-script-studio');
end;
- Using the TPythonEngine component to evaluate or execute Python code from your maXbox4 script, as explained in the previous answer. You can also use other components that allow you to integrate with other languages or tools, such as TLuaEngine for Lua, TJSEngine for JavaScript, TRubyEngine for Ruby, etc. You can find some of these components on GitHub4 or SourceForge.
Source: Conversation with Bing, 14/05/2023
(1) maXbox4 4.7.6.10 11/08/2022 17:09:06 1. http://www.softwareschule.ch/download/maxbox_starter98.pdf.
(2) maxbox (max kleiner) – Replit. https://replit.com/@maxbox.
(3) GitHub – maxkleiner/maXbox4: code compiler script studio. https://github.com/maxkleiner/maXbox4.
(4) Releases · maxkleiner/maXbox4 · GitHub. https://github.com/maxkleiner/maXbox4/releases.
function XorEncode2(const Key, Source: AnsiString): AnsiString;
var I: Integer;
B: Byte;
begin
Result:='';
for I:= 1 to Length(Source) do begin
if Length(Key) > 0 then
B:= ord(Key[1+ ((I- 1) mod Length(Key))]) Xor ord(Source[I])
else
B:= ord(Source[I]);
Result:= Result+ AnsiString(AnsiLowerCase(IntToHex(B,2)));
end;
end;
function XorDecode2(const Key, Source: AnsiString): AnsiString;
var I: Integer;
B: Byte;
begin
Result:='';
for I:= 0 to Length(Source) div 2- 1 do begin
B:= StrToIntDef('$'+ string(Copy(Source,(I * 2)+ 1,2)),Ord(' '));
if Length(Key) > 0 then
B:= ord(Key[1+ (I mod Length(Key))]) Xor B;
//Result:= Result + AnsiChar(B);
Result:= Result+ chr(B);
end;
end;
writeln(XorEncode2('max123°','this is the box tox 5 hive®'));
writeln(xordecode2('max123°',XorEncode('max123°','this is the box tox 5 hive®')));
>>>
19091142125ac34d1510541251df15410c5e4a13854d091147579d
this is the box tox 5 hive®
A key committee of lawmakers in the European Parliament have approved a first-of-its-kind artificial intelligence regulation — making it closer to becoming law.
What do the rules say?
The AI Act categorizes applications of AI into four levels of risk: unacceptable risk, high risk, limited risk and minimal or no risk.
Unacceptable risk applications are banned by default and cannot be deployed in the bloc.
They include:
- AI systems using subliminal techniques, or manipulative or deceptive techniques to distort behavior
- AI systems exploiting vulnerabilities of individuals or specific groups
- Biometric categorization systems based on sensitive attributes or characteristics
- AI systems used for social scoring or evaluating trustworthiness
- AI systems used for risk assessments predicting criminal or administrative offenses
- AI systems creating or expanding facial recognition databases through untargeted scraping
- AI systems inferring emotions in law enforcement, border management, the workplace, and education
Several lawmakers had called for making the measures more expensive to ensure they cover ChatGPT.








in case you dont have valid apikey: Exception: : Incorrect API key provided: sk-your-***-key. You can find your API key at https://platform.openai.com/account/api-keys.
LikeLike
Along with the prompt, the temperature is one of the most important settings. It has a significant impact on the output, so it’s worth spending some time explaining it. The temperature controls how much randomness is in the output.
LikeLiked by 1 person
Dear friend
⏱️ I gift the 25 Packt ebook bundle (PDF, ePUB) to all new Finxter premium members joining on or before August 29th, today or tomorrow:
1. Machine Learning with R – Fourth Edition
2. Practical Guide to Azure Cognitive Services
3. Data Augmentation with Python
4. Creators of Intelligence
5. Hands-On Computer Vision with Detectron2
6. Hands-On Graph Neural Networks Using Python
7. Forecasting Time Series Data with Prophet – Second Edition
8. Computer Vision on AWS
9. Machine Learning in Microservices
10. Applied Geospatial Data Science with Python
11. The Kaggle Workbook
12. Deep Learning and XAI Techniques for Anomaly Detection
13. Azure Machine Learning Engineering
14. Machine Learning Model Serving Patterns and Best Practices
15. Machine Learning Security Principles
16. Applied Machine Learning and High-Performance Computing on AWS
17. The Art of Data-Driven Business
18. Applied Machine Learning for Healthcare and Life Sciences Using AWS
19. Deep Learning for Genomics
20. Accelerate Deep Learning Workloads with Amazon SageMaker
21. Machine Learning Engineering on AWS
22. Deep Learning with TensorFlow and Keras – Third Edition
23. Transformers for Natural Language Processing – Second Edition
24. Machine Learning with PyTorch and Scikit-Learn
25. Artificial Intelligence with Python – Second Edition
LikeLike