Selects an effective configured provider by name, or uses the first enabled provider. Messages and binary attachments are passed directly to the configured model. Attachments have no MIME, extension or model capability filtering; FileName is metadata. Invalid requests, provider failures and incomplete or unsupported responses throw coded errors. No response format is forced, and there is no repair or automatic second model call. Cancellation and script timeout cancel the request; the standard 100-second HTTP timeout also bounds the call.
varresult=$AI.Complete({Messages:[{Role:'user',Content:'Return JSON with a summary of this request: '+requestText}]});varsummary=result.ToJson().summary;
varresult=$AI.Complete({Messages:[{Role:'user',Content:'Generate the requested file.'}]});varfile=result.Files[0];varfileRecord=$Files.AddBase64(file.ToBase64(),file.FileName||'output',file.MimeType);
varresult=$AI.Complete({Messages:[{Role:'user',Content:'Extract invoice text and number. Return JSON with text and invoiceNumber.',Attachments:[{MimeType:'application/pdf',DataBase64:documentBase64,FileName:'invoice.pdf'}]}]});vartext=result.ToJson().text;