TsgcAIDocumentExtractor › Properties › AIChat
The TsgcAIChat component that sends the documents to the AI provider.
property AIChat: TsgcAI_Chat read FAIChat write SetAIChat;
—
The extractor does not talk to any provider by itself. Every request goes through the linked TsgcAIChat, so its Provider and ChatOptions (ApiKey, Model, BaseUrl...) decide which model reads the document. An extraction without AIChat raises EsgcAIDocumentExtractor.
During an extraction the component sets ChatOptions.ResponseFormat, JSONSchema and JSONSchemaName of the chat and restores the previous values when it finishes. The history of the chat is cleared at the start of every extraction, so a previous conversation or a previous document never reaches the answer.
PDF files are accepted by OpenAI, Anthropic and Gemini. DeepSeek, Grok, Mistral and Ollama accept images only.
oChat.Provider := aicpOpenAI;
oChat.ChatOptions.ApiKey := 'API_KEY';
oChat.ChatOptions.Model := 'gpt-4o-mini';
oExtractor.AIChat := oChat;