AI Object
 
Syntax
 
AI.Ask(Prompt As String, [Template As AITemplate], [Handle As Long]) As Long
 
Description
Submits a question to the Tradium AI service and returns immediately — it does not wait for the answer. The return value is a conversation handle greater than zero on success, or 0 when the question could not be submitted. After a return value of 0, read LastErrorCode and LastErrorMessage for the reason.
 
After a successful call, poll GetStatus until it no longer returns aiStatusBusy, then read the answer with GetResultStr.
 
When Handle is supplied, the question is treated as a follow-up in an existing conversation and the Template argument is ignored. A follow-up may only be sent on a handle that is no longer busy.
 
Parameter
Description
Prompt
String, the question or instruction for the model.
Template
AITemplate, optional. The system prompt template. Default aiGeneral. See NewConversation for the full list of templates. Ignored when Handle is supplied.
Handle
Long, optional. An existing handle to continue. Omit (or pass 0) to start a new conversation; pass a handle from NewConversation to ask a question with attachments; pass a handle from a previous Ask to ask a follow-up.
 
See Also
NewConversationGetStatusGetResultStrAttachFileCloseHandle.
Example
 
Dim aiHnd As Long
aiHnd = AI.Ask("Explain what a half-open date range is.", aiSQLCopilot)
If aiHnd = 0 Then
    Debug.Print "Submit failed: " & AI.LastErrorMessage
End If