TsgcAIChat › Methods › ChatWithDocumentBase64

ChatWithDocumentBase64 Method

Sends a user message together with a document encoded as base64.

Syntax

function ChatWithDocumentBase64(const aMessage, aBase64, aMediaType: string): string;

Parameters

NameTypeDescription
aMessageconst stringUser message.
aBase64const stringContent of the document, base64 encoded.
aMediaTypeconst stringMedia type of the document.

Return Value

The assistant response, or an empty string on error. (string)

Remarks

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.

Example

vAnswer := oChat.ChatWithDocumentBase64('What is the total?', vBase64, 'application/pdf');

Back to Methods