Tradium Basic Script has the ability to use COM+ objects and other classes from the Windows environment. Based on the same technology, Basic Script has access to a number of built-in class objects, which can call specific functions in Tradium. With this, Basic Script has powerful programming capabilities that perform even the most complex tasks in a single method or function.
The AI Object gives Basic Script access to the Tradium AI service. It allows a macro to send a question to a large language model, optionally accompanied by one or more files or a recordset, and to retrieve the generated answer — all without leaving the macro environment.
The AI Object is available in three Tradium hosts:
Host
| Typical use
|
|---|
Tradium Client
| Interactive macros run from the Basic Script editor.
|
MacroHandler (part of Tradium e-Comms Server)
| Server-side scheduled and queued macros.
|
AdminMailMain (part of Tradium e-Comms Server)
| Mail-workflow macros, for example document classification of incoming post.
|
The object is reached through the reserved class name AI. — in the same way as SQL., FTP. or XLS..
Asynchronous by design
Unlike most Tradium classes, the AI Object works asynchronously. A language model needs time to produce an answer — from a second to well over a minute when files are involved. The Ask method therefore does not wait for the answer. It submits the question, returns immediately with a numeric handle, and the macro then polls the status of that handle until the answer is ready.
This mirrors the way a recordset works: you open it, then you read from it. Here you ask, then you poll, then you read the result. See Using the AI Object for the full pattern.
NOTE: the use of AI within Tradium is based on fair use policy. When using AI often and/or with heavy loads, please expect a monthly charging fee, based on the amount of tokens spent.
|