TsgcAIChat › Methods › ChatWithDocumentBase64
Sends a user message together with a document encoded as base64.
function ChatWithDocumentBase64(const aMessage, aBase64, aMediaType: string): string;
| Name | Type | Description |
|---|---|---|
aMessage | const string | User message. |
aBase64 | const string | Content of the document, base64 encoded. |
aMediaType | const string | Media type of the document. |
The assistant response, or an empty string on error. (string)
Use it when the document is already in memory. aMediaType is the media type of the data, for example application/pdf, image/png or image/jpeg.
See TsgcAIChat Documents and PDF for the providers that accept PDF documents.
Like Chat, a transport error, a provider error or a document the provider does not accept is reported through OnChatError and the method returns an empty string.
vAnswer := oChat.ChatWithDocumentBase64('What is the total?', vBase64, 'application/pdf');