AI Object
 
Syntax
 
AI.AttachFile(Handle As Long, FilePath As String, [Caption As String]) As Boolean
 
Description
Attaches a file to a conversation handle, so the model can read its contents. Call this before Ask, on a handle obtained from NewConversation. The return value is True on success, or False on a validation error — in which case LastErrorCode and LastErrorMessage give the reason.
 
A handle accepts up to 5 files. Each file must not exceed 20 MB, and the combined size of all attachments on one handle must not exceed 30 MB.
 
Parameter
Description
Handle
Long, a handle created with NewConversation.
FilePath
String, the full path of the file to attach.
Caption
String, optional. A short description that helps the model understand the file (for example "Incoming invoice").
 

Supported file types

Category
Extensions
Text
.txt
Rich documents
.rtf, .doc, .docx
Spreadsheets
.xls, .xlsx, .xlsm
Images
.jpg, .png, .emf
PDF
.pdf, .pdfa
 
Any other extension is rejected with error code aiErrUnsupportedMime.
 
See Also
NewConversationAttachRecordsetClearAttachmentsAttachmentCountAsk.
Example
 
Dim aiHnd As Long
aiHnd = AI.NewConversation(aiGeneral)
If AI.AttachFile(aiHnd, "O:\Post\invoice_24018.pdf", "Incoming invoice") Then
    aiHnd = AI.Ask("Extract the invoice number, date and total amount.", , aiHnd)
End If