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.
| ||||||||
See Also
| NewConversation, GetStatus, GetResultStr, AttachFile, CloseHandle.
| ||||||||
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
|