| OpenAI | TsgcAIChat | Provider := aicpOpenAI. GPT models through the Chat Completions API. |
| Anthropic | TsgcAIChat | Provider := aicpAnthropic. Claude models through the Messages API. |
| Google Gemini | TsgcAIChat | Provider := aicpGemini. |
| DeepSeek | TsgcAIChat | Provider := aicpDeepSeek. deepseek-flash and deepseek-v4-pro. |
| Ollama (local models) | TsgcAIChat | Provider := aicpOllama. ChatOptions.BaseUrl points at your own host, nothing leaves the machine. |
| xAI Grok | TsgcAIChat | Provider := aicpGrok. |
| Mistral | TsgcAIChat | Provider := aicpMistral. |
| Blocking call | TsgcAIChat | Chat(aMessage) returns the assistant text. |
| Streaming | TsgcAIChat | ChatStream plus OnChatStream, which carries a Cancel flag to abort mid-generation. |
| Asynchronous | TsgcAIChat | ChatAsync returns a future on Delphi 2010 and later. |
| System prompt | TsgcAIChat | SystemMessage for every turn, or ChatWithSystem for a single turn. |
| Bounded history | TsgcAIChat | MaxHistoryMessages caps the replayed context. ClearHistory and GetHistory manage the transcript. |
| Sampling controls | TsgcAIChat | MaxTokens, Temperature and TopP. Leave the last two unset and the provider default applies. |
| Documents and attachments | TsgcAIChat | ChatWithDocument, ChatWithDocumentBase64, ChatWithAttachments and ChatJSONWithAttachments send PDFs and images with the message, one or several held in a TsgcAIChatAttachments list. |
| Tool calling | TsgcAIChat | ChatWithTools and AddToolResult on all seven providers, each in its own format: OpenAI style tools, Anthropic tool use and Gemini function declarations. |
| AI agent | TsgcAIAgent | Run offers your tools, methods of your objects (AddMethod, Delphi 2010 and later) and the tools of MCPClients, runs the calls, asks OnToolApproval for tools that are not ReadOnly and stops on the answer, Options.MaxSteps, the token limit (aasrMaxTokens), Cancel or an error. OnStep and OnUsage report the run. |
| Model aliases | TsgcAIChat | ModelAliases maps names such as fast or smart to a model or to provider:model, loaded from a file, JSON or a URL. ProviderApiKeys holds the key of each provider. |
| Provider fallback | TsgcAIChat | Fallbacks moves a request to the next provider and model on a connection error, HTTP 5xx, HTTP 429 or an unknown model, with tools and streaming. OnFallback reports every switch. |
| Token usage | TsgcAIChat | LastUsage and OnChatUsage: provider, model, input, output and cached tokens of every request, with UserId and SessionId. LastFinishReason: why the last answer ended, such as stop or length. |
| Costs and budgets | TsgcAIUsageMeter | Prices per million tokens, totals per user and session, total, daily or monthly budgets that can refuse a request, SaveToCSV, ExportToDataSet and OpenTelemetry spans with the GenAI conventions. |
| Guardrails | TsgcAIGuardrails | Redacts e-mails, phones, cards, IBANs, IP addresses and custom patterns before the request and restores them in the answer, AllowedTools and DeniedTools with wildcards, ToolApproval, and JSON schema validation of structured answers. |
| Document extraction | TsgcAIDocumentExtractor | PDF or image plus a JSON schema in, validated JSON out. Presets dpInvoice, dpReceipt and dpIDCard, a confidence per field with OnLowConfidence below MinConfidence, and one automatic retry when the answer does not validate. Link TsgcAIOCRTesseract or TsgcAIOCRWindows, the OCR built into Windows 10 and later, to recognise the text locally, so a text only model on Ollama can extract too. |
| Realtime voice agent | TsgcAIVoiceAgent | Listens, detects turns, talks back and calls tools over OpenAI Realtime or Gemini Live, on WebSocket or, with OpenAI, WebRTC, on Windows, Android and iOS. Server VAD, semantic VAD, client VAD or manual turns, barge-in that stops the agent and truncates its answer, live user and agent transcripts on OnTranscript, tools from OnToolCall and from an assigned MCPClient, and G.711 mu-law or A-law at 8 kHz for telephony. |
| Realtime voice translator | TsgcAIVoiceTranslator | Streams the microphone to OpenAI gpt-realtime-translate and plays the translated speech as it arrives, with live transcripts of the source and of the translation on OnInputTranscript and OnOutputTranscript. Change Language while the session runs, or turn the devices off and push your own PCM16 audio with SendAudio. Windows audio, or your own audio on Linux and macOS. |
| Speech to text | TsgcAIOpenAIChatBot, TsgcAIOpenAITranslator | gpt-transcribe transcription, and translation into any language through a chat model, with an event to review the text before use. |
| Retrieval augmented answers | TsgcAIOpenAIChatBot | Link an Embeddings component and the retrieved context is added before the model is called. |
| Assistants, threads and runs | TsgcAIOpenAIAssistant | CreateAssistant, CreateThread, CreateMessageText, CreateRun, CreateRunAndWait. |
| File Search and Code Interpreter | TsgcAIOpenAIAssistant | AssistantOptions.Tools, with UploadVectorStoreFile to add your own documents. |
| Function calling | TsgcAIOpenAIAssistant | Tools.Functions plus the OnFunctionCall event. |